Changeset 158
- Timestamp:
- 02/15/06 12:24:51 (2 years ago)
- Files:
-
- eaccelerator/branches/PHP_5_1/ChangeLog (modified) (1 diff)
- eaccelerator/branches/PHP_5_1/ea_restore.c (modified) (5 diffs)
- eaccelerator/branches/PHP_5_1/ea_store.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
eaccelerator/branches/PHP_5_1/ChangeLog
r157 r158 1 2006-02-15 Hans Rakers <hans at parse dot nl> 2 3 * PHP_5_1: Fixes for five failing tests found using the test suite created by Bart 4 Tests that failed where: 5 -ctor_dtor_inheritance (failed because __construct, __destruct and __clone were not properly set) 6 -destructor_and_exceptions (failed because inheritance of parent methods was broken, fixed by making sure ea_store doesn't store methods outside scope) 7 -inheritance_002 (failed because __construct, __destruct and __clone were not properly set) 8 -private_members (failed because __construct, __destruct and __clone were not properly set) 9 -type_hinting_003 (failed because array_type_hint introduced in zend_arg_info in PHP-5.1 was ignored) 10 1 11 2006-02-14 Bart Vanbrabant <bart.vanbrabant at zoeloelip dot be> 2 12 3 * PHP_5_1: Changed cflags to -O2 from -O313 * PHP_5_1: Changed cflags to -O2 from -O3 4 14 5 15 2006-02-07 Hans Rakers <hans at parse dot nl> eaccelerator/branches/PHP_5_1/ea_restore.c
r149 r158 478 478 479 479 ea_debug_pad(EA_DEBUG TSRMLS_CC); 480 ea_debug_printf(EA_DEBUG, "[%d] restore_op_array: %s \n", getpid(),481 from->function_name ? from->function_name : "(top)" );480 ea_debug_printf(EA_DEBUG, "[%d] restore_op_array: %s type=%x\n", getpid(), 481 from->function_name ? from->function_name : "(top)", from->type); 482 482 483 483 if (from->type == ZEND_INTERNAL_FUNCTION) { … … 599 599 ea_debug_printf(EA_DEBUG, "[%d] can't find\n", getpid()); 600 600 } 601 #ifdef ZEND_ENGINE_2 602 /* hrak: slight memleak here. dont forget to free the lowercase function name! */ 603 if (fname_lc != NULL) { 604 efree(fname_lc); 605 } 606 /* zend_internal_function also contains return_reference in ZE2 */ 607 to->return_reference = from->return_reference; 608 /* this gets set by zend_do_inheritance */ 609 to->prototype = NULL; 610 #endif 601 611 return to; 602 612 } … … 726 736 /* inherit parent methods */ 727 737 to->parent = *parent_ptr; 738 to->parent->refcount++; 728 739 ea_debug_printf(EA_DEBUG, "restore_class_parent: found parent %s..\n", to->parent->name); 729 740 ea_debug_printf(EA_DEBUG, "restore_class_parent: parent type=%d child type=%d\n", to->parent->type, to->type); 730 zend_do_inheritance(to, to->parent TSRMLS_CC); 731 to->parent->refcount++; 732 /* to->constructor = to->parent->constructor; 741 to->constructor = to->parent->constructor; 733 742 to->destructor = to->parent->destructor; 734 743 to->clone = to->parent->clone; 735 to->__get = to->parent->__get;744 /* to->__get = to->parent->__get; 736 745 to->__set = to->parent->__set; 737 746 # ifdef ZEND_ENGINE_2_1 … … 929 938 } 930 939 #endif 931 restore_hash(&to->function_table, &from->function_table,932 (restore_bucket_t) restore_op_array_ptr TSRMLS_CC);933 to->function_table.pDestructor = ZEND_FUNCTION_DTOR;934 935 940 if (from->parent != NULL) { 936 941 restore_class_parent(from->parent, strlen(from->parent), to TSRMLS_CC); … … 941 946 } 942 947 948 restore_hash(&to->function_table, &from->function_table, 949 (restore_bucket_t) restore_op_array_ptr TSRMLS_CC); 950 to->function_table.pDestructor = ZEND_FUNCTION_DTOR; 951 943 952 #ifdef ZEND_ENGINE_2 944 953 restore_class_methods(to TSRMLS_CC); 945 954 #endif 955 if (to->parent) 956 zend_do_inheritance(to, to->parent TSRMLS_CC); 946 957 EAG(class_entry) = old; 947 958 eaccelerator/branches/PHP_5_1/ea_store.c
r149 r158 541 541 542 542 ea_debug_pad(EA_DEBUG TSRMLS_CC); 543 ea_debug_printf(EA_DEBUG, "[%d] store_op_array: %s [scope=%s ]\n",543 ea_debug_printf(EA_DEBUG, "[%d] store_op_array: %s [scope=%s type=%x]\n", 544 544 getpid(), from->function_name ? from->function_name : "(top)", 545 545 #ifdef ZEND_ENGINE_2 … … 548 548 "NULL" 549 549 #endif 550 , from->type 550 551 ); 551 552 … … 580 581 to->arg_info[i].class_name_len = from->arg_info[i].class_name_len; 581 582 } 583 # ifdef ZEND_ENGINE_2_1 584 /* php 5.1 introduces this in zend_arg_info for array type hinting */ 585 to->arg_info[i].array_type_hint = from->arg_info[i].array_type_hint; 586 # endif 582 587 to->arg_info[i].allow_null = from->arg_info[i].allow_null; 583 588 to->arg_info[i].pass_by_reference = from->arg_info[i].pass_by_reference; … … 620 625 #endif 621 626 622 if (from->type == ZEND_INTERNAL_FUNCTION) 623 return to; 627 if (from->type == ZEND_INTERNAL_FUNCTION) { 628 #ifdef ZEND_ENGINE_2 629 /* zend_internal_function also contains return_reference in ZE2 */ 630 to->return_reference = from->return_reference; 631 #endif 632 return to; 633 } 624 634 625 635 to->opcodes = from->opcodes; … … 811 821 return ZEND_HASH_APPLY_KEEP; 812 822 } 813 814 #endif 823 #endif 824 825 /* 826 * This function makes sure that functions/methods that are not in the scope of the current 827 * class being stored, do not get copied to the function_table hash. This makes sure they 828 * get properly inherited on restore by zend_do_inheritance 829 * 830 * If we dont do this, it will result in broken inheritance, problems with final methods 831 * (e.g. "Cannot override final method") and the like. 832 */ 833 static int store_function_inheritance_check(Bucket * p, va_list args) 834 { 835 zend_class_entry *from = va_arg(args, zend_class_entry*); 836 zend_function *zf = p->pData; 837 838 if (zf->common.scope == from) { 839 return ZEND_HASH_APPLY_KEEP; 840 } 841 return ZEND_HASH_APPLY_REMOVE; 842 } 815 843 816 844 eaccelerator_class_entry *store_class_entry(zend_class_entry * from TSRMLS_DC) … … 866 894 store_hash(&to->properties_info, &from->properties_info, (store_bucket_t) store_property_info, (check_bucket_t) store_property_access_check, from); 867 895 # ifdef ZEND_ENGINE_2_1 896 ea_debug_printf(EA_DEBUG, "[%d] store_class_entry: from->static_members(%x), from->default_static_members(%x)\n", getpid(), from->static_members, &from->default_static_members); 868 897 if((from->static_members != NULL) && (from->static_members != &from->default_static_members)) { 869 898 store_zval_hash(&to->default_static_members, &from->default_static_members); … … 891 920 store_zval_hash(&to->default_properties, &from->default_properties); 892 921 #endif 893 store_hash(&to->function_table, &from->function_table, (store_bucket_t) store_op_array, NULL, NULL);922 store_hash(&to->function_table, &from->function_table, (store_bucket_t) store_op_array, (check_bucket_t) store_function_inheritance_check, from); 894 923 895 924 #ifdef DEBUG