extend zend_register_internal_class() and zend_register_internal_class_ex()?

From: Date: Tue, 25 Sep 2001 16:52:19 +0000
Subject: extend zend_register_internal_class() and zend_register_internal_class_ex()?
Groups: php.dev 
Request: Send a blank email to php-dev+get-66565@lists.php.net to get a copy of this message
I can't speak English. so I'll shortly talk. (and I can't using cvs.. ^^;;;) I found that zend_register_internal_class() and zend_register_internal_class_ex() is impossible adding default properties. And instance properties(adding by add_property_*() functions) can't inherit. I think, It's mean that user-defined class could not inherit default properties of internal classes. So, I define and implement new functions. and suggest.. :) ZEND_API zend_class_entry *zend_register_internal_class_with_default_property(zend_class_entry *class_entry, HashTable *default_properties); ZEND_API zend_class_entry *zend_register_internal_class_ex_with_default_property(zend_class_entry *class_entry, zend_class_entry *parent_ce, char *parent_name, HashTable *default_properties); and add_default_property_*() functions. zend_extend.h zend_extend.c <-- This is extended code. This append Zend_API.h(.c). php_scl.h scl.c <-- Test Code. This register internel classes 'object' and 'subobjet'. scl.php <-- Test script that working 'object', 'subobject' and 'subobject2'(subclass of 'subobject'). This is rusult excuted scl.php --------------------------------------------------------- Built-in class Object test. --------------------------------------------------------- Success to create instance of class object. Object Class Name : object Object Parent Class Name : Object Object Vars : Array ( [long_var1] => 100 [null_var1] => [bool_var1] => 1 [double_var1] => 100.1 [string_var1] => value [stringl_var1] => value [array_var1] => Array ( ) ) Object Class Vars : Array ( [long_var1] => 100 [null_var1] => [bool_var1] => 1 [double_var1] => 100.1 [string_var1] => value [stringl_var1] => value [array_var1] => Array ( ) ) Object Methods : Array ( [0] => object [1] => getclass [2] => getparentclass [3] => getobjectvars [4] => getclassvars [5] => getmethods [6] => methodexists [7] => issubobjectof ) --------------------------------------------------------- Built-in class Subobject test. --------------------------------------------------------- Success to create instance of class subobject. Subobject Class Name : subobject Subobject Parent Class Name : object Subobject Object Vars : Array ( [long_var2] => 200000 [null_var2] => [bool_var2] => 1 [double_var2] => 200.2 [string_var2] => extended_value [stringl_var2] => extended_value [array_var2] => Array ( ) [long_var1] => 100 [null_var1] => [bool_var1] => 1 [double_var1] => 100.1 [string_var1] => value [stringl_var1] => value [array_var1] => Array ( ) [type] => 100 [value] => 100 ) Subobject Class Vars : Array ( [long_var2] => 200000 [null_var2] => [bool_var2] => 1 [double_var2] => 200.2 [string_var2] => extended_value [stringl_var2] => extended_value [array_var2] => Array ( ) [long_var1] => 100 [null_var1] => [bool_var1] => 1 [double_var1] => 100.1 [string_var1] => value [stringl_var1] => value [array_var1] => Array ( ) ) Subobject Methods : Array ( [0] => subobject [1] => object [2] => getclass [3] => getparentclass [4] => getobjectvars [5] => getclassvars [6] => getmethods [7] => methodexists [8] => issubobjectof ) --------------------------------------------------------- User-defined class Subobject2 test. --------------------------------------------------------- Success to create instance of class subobject. Subobject Class Name : subobject2 Subobject Parent Class Name : subobject Subobject Object Vars : Array ( [long_var2] => 200000 [null_var2] => [bool_var2] => 1 [double_var2] => 200.2 [string_var2] => extended_value [stringl_var2] => extended_value [array_var2] => Array ( ) [long_var1] => 100 [null_var1] => not null :) [bool_var1] => [double_var1] => 203023.302 [string_var1] => another value [stringl_var1] => another value [array_var1] => Array ( [foo] => var ) [type] => 100 [value] => 100 ) Subobject Class Vars : Array ( [long_var2] => 200000 [null_var2] => [bool_var2] => 1 [double_var2] => 200.2 [string_var2] => extended_value [stringl_var2] => extended_value [array_var2] => Array ( ) [long_var1] => 100 [null_var1] => not null :) [bool_var1] => [double_var1] => 203023.302 [string_var1] => another value [stringl_var1] => another value [array_var1] => Array ( [foo] => var ) ) Subobject Methods : Array ( [0] => subobject [1] => object [2] => getclass [3] => getparentclass [4] => getobjectvars [5] => getclassvars [6] => getmethods [7] => methodexists [8] => issubobjectof [9] => subobject2 )

Attachment: [application/octet-stream] scl.tgz
« previous php.dev (#66565) next »