Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.1.3

Bug #13639 codeGen for zend_register_internal_class_ex not working
Submitted: 2008-04-10 07:37 UTC
From: kuc Assigned: hholzgra
Status: Closed Package: CodeGen_PECL (version 1.1.2)
PHP Version: 5.2.5 OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [2008-04-10 07:37 UTC] kuc (Christoph Kuner)
Description: ------------ I declared a Base-Class "Base". Further, I declared a derived class "Derived" as stated below <class name="Base"> <function name="f1"> <proto>int f1()</proto> <code>RETURN_LONG(42);</code> </function> <function name="f2"> <proto>float f2()</proto> <code>RETURN_DOUBLE(3.14);</code> </function> </class> <!-- child overwrites f1() --> <class name="Derived" extends="Base"> <function name="f1"> <proto>int f1()</proto> <code>RETURN_LONG(23);</code> </function> </class> The generated code for the class_init_Derived() looks like static void class_init_Derived(void) { zend_class_entry ce; INIT_CLASS_ENTRY(ce, "Derived", Derived_methods); Derived_ce_ptr = zend_register_internal_class_ex(&ce, NULL, "Base" TSRMLS_CC); } After make install I cannot construct a Derived-object, as it is unknown to PHP. I changed class_init_Derived() to: static void class_init_Derived(void) { zend_class_entry ce; INIT_CLASS_ENTRY(ce, "Derived", Derived_methods); Derived_ce_ptr = zend_register_internal_class_ex(&ce, Base_ce_ptr, NULL TSRMLS_CC); } After make install everthing would work fine. There seems to be a problem with the parent_name-parameter in function "zend_register_internal_class_ex()"

Comments

 [2008-04-22 04:58 UTC] hholzgra (Hartmut Holzgraefe)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. Thanks for spotting, the old test case did not catch this as it used dummy classes without declared methods (no idea why this makes a difference). Generated code is changed now and the test case modified to include methods in the test classes.