View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0005011 | OXID eShop (all versions) | 4.10. AutoLoader | public | 2013-03-21 14:00 | 2013-03-22 13:56 |
Reporter | alberthorta | Assigned To | |||
Priority | urgent | Severity | block | Reproducibility | always |
Status | resolved | Resolution | won't fix | ||
Platform | PHP 5.3.8 - OXID PE 4.7.3_54408 | OS | Linux | OS Version | 2.6.32.46-0.3-pa |
Product Version | 4.7.3 / 5.0.3 revision 54408 | ||||
Summary | 0005011: Problem overloading non custom classes | ||||
Description | When you try to extend a php base class like (by example) SphinxClient in oxutilsobject.php line 436 : class_alias($sParentClass, $sModuleParentClass); Fails if $sParentClass it's not user defined function. This restriction is not documented on php documentation (http://php.net/manual/en/function.class-alias.php) but I got this warning: Warning: First argument of class_alias() must be a name of user defined class in XXXXXXXXXXXX/core/oxutilsobject.php on line 436 Besides of the warning, the class it's not aliased so, everything ends in a Fatal Error like this: Fatal error: Class 'myclass_parent' not found in XXXXXXXXXXXX/modules/mymodule/core/myclass.php on line 1 The fix I applied is replace line 436 for: $oReflection = new ReflectionClass($sParentClass); if(!$oReflection->isUserDefined()) { eval("abstract class $sModuleParentClass extends $sParentClass {}"); } else { class_alias($sParentClass, $sModuleParentClass); } | ||||
Steps To Reproduce | try to overload a non user defined class on your module and add the line to do it on your metadata.php (extend) and try to onNew the class. | ||||
Additional Information | Only happens on (PHP 5 >= 5.3.0) | ||||
Tags | No tags attached. | ||||
Theme | Both | ||||
Browser | All | ||||
PHP Version | 5.3 | ||||
Database Version | any | ||||