View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0005916 | OXID eShop (all versions) | 4.10. AutoLoader | public | 2014-10-13 16:21 | 2024-02-14 10:51 |
Reporter | thomas_oppelt | Assigned To | |||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | 4.9.0 / 5.2.0 | ||||
Fixed in Version | 6.0.0-beta.1 | ||||
Summary | 0005916: oxAutoload can cause preg_match compilation warnings on namespaced class names | ||||
Description | Although OXID does not make use of namespaces itself of course, the autoloader must not cause any warnings when it comes to autloading of full qualified class names. | ||||
Steps To Reproduce | Try wherever in OXID framework context the following check (or any other where e.g. this 'P‘ follows up a backslash): class_exists('Foo\Bar\Provider'); => the oxid autloader comes up with this warning: Warning: preg_match(): Compilation failed: unknown property name after \P or \p at offset ... caused by l. 111 of file oxfunctions.php | ||||
Tags | No tags attached. | ||||
Theme | All | ||||
Browser | All | ||||
PHP Version | Not defined | ||||
Database Version | Not defined | ||||
has duplicate | 0006228 | closed | oxAutoload can cause preg_match compilation warnings on namespaced class names => Bug 5916 is not resolved |
|
Same Problem here. My solution as pull request: See pull Request: https://github.com/OXID-eSales/oxideshop_ce/pull/178 |
|
+1 |
|
The fix according to pull request no. 178 looks correct (also for another case): 1. must escape backslash '\' character for classes with namespaces, this is the current problem - "... whenever you reference a namespace in a string, each backslash must be escaped with another backslash because of how PHP handles strings" (from php.net docs). 2. escaping forward slash '/' is not required, but as it is used as preg_match delimiter it is safe to do so. |
|
Fixed with pull request https://github.com/OXID-eSales/oxideshop_ce/pull/178 |