Hello, I was just looking into how php was handing Objects extended from Overloaded objects. eg..
class ext_java extends Java { function ext_java() { echo "here"; } } $ob = new ext_java(); in this example the Java call handler for the over loaded object gets called and the ext_java constructor never gets called. I looked into how this was working..... if (zend_hash_find(CG(class_table), parent_class_name->u.constant.value.str.val, parent_class_name->u.constant.value.str.len+1, (void **) &parent_class)==SUCCESS) { /* copy functions */ zend_hash_copy(&CG(class_entry).function_table, &parent_class->function_table, (copy_ctor_func_t) function_add_ref, &tmp_zend_function, sizeof(zend_function)); /* copy default properties */ zend_hash_copy(&CG(class_entry).default_properties, &parent_class->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); /* copy overloaded handlers */ CG(class_entry).handle_function_call = parent_class->handle_function_call; CG(class_entry).handle_property_get = parent_class->handle_property_get; CG(class_entry).handle_property_set = parent_class->handle_property_set; CG(class_entry).parent = parent_class; zval_dtor(&parent_class_name->u.constant); } The part where it "copy overloaded handlers". That serves no purpose. Cause it's going to ALWAYS call the base class over loaded handlers and not leaving it to call the new extended methods.... So... I guess to get around something like this is it possible to change how it executes so it will try and call a function from the "defined" ones then if that fails then it will call the function handler or just not copy the handlers leaving the extend class to call the functions that dont exist.. eg.. <? class ext_java extends Java { // this __call along with the oo extension could be a workaround // to changing the way a function gets executed ie. just don't copy the // overload handlers function __call($function, $args) // i don't know the syntax for __call { parent::$function($args); } function ext_java() { parent::java("java.lang.System"); } function to_string() { return seralize($this); } } overload("ext_java"); $java = new ext_java(); echo $java->getProperty("os.name"); //will call the java code // (well php then java) echo $java->to_string(); //will call the php code ?> I guess another way to do it is in the overloaded class (java). The call handler can check to see if the object has a parent then choose not to handle the function and call the same function on the object. (follow me?) But the downfall here is it needs to be implemented on every overloaded class (dom, dir, java, etc..) Any thoughts? // Brad __________________________________________________ Do You Yahoo!? Yahoo! Sports - live college hoops coverage http://sports.yahoo.com/ -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php