[PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/Zend/zend_compile.c trunk/Zend/zend_compile.c
laruence Mon, 19 Dec 2011 10:05:48 + Revision: http://svn.php.net/viewvc?view=revisionrevision=321159 Log: Codes standard Remove useless empty lines Changed paths: U php/php-src/branches/PHP_5_4/Zend/zend_compile.c U php/php-src/trunk/Zend/zend_compile.c Modified: php/php-src/branches/PHP_5_4/Zend/zend_compile.c === --- php/php-src/branches/PHP_5_4/Zend/zend_compile.c 2011-12-19 09:58:29 UTC (rev 321158) +++ php/php-src/branches/PHP_5_4/Zend/zend_compile.c 2011-12-19 10:05:48 UTC (rev 321159) @@ -115,7 +115,6 @@ } /* }}} */ - static void zend_duplicate_property_info_internal(zend_property_info *property_info) /* {{{ */ { if (!IS_INTERNED(property_info-name)) { @@ -124,7 +123,6 @@ } /* }}} */ - static void zend_destroy_property_info(zend_property_info *property_info) /* {{{ */ { str_efree(property_info-name); @@ -134,7 +132,6 @@ } /* }}} */ - static void zend_destroy_property_info_internal(zend_property_info *property_info) /* {{{ */ { str_free((char*)property_info-name); @@ -167,7 +164,6 @@ } /* }}} */ - static void init_compiler_declarables(TSRMLS_D) /* {{{ */ { Z_TYPE(CG(declarables).ticks) = IS_LONG; @@ -211,7 +207,6 @@ } /* }}} */ - ZEND_API void file_handle_dtor(zend_file_handle *fh) /* {{{ */ { TSRMLS_FETCH(); @@ -220,7 +215,6 @@ } /* }}} */ - void init_compiler(TSRMLS_D) /* {{{ */ { CG(active_op_array) = NULL; @@ -232,7 +226,6 @@ } /* }}} */ - void shutdown_compiler(TSRMLS_D) /* {{{ */ { zend_stack_destroy(CG(bp_stack)); @@ -248,7 +241,6 @@ } /* }}} */ - ZEND_API char *zend_set_compiled_filename(const char *new_compiled_filename TSRMLS_DC) /* {{{ */ { char **pp, *p; @@ -265,35 +257,30 @@ } /* }}} */ - ZEND_API void zend_restore_compiled_filename(char *original_compiled_filename TSRMLS_DC) /* {{{ */ { CG(compiled_filename) = original_compiled_filename; } /* }}} */ - ZEND_API char *zend_get_compiled_filename(TSRMLS_D) /* {{{ */ { return CG(compiled_filename); } /* }}} */ - ZEND_API int zend_get_compiled_lineno(TSRMLS_D) /* {{{ */ { return CG(zend_lineno); } /* }}} */ - ZEND_API zend_bool zend_is_compiling(TSRMLS_D) /* {{{ */ { return CG(in_compilation); } /* }}} */ - static zend_uint get_temporary_variable(zend_op_array *op_array) /* {{{ */ { return (op_array-T)++ * ZEND_MM_ALIGNED_SIZE(sizeof(temp_variable)); @@ -609,7 +596,6 @@ #define MAKE_NOP(opline) { opline-opcode = ZEND_NOP; memset(opline-result,0,sizeof(opline-result)); memset(opline-op1,0,sizeof(opline-op1)); memset(opline-op2,0,sizeof(opline-op2)); opline-result_type=opline-op1_type=opline-op2_type=IS_UNUSED; } - static void zend_do_op_data(zend_op *data_op, const znode *value TSRMLS_DC) /* {{{ */ { data_op-opcode = ZEND_OP_DATA; @@ -3677,7 +3663,6 @@ } /* }}} */ - /* {{{ Originates from php_runkit_function_copy_ctor Duplicate structures in an op_array where necessary to make an outright duplicate */ static void zend_traits_duplicate_function(zend_function *fe, zend_class_entry *target_ce, char *newname TSRMLS_DC) @@ -3810,7 +3795,7 @@ fe-op_array.try_catch_array = (zend_try_catch_element*)estrndup((char*)fe-op_array.try_catch_array, sizeof(zend_try_catch_element) * fe-op_array.last_try_catch); fe-op_array.brk_cont_array = (zend_brk_cont_element*)estrndup((char*)fe-op_array.brk_cont_array, sizeof(zend_brk_cont_element) * fe-op_array.last_brk_cont); - + } /* }}} */ @@ -3868,32 +3853,32 @@ } else if (existing_fn-common.scope != ce) { add = 1; /* or inherited from other class or interface */ } - + if (add) { zend_function* parent_function; if (ce-parent zend_hash_quick_find(ce-parent-function_table, hash_key-arKey, hash_key-nKeyLength, hash_key-h, (void**) parent_function) != FAILURE) { prototype = parent_function; /* -common.fn_flags |= ZEND_ACC_ABSTRACT; */ /* we got that method in the parent class, and are going to override it, - except, if the trait is just asking to have an abstract method implemented. */ + except, if the trait is just asking to have an abstract method implemented. */ if (fn-common.fn_flags ZEND_ACC_ABSTRACT) { /* then we clean up an skip this method */ zend_function_dtor(fn); return ZEND_HASH_APPLY_REMOVE; } } - + fn-common.scope = ce; fn-common.prototype = prototype; - + if (prototype (prototype-common.fn_flags ZEND_ACC_IMPLEMENTED_ABSTRACT -|| prototype-common.fn_flags ZEND_ACC_ABSTRACT)) { -fn-common.fn_flags |= ZEND_ACC_IMPLEMENTED_ABSTRACT; - } else if (fn-common.fn_flags ZEND_ACC_IMPLEMENTED_ABSTRACT) { -/* remove ZEND_ACC_IMPLEMENTED_ABSTRACT flag, think it shouldn't be copied to class */ -fn-common.fn_flags = fn-common.fn_flags - ZEND_ACC_IMPLEMENTED_ABSTRACT; - } + || prototype-common.fn_flags ZEND_ACC_ABSTRACT)) { + fn-common.fn_flags |= ZEND_ACC_IMPLEMENTED_ABSTRACT; + } else if
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/Zend/zend_compile.c trunk/Zend/zend_compile.c
laruence Mon, 05 Dec 2011 12:33:56 + Revision: http://svn.php.net/viewvc?view=revisionrevision=320425 Log: Fix typo Changed paths: U php/php-src/branches/PHP_5_4/Zend/zend_compile.c U php/php-src/trunk/Zend/zend_compile.c Modified: php/php-src/branches/PHP_5_4/Zend/zend_compile.c === --- php/php-src/branches/PHP_5_4/Zend/zend_compile.c2011-12-05 12:22:30 UTC (rev 320424) +++ php/php-src/branches/PHP_5_4/Zend/zend_compile.c2011-12-05 12:33:56 UTC (rev 320425) @@ -2884,7 +2884,7 @@ zend_hash_find(ce-parent-function_table, lc_parent_class_name, ce-parent-name_length+1, (void **)function)==SUCCESS) { if (function-common.fn_flags ZEND_ACC_CTOR) { /* inherit parent's constructor */ - zend_hash_update(ce-function_table, lc_parent_class_name, ce-parent-name_length+1, function, sizeof(zend_function), (void**)new_function); + zend_hash_update(ce-function_table, lc_parent_class_name, ce-parent-name_length+1, function, sizeof(zend_function), (void**)new_function); function_add_ref(new_function); } } Modified: php/php-src/trunk/Zend/zend_compile.c === --- php/php-src/trunk/Zend/zend_compile.c 2011-12-05 12:22:30 UTC (rev 320424) +++ php/php-src/trunk/Zend/zend_compile.c 2011-12-05 12:33:56 UTC (rev 320425) @@ -2884,7 +2884,7 @@ zend_hash_find(ce-parent-function_table, lc_parent_class_name, ce-parent-name_length+1, (void **)function)==SUCCESS) { if (function-common.fn_flags ZEND_ACC_CTOR) { /* inherit parent's constructor */ - zend_hash_update(ce-function_table, lc_parent_class_name, ce-parent-name_length+1, function, sizeof(zend_function), (void**)new_function); + zend_hash_update(ce-function_table, lc_parent_class_name, ce-parent-name_length+1, function, sizeof(zend_function), (void**)new_function); function_add_ref(new_function); } } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/Zend/zend_compile.c trunk/Zend/zend_compile.c
pierrick Tue, 06 Dec 2011 06:44:22 + Revision: http://svn.php.net/viewvc?view=revisionrevision=320485 Log: Coding standard Changed paths: U php/php-src/branches/PHP_5_4/Zend/zend_compile.c U php/php-src/trunk/Zend/zend_compile.c Modified: php/php-src/branches/PHP_5_4/Zend/zend_compile.c === --- php/php-src/branches/PHP_5_4/Zend/zend_compile.c2011-12-06 06:30:46 UTC (rev 320484) +++ php/php-src/branches/PHP_5_4/Zend/zend_compile.c2011-12-06 06:44:22 UTC (rev 320485) @@ -6486,7 +6486,7 @@ GET_NODE(colon_token, opline-result); - jmp_token-u.op .opline_num = op_number; + jmp_token-u.op.opline_num = op_number; INC_BPC(CG(active_op_array)); } Modified: php/php-src/trunk/Zend/zend_compile.c === --- php/php-src/trunk/Zend/zend_compile.c 2011-12-06 06:30:46 UTC (rev 320484) +++ php/php-src/trunk/Zend/zend_compile.c 2011-12-06 06:44:22 UTC (rev 320485) @@ -6486,7 +6486,7 @@ GET_NODE(colon_token, opline-result); - jmp_token-u.op .opline_num = op_number; + jmp_token-u.op.opline_num = op_number; INC_BPC(CG(active_op_array)); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/Zend/zend_compile.c trunk/Zend/zend_compile.c
felipe Fri, 18 Nov 2011 13:56:41 + Revision: http://svn.php.net/viewvc?view=revisionrevision=319487 Log: - CS Changed paths: U php/php-src/branches/PHP_5_4/Zend/zend_compile.c U php/php-src/trunk/Zend/zend_compile.c Modified: php/php-src/branches/PHP_5_4/Zend/zend_compile.c === --- php/php-src/branches/PHP_5_4/Zend/zend_compile.c2011-11-18 13:53:47 UTC (rev 319486) +++ php/php-src/branches/PHP_5_4/Zend/zend_compile.c2011-11-18 13:56:41 UTC (rev 319487) @@ -3625,8 +3625,7 @@ zend_get_function_declaration(fn TSRMLS_CC), zend_get_function_declaration(other_trait_fn TSRMLS_CC)); } - } - else { + } else { /* otherwise, do the full check */ do_inheritance_check_on_method(fn, other_trait_fn TSRMLS_CC); } @@ -3818,22 +3817,28 @@ { if (!strncmp(mname, ZEND_CLONE_FUNC_NAME, mname_len)) { ce-clone = fe; fe-common.fn_flags |= ZEND_ACC_CLONE; - } - else if (!strncmp(mname, ZEND_CONSTRUCTOR_FUNC_NAME, mname_len)) { + } else if (!strncmp(mname, ZEND_CONSTRUCTOR_FUNC_NAME, mname_len)) { if (ce-constructor) { zend_error(E_COMPILE_ERROR, %s has colliding constructor definitions coming from traits, ce-name); } ce-constructor = fe; fe-common.fn_flags |= ZEND_ACC_CTOR; - } - else if (!strncmp(mname, ZEND_DESTRUCTOR_FUNC_NAME, mname_len)) { ce-destructor = fe; fe-common.fn_flags |= ZEND_ACC_DTOR; } - else if (!strncmp(mname, ZEND_GET_FUNC_NAME, mname_len)) ce-__get = fe; - else if (!strncmp(mname, ZEND_SET_FUNC_NAME, mname_len)) ce-__set = fe; - else if (!strncmp(mname, ZEND_CALL_FUNC_NAME,mname_len)) ce-__call = fe; - else if (!strncmp(mname, ZEND_UNSET_FUNC_NAME, mname_len)) ce-__unset = fe; - else if (!strncmp(mname, ZEND_ISSET_FUNC_NAME, mname_len)) ce-__isset = fe; - else if (!strncmp(mname, ZEND_CALLSTATIC_FUNC_NAME, mname_len)) ce-__callstatic= fe; - else if (!strncmp(mname, ZEND_TOSTRING_FUNC_NAME,mname_len)) ce-__tostring = fe; - else if (ce-name_length + 1 == mname_len) { + } else if (!strncmp(mname, ZEND_DESTRUCTOR_FUNC_NAME, mname_len)) { + ce-destructor = fe; fe-common.fn_flags |= ZEND_ACC_DTOR; + } else if (!strncmp(mname, ZEND_GET_FUNC_NAME, mname_len)) { + ce-__get = fe; + } else if (!strncmp(mname, ZEND_SET_FUNC_NAME, mname_len)) { + ce-__set = fe; + } else if (!strncmp(mname, ZEND_CALL_FUNC_NAME, mname_len)) { + ce-__call = fe; + } else if (!strncmp(mname, ZEND_UNSET_FUNC_NAME, mname_len)) { + ce-__unset = fe; + } else if (!strncmp(mname, ZEND_ISSET_FUNC_NAME, mname_len)) { + ce-__isset = fe; + } else if (!strncmp(mname, ZEND_CALLSTATIC_FUNC_NAME, mname_len)) { + ce-__callstatic = fe; + } else if (!strncmp(mname, ZEND_TOSTRING_FUNC_NAME, mname_len)) { + ce-__tostring = fe; + } else if (ce-name_length + 1 == mname_len) { char *lowercase_name = emalloc(ce-name_length + 1); zend_str_tolower_copy(lowercase_name, ce-name, ce-name_length); lowercase_name = (char*)zend_new_interned_string(lowercase_name, ce-name_length + 1, 1 TSRMLS_CC); @@ -4335,8 +4340,7 @@ An alias (%s) was defined for method %s(), but this method does not exist, cur_alias-alias, cur_alias-trait_method-method_name); - } - else { + } else { /** Here are two possible cases: 1) this is an attempt to modifiy the visibility of a method introduce as part of another alias. @@ -4354,8 +4358,7 @@ zend_error(E_COMPILE_ERROR, The modifiers for the trait alias %s() need to be changed in the same statment in which the alias is defined. Error,
Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/Zend/zend_compile.c trunk/Zend/zend_compile.c
Hi Felipe: On 18 Nov 2011, at 14:56, Felipe Pena wrote: felipe Fri, 18 Nov 2011 13:56:41 + Revision: http://svn.php.net/viewvc?view=revisionrevision=319487 - else if (!strncmp(mname, ZEND_DESTRUCTOR_FUNC_NAME, mname_len)) { ce-destructor = fe; fe-common.fn_flags |= ZEND_ACC_DTOR; } - else if (!strncmp(mname, ZEND_GET_FUNC_NAME, mname_len)) ce-__get = fe; - else if (!strncmp(mname, ZEND_SET_FUNC_NAME, mname_len)) ce-__set = fe; - else if (!strncmp(mname, ZEND_CALL_FUNC_NAME,mname_len)) ce-__call = fe; - else if (!strncmp(mname, ZEND_UNSET_FUNC_NAME, mname_len)) ce-__unset = fe; - else if (!strncmp(mname, ZEND_ISSET_FUNC_NAME, mname_len)) ce-__isset = fe; - else if (!strncmp(mname, ZEND_CALLSTATIC_FUNC_NAME, mname_len)) ce-__callstatic= fe; - else if (!strncmp(mname, ZEND_TOSTRING_FUNC_NAME,mname_len)) ce-__tostring = fe; - else if (ce-name_length + 1 == mname_len) { + } else if (!strncmp(mname, ZEND_DESTRUCTOR_FUNC_NAME, mname_len)) { + ce-destructor = fe; fe-common.fn_flags |= ZEND_ACC_DTOR; + } else if (!strncmp(mname, ZEND_GET_FUNC_NAME, mname_len)) { + ce-__get = fe; + } else if (!strncmp(mname, ZEND_SET_FUNC_NAME, mname_len)) { + ce-__set = fe; + } else if (!strncmp(mname, ZEND_CALL_FUNC_NAME, mname_len)) { + ce-__call = fe; + } else if (!strncmp(mname, ZEND_UNSET_FUNC_NAME, mname_len)) { + ce-__unset = fe; + } else if (!strncmp(mname, ZEND_ISSET_FUNC_NAME, mname_len)) { + ce-__isset = fe; + } else if (!strncmp(mname, ZEND_CALLSTATIC_FUNC_NAME, mname_len)) { + ce-__callstatic = fe; + } else if (!strncmp(mname, ZEND_TOSTRING_FUNC_NAME, mname_len)) { + ce-__tostring = fe; + } else if (ce-name_length + 1 == mname_len) { How is that change an improvement for readability? The previous formatting was an implicit tabled arrangement, which makes it very easy to see what the commonalities are and where the code differs. Breaking that up into multiple lines, does IMHO not improve readability or clarity. If you just missed the braces, well, they could have been added inline, no? And I do not really buy that 'CS' (that is coding style?) applies to such a special piece of code. Would it be a problem to revert that change, or at least 'table' it again? Best regards Stefan -- Stefan Marr Software Languages Lab Vrije Universiteit Brussel Pleinlaan 2 / B-1050 Brussels / Belgium http://soft.vub.ac.be/~smarr Phone: +32 2 629 2974 Fax: +32 2 629 3525 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/Zend/zend_compile.c trunk/Zend/zend_compile.c
On Fri, Nov 18, 2011 at 3:07 PM, Stefan Marr p...@stefan-marr.de wrote: Would it be a problem to revert that change, or at least 'table' it again? http://svn.php.net/viewvc/php/php-src/trunk/CODING_STANDARDS?revision=296679view=markup Nothing to discuss, love, hate, etc., just apply them :-) Cheers, -- Pierre @pierrejoye | http://blog.thepimp.net | http://www.libgd.org -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/Zend/zend_compile.c trunk/Zend/zend_compile.c
Hi, 2011/11/18 Stefan Marr p...@stefan-marr.de: Hi Felipe: On 18 Nov 2011, at 14:56, Felipe Pena wrote: felipe Fri, 18 Nov 2011 13:56:41 + Revision: http://svn.php.net/viewvc?view=revisionrevision=319487 - else if (!strncmp(mname, ZEND_DESTRUCTOR_FUNC_NAME, mname_len)) { ce-destructor = fe; fe-common.fn_flags |= ZEND_ACC_DTOR; } - else if (!strncmp(mname, ZEND_GET_FUNC_NAME, mname_len)) ce-__get = fe; - else if (!strncmp(mname, ZEND_SET_FUNC_NAME, mname_len)) ce-__set = fe; - else if (!strncmp(mname, ZEND_CALL_FUNC_NAME, mname_len)) ce-__call = fe; - else if (!strncmp(mname, ZEND_UNSET_FUNC_NAME, mname_len)) ce-__unset = fe; - else if (!strncmp(mname, ZEND_ISSET_FUNC_NAME, mname_len)) ce-__isset = fe; - else if (!strncmp(mname, ZEND_CALLSTATIC_FUNC_NAME, mname_len)) ce-__callstatic= fe; - else if (!strncmp(mname, ZEND_TOSTRING_FUNC_NAME, mname_len)) ce-__tostring = fe; - else if (ce-name_length + 1 == mname_len) { + } else if (!strncmp(mname, ZEND_DESTRUCTOR_FUNC_NAME, mname_len)) { + ce-destructor = fe; fe-common.fn_flags |= ZEND_ACC_DTOR; + } else if (!strncmp(mname, ZEND_GET_FUNC_NAME, mname_len)) { + ce-__get = fe; + } else if (!strncmp(mname, ZEND_SET_FUNC_NAME, mname_len)) { + ce-__set = fe; + } else if (!strncmp(mname, ZEND_CALL_FUNC_NAME, mname_len)) { + ce-__call = fe; + } else if (!strncmp(mname, ZEND_UNSET_FUNC_NAME, mname_len)) { + ce-__unset = fe; + } else if (!strncmp(mname, ZEND_ISSET_FUNC_NAME, mname_len)) { + ce-__isset = fe; + } else if (!strncmp(mname, ZEND_CALLSTATIC_FUNC_NAME, mname_len)) { + ce-__callstatic = fe; + } else if (!strncmp(mname, ZEND_TOSTRING_FUNC_NAME, mname_len)) { + ce-__tostring = fe; + } else if (ce-name_length + 1 == mname_len) { How is that change an improvement for readability? The previous formatting was an implicit tabled arrangement, which makes it very easy to see what the commonalities are and where the code differs. Breaking that up into multiple lines, does IMHO not improve readability or clarity. If you just missed the braces, well, they could have been added inline, no? And I do not really buy that 'CS' (that is coding style?) applies to such a special piece of code. Would it be a problem to revert that change, or at least 'table' it again? CS = Coding standards Well, our codind standards in the CODING_STANDARDS file states: ---8--- 3. Be generous with whitespace and braces. Keep one empty line between the variable declaration section and the statements in a block, as well as between logical statement groups in a block. Maintain at least one empty line between two functions, preferably two. Always prefer:: if (foo) { bar; } to: if(foo)bar; ---8--- So I just did it in conforming whole rest of the code. It's not a question of readability, but the following an adopted standards. -- Regards, Felipe Pena -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/Zend/zend_compile.c trunk/Zend/zend_compile.c
Hi: On 18 Nov 2011, at 15:16, Felipe Pena wrote: Hi, 2011/11/18 Stefan Marr p...@stefan-marr.de: Hi Felipe: On 18 Nov 2011, at 14:56, Felipe Pena wrote: felipe Fri, 18 Nov 2011 13:56:41 + Revision: http://svn.php.net/viewvc?view=revisionrevision=319487 - else if (!strncmp(mname, ZEND_DESTRUCTOR_FUNC_NAME, mname_len)) { ce-destructor = fe; fe-common.fn_flags |= ZEND_ACC_DTOR; } - else if (!strncmp(mname, ZEND_GET_FUNC_NAME, mname_len)) ce-__get = fe; - else if (!strncmp(mname, ZEND_SET_FUNC_NAME, mname_len)) ce-__set = fe; - else if (!strncmp(mname, ZEND_CALL_FUNC_NAME,mname_len)) ce-__call = fe; - else if (!strncmp(mname, ZEND_UNSET_FUNC_NAME, mname_len)) ce-__unset = fe; - else if (!strncmp(mname, ZEND_ISSET_FUNC_NAME, mname_len)) ce-__isset = fe; - else if (!strncmp(mname, ZEND_CALLSTATIC_FUNC_NAME, mname_len)) ce-__callstatic= fe; - else if (!strncmp(mname, ZEND_TOSTRING_FUNC_NAME,mname_len)) ce-__tostring = fe; - else if (ce-name_length + 1 == mname_len) { + } else if (!strncmp(mname, ZEND_DESTRUCTOR_FUNC_NAME, mname_len)) { + ce-destructor = fe; fe-common.fn_flags |= ZEND_ACC_DTOR; + } else if (!strncmp(mname, ZEND_GET_FUNC_NAME, mname_len)) { + ce-__get = fe; + } else if (!strncmp(mname, ZEND_SET_FUNC_NAME, mname_len)) { + ce-__set = fe; + } else if (!strncmp(mname, ZEND_CALL_FUNC_NAME, mname_len)) { + ce-__call = fe; + } else if (!strncmp(mname, ZEND_UNSET_FUNC_NAME, mname_len)) { + ce-__unset = fe; + } else if (!strncmp(mname, ZEND_ISSET_FUNC_NAME, mname_len)) { + ce-__isset = fe; + } else if (!strncmp(mname, ZEND_CALLSTATIC_FUNC_NAME, mname_len)) { + ce-__callstatic = fe; + } else if (!strncmp(mname, ZEND_TOSTRING_FUNC_NAME, mname_len)) { + ce-__tostring = fe; + } else if (ce-name_length + 1 == mname_len) { How is that change an improvement for readability? The previous formatting was an implicit tabled arrangement, which makes it very easy to see what the commonalities are and where the code differs. Breaking that up into multiple lines, does IMHO not improve readability or clarity. If you just missed the braces, well, they could have been added inline, no? And I do not really buy that 'CS' (that is coding style?) applies to such a special piece of code. Would it be a problem to revert that change, or at least 'table' it again? CS = Coding standards Well, our codind standards in the CODING_STANDARDS file states: ---8--- 3. Be generous with whitespace and braces. Keep one empty line between the variable declaration section and the statements in a block, as well as between logical statement groups in a block. Maintain at least one empty line between two functions, preferably two. Always prefer:: if (foo) { bar; } to: if(foo)bar; ---8--- So I just did it in conforming whole rest of the code. It's not a question of readability, but the following an adopted standards. Then at least follow what 3. states as the first (and deducted from that) most important statement: Be generous with whitespace Please, make it look like a table. That is not against the coding standards. (Which IMHO should leave room for exceptions when it comes to readability) Be generous with whitespace! Thanks. Stefan -- Stefan Marr Software Languages Lab Vrije Universiteit Brussel Pleinlaan 2 / B-1050 Brussels / Belgium http://soft.vub.ac.be/~smarr Phone: +32 2 629 2974 Fax: +32 2 629 3525 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/Zend/zend_compile.c trunk/Zend/zend_compile.c
Then at least follow what 3. states as the first (and deducted from that) most important statement: Be generous with whitespace Please, make it look like a table. That is not against the coding standards. (Which IMHO should leave room for exceptions when it comes to readability) Be generous with whitespace! 'Be generous with whitespace' is the opposite of what you want to do. I.e. generous != stingy. :P -- Regards, Felipe Pena -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/Zend/zend_compile.c trunk/Zend/zend_compile.c
On 18 Nov 2011, at 15:36, Felipe Pena wrote: 'Be generous with whitespace' is the opposite of what you want to do. I.e. generous != stingy. :P I was obviously to imprecise in my request: Index: Zend/zend_compile.c === --- Zend/zend_compile.c (revision 319492) +++ Zend/zend_compile.c (working copy) @@ -3815,30 +3815,45 @@ static void zend_add_magic_methods(zend_class_entry* ce, const char* mname, uint mname_len, zend_function* fe TSRMLS_DC) /* {{{ */ { - if (!strncmp(mname, ZEND_CLONE_FUNC_NAME, mname_len)) { - ce-clone = fe; fe-common.fn_flags |= ZEND_ACC_CLONE; - } else if (!strncmp(mname, ZEND_CONSTRUCTOR_FUNC_NAME, mname_len)) { + if (!strncmp(mname, ZEND_CLONE_FUNC_NAME, mname_len)) { + fe-common.fn_flags |= ZEND_ACC_CLONE; + ce-clone = fe; + } + else if (!strncmp(mname,ZEND_CONSTRUCTOR_FUNC_NAME, mname_len)) { + fe-common.fn_flags |= ZEND_ACC_CTOR; if (ce-constructor) { - zend_error(E_COMPILE_ERROR, %s has colliding constructor definitions coming from traits, ce-name); + zend_error(E_COMPILE_ERROR, + %s has colliding constructor definitions coming from traits, + ce-name); } - ce-constructor = fe; fe-common.fn_flags |= ZEND_ACC_CTOR; - } else if (!strncmp(mname, ZEND_DESTRUCTOR_FUNC_NAME, mname_len)) { - ce-destructor = fe; fe-common.fn_flags |= ZEND_ACC_DTOR; - } else if (!strncmp(mname, ZEND_GET_FUNC_NAME, mname_len)) { - ce-__get = fe; - } else if (!strncmp(mname, ZEND_SET_FUNC_NAME, mname_len)) { - ce-__set = fe; - } else if (!strncmp(mname, ZEND_CALL_FUNC_NAME, mname_len)) { - ce-__call = fe; - } else if (!strncmp(mname, ZEND_UNSET_FUNC_NAME, mname_len)) { - ce-__unset = fe; - } else if (!strncmp(mname, ZEND_ISSET_FUNC_NAME, mname_len)) { - ce-__isset = fe; - } else if (!strncmp(mname, ZEND_CALLSTATIC_FUNC_NAME, mname_len)) { - ce-__callstatic = fe; - } else if (!strncmp(mname, ZEND_TOSTRING_FUNC_NAME, mname_len)) { - ce-__tostring = fe; - } else if (ce-name_length + 1 == mname_len) { + ce-constructor = fe; + } + else if (!strncmp(mname,ZEND_DESTRUCTOR_FUNC_NAME, mname_len)) { + fe-common.fn_flags |= ZEND_ACC_DTOR; + ce-destructor = fe; + } + else if (!strncmp(mname,ZEND_GET_FUNC_NAME, mname_len)) { + ce-__get = fe; + } + else if (!strncmp(mname,ZEND_SET_FUNC_NAME, mname_len)) { + ce-__set = fe; + } + else if (!strncmp(mname,ZEND_CALL_FUNC_NAME, mname_len)) { + ce-__call = fe; + } + else if (!strncmp(mname,ZEND_UNSET_FUNC_NAME, mname_len)) { + ce-__unset = fe; + } + else if (!strncmp(mname,ZEND_ISSET_FUNC_NAME, mname_len)) { + ce-__isset = fe; + } + else if (!strncmp(mname,ZEND_CALLSTATIC_FUNC_NAME, mname_len)) { + ce-__callstatic= fe; + } + else if (!strncmp(mname,ZEND_TOSTRING_FUNC_NAME, mname_len)) { + ce-__tostring = fe; + } + else if (ce-name_length + 1 == mname_len) { char *lowercase_name = emalloc(ce-name_length + 1); zend_str_tolower_copy(lowercase_name, ce-name, ce-name_length); lowercase_name = (char*)zend_new_interned_string(lowercase_name, ce-name_length + 1, 1 TSRMLS_CC); The only thing you can argue about that is, that `else` is not on the same line as the closing brace of the if. However, you will see, if you remove it, that it becomes hard to parse the code. At least for me. So I would put in the break to emphasize the `else if` condition. Anyway, that is what I mean with `tabling` the related parts. I don't see how that violates the style guide, but IMHO, it makes quite a difference when it comes to readability of such involved if/else if/else if/else if/else if/else if/else if/else if/else if/else if constructs. Best regards Stefan -- Stefan Marr Software Languages Lab Vrije Universiteit Brussel Pleinlaan 2 / B-1050 Brussels / Belgium http://soft.vub.ac.be/~smarr Phone: +32 2 629 2974 Fax: +32 2 629 3525 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/Zend/zend_compile.c trunk/Zend/zend_compile.c
On Fri, Nov 18, 2011 at 4:03 PM, Stefan Marr p...@stefan-marr.de wrote: On 18 Nov 2011, at 15:36, Felipe Pena wrote: 'Be generous with whitespace' is the opposite of what you want to do. I.e. generous != stingy. :P I was obviously to imprecise in my request: I do not want to sound harsh but discussions about CS are pointless. Just apply them and that's it. If you like to do something different but inside the CS, then go ahead, more efficient than arguing endlessly about a space or two :) -- Pierre @pierrejoye | http://blog.thepimp.net | http://www.libgd.org -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/Zend/zend_compile.c trunk/Zend/zend_compile.c
felipe Thu, 17 Nov 2011 21:07:52 + Revision: http://svn.php.net/viewvc?view=revisionrevision=319422 Log: - Fix build Changed paths: U php/php-src/branches/PHP_5_4/Zend/zend_compile.c U php/php-src/trunk/Zend/zend_compile.c Modified: php/php-src/branches/PHP_5_4/Zend/zend_compile.c === --- php/php-src/branches/PHP_5_4/Zend/zend_compile.c2011-11-17 21:05:58 UTC (rev 319421) +++ php/php-src/branches/PHP_5_4/Zend/zend_compile.c2011-11-17 21:07:52 UTC (rev 319422) @@ -4047,7 +4047,7 @@ zend_trait_precedence *cur_precedence; zend_trait_method_reference *cur_method_ref; char *lcname; - bool method_exists; + zend_bool method_exists; /* resolve class references */ if (ce-trait_precedences) { Modified: php/php-src/trunk/Zend/zend_compile.c === --- php/php-src/trunk/Zend/zend_compile.c 2011-11-17 21:05:58 UTC (rev 319421) +++ php/php-src/trunk/Zend/zend_compile.c 2011-11-17 21:07:52 UTC (rev 319422) @@ -4047,7 +4047,7 @@ zend_trait_precedence *cur_precedence; zend_trait_method_reference *cur_method_ref; char *lcname; - bool method_exists; + zend_bool method_exists; /* resolve class references */ if (ce-trait_precedences) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/Zend/zend_compile.c trunk/Zend/zend_compile.c
gron Sat, 05 Nov 2011 02:05:28 + Revision: http://svn.php.net/viewvc?view=revisionrevision=318794 Log: Fixed inconsistent whitespace. # Belongs to svn rev. 318793. Changed paths: U php/php-src/branches/PHP_5_4/Zend/zend_compile.c U php/php-src/trunk/Zend/zend_compile.c Modified: php/php-src/branches/PHP_5_4/Zend/zend_compile.c === --- php/php-src/branches/PHP_5_4/Zend/zend_compile.c 2011-11-05 01:46:40 UTC (rev 318793) +++ php/php-src/branches/PHP_5_4/Zend/zend_compile.c 2011-11-05 02:05:28 UTC (rev 318794) @@ -3617,19 +3617,19 @@ /* if it is an abstract method, there is no collision */ if (other_trait_fn-common.fn_flags ZEND_ACC_ABSTRACT) { /* Make sure they are compatible */ -if (fn-common.fn_flags ZEND_ACC_ABSTRACT) { - /* In case both are abstract, just check prototype, but need to do that in both directions */ - if ( !zend_do_perform_implementation_check(fn, other_trait_fn TSRMLS_CC) - || !zend_do_perform_implementation_check(other_trait_fn, fn TSRMLS_CC)) { -zend_error(E_COMPILE_ERROR, Declaration of %s must be compatible with %s, //ZEND_FN_SCOPE_NAME(fn), fn-common.function_name, //::%s() - zend_get_function_declaration(fn TSRMLS_CC), - zend_get_function_declaration(other_trait_fn TSRMLS_CC)); - } -} -else { - /* otherwise, do the full check */ - do_inheritance_check_on_method(fn, other_trait_fn TSRMLS_CC); -} +if (fn-common.fn_flags ZEND_ACC_ABSTRACT) { + /* In case both are abstract, just check prototype, but need to do that in both directions */ + if ( !zend_do_perform_implementation_check(fn, other_trait_fn TSRMLS_CC) + || !zend_do_perform_implementation_check(other_trait_fn, fn TSRMLS_CC)) { + zend_error(E_COMPILE_ERROR, Declaration of %s must be compatible with %s, //ZEND_FN_SCOPE_NAME(fn), fn-common.function_name, //::%s() + zend_get_function_declaration(fn TSRMLS_CC), + zend_get_function_declaration(other_trait_fn TSRMLS_CC)); + } +} +else { + /* otherwise, do the full check */ + do_inheritance_check_on_method(fn, other_trait_fn TSRMLS_CC); +} /* we can savely free and remove it from other table */ zend_function_dtor(other_trait_fn); @@ -3639,7 +3639,7 @@ /* if fn is an abstract method */ if (fn-common.fn_flags ZEND_ACC_ABSTRACT) { /* Make sure they are compatible. - Here, we already know other_trait_fn cannot be abstract, full check ok. */ + Here, we already know other_trait_fn cannot be abstract, full check ok. */ do_inheritance_check_on_method(other_trait_fn, fn TSRMLS_CC); /* just mark as solved, will be added if its own trait is processed */ @@ -3810,7 +3810,7 @@ fe-op_array.try_catch_array = (zend_try_catch_element*)estrndup((char*)fe-op_array.try_catch_array, sizeof(zend_try_catch_element) * fe-op_array.last_try_catch); fe-op_array.brk_cont_array = (zend_brk_cont_element*)estrndup((char*)fe-op_array.brk_cont_array, sizeof(zend_brk_cont_element) * fe-op_array.last_brk_cont); - + } /* }}} */ @@ -3856,7 +3856,7 @@ zend_function* existing_fn = NULL; zend_function fn_copy, *fn_copy_p; zend_function* prototype = NULL; /* is used to determine the prototype according to the inheritance chain */ - + if (zend_hash_quick_find(ce-function_table, hash_key-arKey, hash_key-nKeyLength, hash_key-h, (void**) existing_fn) == FAILURE) { add = 1; /* not found */ } else if (existing_fn-common.scope != ce) { @@ -3869,7 +3869,7 @@ prototype = parent_function; /* -common.fn_flags |= ZEND_ACC_ABSTRACT; */ /* we got that method in the parent class, and are going to override it, - except, if the trait is just asking to have an abstract method implemented. */ + except, if the trait is just asking to have an abstract method implemented. */ if (fn-common.fn_flags ZEND_ACC_ABSTRACT) { /* then we clean up an skip this method */ zend_function_dtor(fn); @@ -3881,14 +3881,14 @@ fn-common.prototype = prototype; if (prototype - (prototype-common.fn_flags ZEND_ACC_IMPLEMENTED_ABSTRACT -|| prototype-common.fn_flags ZEND_ACC_ABSTRACT)) { - fn-common.fn_flags |= ZEND_ACC_IMPLEMENTED_ABSTRACT; -} else if (fn-common.fn_flags ZEND_ACC_IMPLEMENTED_ABSTRACT) { - /* remove ZEND_ACC_IMPLEMENTED_ABSTRACT flag, think it shouldn't be copied to class */ - fn-common.fn_flags = fn-common.fn_flags - ZEND_ACC_IMPLEMENTED_ABSTRACT; -} - + (prototype-common.fn_flags ZEND_ACC_IMPLEMENTED_ABSTRACT +|| prototype-common.fn_flags ZEND_ACC_ABSTRACT)) { +fn-common.fn_flags |= ZEND_ACC_IMPLEMENTED_ABSTRACT; + } else if (fn-common.fn_flags ZEND_ACC_IMPLEMENTED_ABSTRACT) { +/* remove ZEND_ACC_IMPLEMENTED_ABSTRACT
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/Zend/zend_compile.c trunk/Zend/zend_compile.c
tony2001 Thu, 03 Nov 2011 08:39:12 + Revision: http://svn.php.net/viewvc?view=revisionrevision=318723 Log: use jmp_addr only when it's initialized Changed paths: U php/php-src/branches/PHP_5_4/Zend/zend_compile.c U php/php-src/trunk/Zend/zend_compile.c Modified: php/php-src/branches/PHP_5_4/Zend/zend_compile.c === --- php/php-src/branches/PHP_5_4/Zend/zend_compile.c2011-11-03 08:25:01 UTC (rev 318722) +++ php/php-src/branches/PHP_5_4/Zend/zend_compile.c2011-11-03 08:39:12 UTC (rev 318723) @@ -3718,9 +3718,14 @@ for(i = 0; i fe-op_array.last; i++) { opcode_copy[i] = fe-op_array.opcodes[i]; if (opcode_copy[i].op1_type != IS_CONST) { - if (opcode_copy[i].op1.jmp_addr = fe-op_array.opcodes - opcode_copy[i].op1.jmp_addr fe-op_array.opcodes + fe-op_array.last) { - opcode_copy[i].op1.jmp_addr = opcode_copy + (fe-op_array.opcodes[i].op1.jmp_addr - fe-op_array.opcodes); + switch (opcode_copy[i].opcode) { + case ZEND_GOTO: + case ZEND_JMP: + if (opcode_copy[i].op1.jmp_addr opcode_copy[i].op1.jmp_addr = fe-op_array.opcodes + opcode_copy[i].op1.jmp_addr fe-op_array.opcodes + fe-op_array.last) { + opcode_copy[i].op1.jmp_addr = opcode_copy + (fe-op_array.opcodes[i].op1.jmp_addr - fe-op_array.opcodes); + } + break; } } else { /* if __CLASS__ i.e. T_CLASS_C was used, we need to fix it up here */ @@ -3739,9 +3744,18 @@ } if (opcode_copy[i].op2_type != IS_CONST) { - if (opcode_copy[i].op2.jmp_addr = fe-op_array.opcodes - opcode_copy[i].op2.jmp_addr fe-op_array.opcodes + fe-op_array.last) { - opcode_copy[i].op2.jmp_addr = opcode_copy + (fe-op_array.opcodes[i].op2.jmp_addr - fe-op_array.opcodes); + switch (opcode_copy[i].opcode) { + case ZEND_JMPZ: + case ZEND_JMPNZ: + case ZEND_JMPZ_EX: + case ZEND_JMPNZ_EX: + case ZEND_JMP_SET: + case ZEND_JMP_SET_VAR: + if (opcode_copy[i].op2.jmp_addr opcode_copy[i].op2.jmp_addr = fe-op_array.opcodes + opcode_copy[i].op2.jmp_addr fe-op_array.opcodes + fe-op_array.last) { + opcode_copy[i].op2.jmp_addr = opcode_copy + (fe-op_array.opcodes[i].op2.jmp_addr - fe-op_array.opcodes); + } + break; } } else { /* if __CLASS__ i.e. T_CLASS_C was used, we need to fix it up here */ Modified: php/php-src/trunk/Zend/zend_compile.c === --- php/php-src/trunk/Zend/zend_compile.c 2011-11-03 08:25:01 UTC (rev 318722) +++ php/php-src/trunk/Zend/zend_compile.c 2011-11-03 08:39:12 UTC (rev 318723) @@ -3718,9 +3718,14 @@ for(i = 0; i fe-op_array.last; i++) { opcode_copy[i] = fe-op_array.opcodes[i]; if (opcode_copy[i].op1_type != IS_CONST) { - if (opcode_copy[i].op1.jmp_addr = fe-op_array.opcodes - opcode_copy[i].op1.jmp_addr fe-op_array.opcodes + fe-op_array.last) { - opcode_copy[i].op1.jmp_addr = opcode_copy + (fe-op_array.opcodes[i].op1.jmp_addr - fe-op_array.opcodes); + switch (opcode_copy[i].opcode) { + case ZEND_GOTO: + case ZEND_JMP: + if (opcode_copy[i].op1.jmp_addr opcode_copy[i].op1.jmp_addr = fe-op_array.opcodes + opcode_copy[i].op1.jmp_addr fe-op_array.opcodes + fe-op_array.last) { + opcode_copy[i].op1.jmp_addr = opcode_copy + (fe-op_array.opcodes[i].op1.jmp_addr - fe-op_array.opcodes); + } + break; } } else { /* if __CLASS__ i.e. T_CLASS_C was used, we need to fix it up here */ @@ -3739,9 +3744,18 @@ } if (opcode_copy[i].op2_type !=
Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/Zend/zend_compile.c trunk/Zend/zend_compile.c
Hi Antony: On 02 Nov 2011, at 22:05, Antony Dovgal wrote: tony2001 Wed, 02 Nov 2011 21:05:36 + Revision: http://svn.php.net/viewvc?view=revisionrevision=318705 Log: initialize variable and fix segfaulting tests Thanks for catching this one and the one in svnrev 318723. Do you have test cases which trigger these bugs by any chance? Thanks Stefan -- Stefan Marr Software Languages Lab Vrije Universiteit Brussel Pleinlaan 2 / B-1050 Brussels / Belgium http://soft.vub.ac.be/~smarr Phone: +32 2 629 2974 Fax: +32 2 629 3525 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/Zend/zend_compile.c trunk/Zend/zend_compile.c
On 11/03/2011 01:21 PM, Stefan Marr wrote: Hi Antony: On 02 Nov 2011, at 22:05, Antony Dovgal wrote: tony2001 Wed, 02 Nov 2011 21:05:36 + Revision: http://svn.php.net/viewvc?view=revisionrevision=318705 Log: initialize variable and fix segfaulting tests Thanks for catching this one and the one in svnrev 318723. Do you have test cases which trigger these bugs by any chance? Yeah, some 30 tests in Zend/tests/traits: /local/qa/5_4_non-ZTS/Zend/tests/traits/bug55137.phpt /local/qa/5_4_non-ZTS/Zend/tests/traits/bug55214.phpt /local/qa/5_4_non-ZTS/Zend/tests/traits/bug55355.phpt /local/qa/5_4_non-ZTS/Zend/tests/traits/bug55372.phpt /local/qa/5_4_non-ZTS/Zend/tests/traits/bug55424.phpt /local/qa/5_4_non-ZTS/Zend/tests/traits/bug4a.phpt /local/qa/5_4_non-ZTS/Zend/tests/traits/bug4b.phpt /local/qa/5_4_non-ZTS/Zend/tests/traits/bug4d.phpt /local/qa/5_4_non-ZTS/Zend/tests/traits/bug4f.phpt /local/qa/5_4_non-ZTS/Zend/tests/traits/bug4g.phpt /local/qa/5_4_non-ZTS/Zend/tests/traits/bugs/abstract-methods01.phpt /local/qa/5_4_non-ZTS/Zend/tests/traits/bugs/abstract-methods02.phpt /local/qa/5_4_non-ZTS/Zend/tests/traits/bugs/abstract-methods04.phpt /local/qa/5_4_non-ZTS/Zend/tests/traits/bugs/alias-semantics.phpt /local/qa/5_4_non-ZTS/Zend/tests/traits/bugs/alias-semantics02.phpt /local/qa/5_4_non-ZTS/Zend/tests/traits/bugs/alias01.phpt /local/qa/5_4_non-ZTS/Zend/tests/traits/error_012.phpt /local/qa/5_4_non-ZTS/Zend/tests/traits/flattening001.phpt /local/qa/5_4_non-ZTS/Zend/tests/traits/flattening003.phpt /local/qa/5_4_non-ZTS/Zend/tests/traits/interface_002.phpt /local/qa/5_4_non-ZTS/Zend/tests/traits/language001.phpt /local/qa/5_4_non-ZTS/Zend/tests/traits/language002.phpt /local/qa/5_4_non-ZTS/Zend/tests/traits/language003.phpt /local/qa/5_4_non-ZTS/Zend/tests/traits/language004.phpt /local/qa/5_4_non-ZTS/Zend/tests/traits/language005.phpt /local/qa/5_4_non-ZTS/Zend/tests/traits/language006.phpt /local/qa/5_4_non-ZTS/Zend/tests/traits/language007.phpt /local/qa/5_4_non-ZTS/Zend/tests/traits/language008a.phpt /local/qa/5_4_non-ZTS/Zend/tests/traits/language008b.phpt /local/qa/5_4_non-ZTS/Zend/tests/traits/language009.phpt /local/qa/5_4_non-ZTS/Zend/tests/traits/language012.phpt /local/qa/5_4_non-ZTS/Zend/tests/traits/language013.phpt /local/qa/5_4_non-ZTS/Zend/tests/traits/methods_001.phpt /local/qa/5_4_non-ZTS/Zend/tests/traits/methods_003.phpt /local/qa/5_4_non-ZTS/Zend/tests/traits/noctor001.phpt /local/qa/5_4_non-ZTS/Zend/tests/traits/static_001.phpt /local/qa/5_4_non-ZTS/Zend/tests/traits/static_002.phpt /local/qa/5_4_non-ZTS/Zend/tests/traits/static_003.phpt /local/qa/5_4_non-ZTS/Zend/tests/traits/static_004.phpt /local/qa/5_4_non-ZTS/Zend/tests/traits/static_get_called_class.phpt /local/qa/5_4_non-ZTS/Zend/tests/traits/trait_constant_001.phpt Same tests when executed under Valgrind (run-test.php -m) showed the warnings I fixed in my last commit. -- Wbr, Antony Dovgal --- http://pinba.org - realtime profiling for PHP -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/Zend/zend_compile.c trunk/Zend/zend_compile.c
tony2001 Wed, 02 Nov 2011 21:05:36 + Revision: http://svn.php.net/viewvc?view=revisionrevision=318705 Log: initialize variable and fix segfaulting tests Changed paths: U php/php-src/branches/PHP_5_4/Zend/zend_compile.c U php/php-src/trunk/Zend/zend_compile.c Modified: php/php-src/branches/PHP_5_4/Zend/zend_compile.c === --- php/php-src/branches/PHP_5_4/Zend/zend_compile.c2011-11-02 21:00:53 UTC (rev 318704) +++ php/php-src/branches/PHP_5_4/Zend/zend_compile.c2011-11-02 21:05:36 UTC (rev 318705) @@ -3823,7 +3823,7 @@ { zend_class_entry *ce = va_arg(args, zend_class_entry*); int add = 0; - zend_function* existing_fn; + zend_function* existing_fn = NULL; zend_function fn_copy, *fn_copy_p; zend_function* prototype = NULL; /* is used to determine the prototype according to the inheritance chain */ Modified: php/php-src/trunk/Zend/zend_compile.c === --- php/php-src/trunk/Zend/zend_compile.c 2011-11-02 21:00:53 UTC (rev 318704) +++ php/php-src/trunk/Zend/zend_compile.c 2011-11-02 21:05:36 UTC (rev 318705) @@ -3823,7 +3823,7 @@ { zend_class_entry *ce = va_arg(args, zend_class_entry*); int add = 0; - zend_function* existing_fn; + zend_function* existing_fn = NULL; zend_function fn_copy, *fn_copy_p; zend_function* prototype = NULL; /* is used to determine the prototype according to the inheritance chain */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/Zend/zend_compile.c trunk/Zend/zend_compile.c
tony2001 Wed, 02 Nov 2011 21:12:13 + Revision: http://svn.php.net/viewvc?view=revisionrevision=318706 Log: fix folding, ws and cs Changed paths: U php/php-src/branches/PHP_5_4/Zend/zend_compile.c U php/php-src/trunk/Zend/zend_compile.c Modified: php/php-src/branches/PHP_5_4/Zend/zend_compile.c === --- php/php-src/branches/PHP_5_4/Zend/zend_compile.c2011-11-02 21:05:36 UTC (rev 318705) +++ php/php-src/branches/PHP_5_4/Zend/zend_compile.c2011-11-02 21:12:13 UTC (rev 318706) @@ -3787,8 +3787,11 @@ } /* }}} */ -static void zend_add_magic_methods(zend_class_entry* ce, const char* mname, uint mname_len, zend_function* fe TSRMLS_DC) { - if ( !strncmp(mname, ZEND_CLONE_FUNC_NAME, mname_len)) { ce-clone = fe; fe-common.fn_flags |= ZEND_ACC_CLONE; } +static void zend_add_magic_methods(zend_class_entry* ce, const char* mname, uint mname_len, zend_function* fe TSRMLS_DC) /* {{{ */ +{ + if (!strncmp(mname, ZEND_CLONE_FUNC_NAME, mname_len)) { + ce-clone = fe; fe-common.fn_flags |= ZEND_ACC_CLONE; + } else if (!strncmp(mname, ZEND_CONSTRUCTOR_FUNC_NAME, mname_len)) { if (ce-constructor) { zend_error(E_COMPILE_ERROR, %s has colliding constructor definitions coming from traits, ce-name); @@ -3817,8 +3820,8 @@ str_efree(lowercase_name); } } +/* }}} */ - static int zend_traits_merge_functions_to_class(zend_function *fn TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */ { zend_class_entry *ce = va_arg(args, zend_class_entry*); Modified: php/php-src/trunk/Zend/zend_compile.c === --- php/php-src/trunk/Zend/zend_compile.c 2011-11-02 21:05:36 UTC (rev 318705) +++ php/php-src/trunk/Zend/zend_compile.c 2011-11-02 21:12:13 UTC (rev 318706) @@ -3787,8 +3787,11 @@ } /* }}} */ -static void zend_add_magic_methods(zend_class_entry* ce, const char* mname, uint mname_len, zend_function* fe TSRMLS_DC) { - if ( !strncmp(mname, ZEND_CLONE_FUNC_NAME, mname_len)) { ce-clone = fe; fe-common.fn_flags |= ZEND_ACC_CLONE; } +static void zend_add_magic_methods(zend_class_entry* ce, const char* mname, uint mname_len, zend_function* fe TSRMLS_DC) /* {{{ */ +{ + if (!strncmp(mname, ZEND_CLONE_FUNC_NAME, mname_len)) { + ce-clone = fe; fe-common.fn_flags |= ZEND_ACC_CLONE; + } else if (!strncmp(mname, ZEND_CONSTRUCTOR_FUNC_NAME, mname_len)) { if (ce-constructor) { zend_error(E_COMPILE_ERROR, %s has colliding constructor definitions coming from traits, ce-name); @@ -3817,8 +3820,8 @@ str_efree(lowercase_name); } } +/* }}} */ - static int zend_traits_merge_functions_to_class(zend_function *fn TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */ { zend_class_entry *ce = va_arg(args, zend_class_entry*); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/Zend/zend_compile.c trunk/Zend/zend_compile.c
gron Sat, 08 Oct 2011 23:47:16 + Revision: http://svn.php.net/viewvc?view=revisionrevision=317930 Log: Use ZEND_ constants instead of plain strings for names of magic methods. # No functional changes. Changed paths: U php/php-src/branches/PHP_5_4/Zend/zend_compile.c U php/php-src/trunk/Zend/zend_compile.c Modified: php/php-src/branches/PHP_5_4/Zend/zend_compile.c === --- php/php-src/branches/PHP_5_4/Zend/zend_compile.c2011-10-08 23:42:36 UTC (rev 317929) +++ php/php-src/branches/PHP_5_4/Zend/zend_compile.c2011-10-08 23:47:16 UTC (rev 317930) @@ -3658,16 +3658,16 @@ strncmp(mname, str, mname_len) #define _ADD_MAGIC_METHOD(ce, mname, mname_len, fe) { \ - if (!IS_EQUAL(mname, mname_len, __clone)) { (ce)-clone = (fe); (fe)-common.fn_flags |= ZEND_ACC_CLONE; } \ - else if (!IS_EQUAL(mname, mname_len, __construct)) { (ce)-constructor = (fe); (fe)-common.fn_flags |= ZEND_ACC_CTOR; } \ - else if (!IS_EQUAL(mname, mname_len, __destruct)) { (ce)-destructor = (fe); (fe)-common.fn_flags |= ZEND_ACC_DTOR; } \ - else if (!IS_EQUAL(mname, mname_len, __get)) (ce)-__get = (fe); \ - else if (!IS_EQUAL(mname, mname_len, __set)) (ce)-__set = (fe); \ - else if (!IS_EQUAL(mname, mname_len, __call)) (ce)-__call = (fe); \ - else if (!IS_EQUAL(mname, mname_len, __unset)) (ce)-__unset = (fe); \ - else if (!IS_EQUAL(mname, mname_len, __isset)) (ce)-__isset = (fe); \ - else if (!IS_EQUAL(mname, mname_len, __callstatic))(ce)-__callstatic = (fe); \ - else if (!IS_EQUAL(mname, mname_len, __tostring)) (ce)-__tostring= (fe); \ + if ( !IS_EQUAL(mname, mname_len, ZEND_CLONE_FUNC_NAME)) { (ce)-clone = (fe); (fe)-common.fn_flags |= ZEND_ACC_CLONE; } \ + else if (!IS_EQUAL(mname, mname_len, ZEND_CONSTRUCTOR_FUNC_NAME)) { (ce)-constructor = (fe); (fe)-common.fn_flags |= ZEND_ACC_CTOR; } \ + else if (!IS_EQUAL(mname, mname_len, ZEND_DESTRUCTOR_FUNC_NAME)) { (ce)-destructor = (fe); (fe)-common.fn_flags |= ZEND_ACC_DTOR; } \ + else if (!IS_EQUAL(mname, mname_len, ZEND_GET_FUNC_NAME)) (ce)-__get = (fe); \ + else if (!IS_EQUAL(mname, mname_len, ZEND_SET_FUNC_NAME)) (ce)-__set = (fe); \ + else if (!IS_EQUAL(mname, mname_len, ZEND_CALL_FUNC_NAME)) (ce)-__call = (fe); \ + else if (!IS_EQUAL(mname, mname_len, ZEND_UNSET_FUNC_NAME)) (ce)-__unset= (fe); \ + else if (!IS_EQUAL(mname, mname_len, ZEND_ISSET_FUNC_NAME)) (ce)-__isset= (fe); \ + else if (!IS_EQUAL(mname, mname_len, ZEND_CALLSTATIC_FUNC_NAME)) (ce)-__callstatic = (fe); \ + else if (!IS_EQUAL(mname, mname_len, ZEND_TOSTRING_FUNC_NAME)) (ce)-__tostring = (fe); \ } /* {{{ Originates from php_runkit_function_copy_ctor Modified: php/php-src/trunk/Zend/zend_compile.c === --- php/php-src/trunk/Zend/zend_compile.c 2011-10-08 23:42:36 UTC (rev 317929) +++ php/php-src/trunk/Zend/zend_compile.c 2011-10-08 23:47:16 UTC (rev 317930) @@ -3658,16 +3658,16 @@ strncmp(mname, str, mname_len) #define _ADD_MAGIC_METHOD(ce, mname, mname_len, fe) { \ - if (!IS_EQUAL(mname, mname_len, __clone)) { (ce)-clone = (fe); (fe)-common.fn_flags |= ZEND_ACC_CLONE; } \ - else if (!IS_EQUAL(mname, mname_len, __construct)) { (ce)-constructor = (fe); (fe)-common.fn_flags |= ZEND_ACC_CTOR; } \ - else if (!IS_EQUAL(mname, mname_len, __destruct)) { (ce)-destructor = (fe); (fe)-common.fn_flags |= ZEND_ACC_DTOR; } \ - else if (!IS_EQUAL(mname, mname_len, __get)) (ce)-__get = (fe); \ - else if (!IS_EQUAL(mname, mname_len, __set)) (ce)-__set = (fe); \ - else if (!IS_EQUAL(mname, mname_len, __call)) (ce)-__call = (fe); \ - else if (!IS_EQUAL(mname, mname_len, __unset)) (ce)-__unset = (fe); \ - else if (!IS_EQUAL(mname, mname_len, __isset)) (ce)-__isset = (fe); \ - else if (!IS_EQUAL(mname, mname_len, __callstatic))(ce)-__callstatic = (fe); \ - else if (!IS_EQUAL(mname, mname_len, __tostring)) (ce)-__tostring= (fe); \ + if ( !IS_EQUAL(mname, mname_len, ZEND_CLONE_FUNC_NAME)) { (ce)-clone = (fe); (fe)-common.fn_flags |= ZEND_ACC_CLONE; } \ + else if (!IS_EQUAL(mname, mname_len, ZEND_CONSTRUCTOR_FUNC_NAME)) { (ce)-constructor = (fe); (fe)-common.fn_flags |= ZEND_ACC_CTOR; } \ + else if (!IS_EQUAL(mname,
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/Zend/zend_compile.c trunk/Zend/zend_compile.c
laruence Fri, 07 Oct 2011 04:14:31 + Revision: http://svn.php.net/viewvc?view=revisionrevision=317849 Log: Remove unecessary codes Changed paths: U php/php-src/branches/PHP_5_4/Zend/zend_compile.c U php/php-src/trunk/Zend/zend_compile.c Modified: php/php-src/branches/PHP_5_4/Zend/zend_compile.c === --- php/php-src/branches/PHP_5_4/Zend/zend_compile.c2011-10-07 04:07:02 UTC (rev 317848) +++ php/php-src/branches/PHP_5_4/Zend/zend_compile.c2011-10-07 04:14:31 UTC (rev 317849) @@ -3134,17 +3134,9 @@ *(offset++) = '\''; } else { zend_make_printable_zval(zv, zv_copy, use_copy); - if (Z_TYPE_P(zv) == IS_STRING) { - REALLOC_BUF_IF_EXCEED(buf, offset, length, MIN(Z_STRLEN_P(zv), Z_STRLEN_P(zv))); - memcpy(offset, Z_STRVAL_P(zv), Z_STRLEN_P(zv)); - offset += Z_STRLEN_P(zv); - } else if (Z_TYPE_P(zv) == IS_LONG) { - REALLOC_BUF_IF_EXCEED(buf, offset, length, 21); - offset += zend_sprintf(offset, %ld, Z_LVAL_P(zv)); - } else if (Z_TYPE_P(zv) == IS_DOUBLE) { - REALLOC_BUF_IF_EXCEED(buf, offset, length, 21); - offset += zend_sprintf(offset, %.*G, (int) EG(precision), Z_DVAL_P(zv)); - } + REALLOC_BUF_IF_EXCEED(buf, offset, length, Z_STRLEN(zv_copy)); + memcpy(offset, Z_STRVAL(zv_copy), Z_STRLEN(zv_copy)); + offset += Z_STRLEN(zv_copy); if (use_copy) { zval_dtor(zv_copy); } Modified: php/php-src/trunk/Zend/zend_compile.c === --- php/php-src/trunk/Zend/zend_compile.c 2011-10-07 04:07:02 UTC (rev 317848) +++ php/php-src/trunk/Zend/zend_compile.c 2011-10-07 04:14:31 UTC (rev 317849) @@ -3134,17 +3134,9 @@ *(offset++) = '\''; } else { zend_make_printable_zval(zv, zv_copy, use_copy); - if (Z_TYPE_P(zv) == IS_STRING) { - REALLOC_BUF_IF_EXCEED(buf, offset, length, MIN(Z_STRLEN_P(zv), Z_STRLEN_P(zv))); - memcpy(offset, Z_STRVAL_P(zv), Z_STRLEN_P(zv)); - offset += Z_STRLEN_P(zv); - } else if (Z_TYPE_P(zv) == IS_LONG) { - REALLOC_BUF_IF_EXCEED(buf, offset, length, 21); - offset += zend_sprintf(offset, %ld, Z_LVAL_P(zv)); - } else if (Z_TYPE_P(zv) == IS_DOUBLE) { - REALLOC_BUF_IF_EXCEED(buf, offset, length, 21); - offset += zend_sprintf(offset, %.*G, (int) EG(precision), Z_DVAL_P(zv)); - } + REALLOC_BUF_IF_EXCEED(buf, offset, length, Z_STRLEN(zv_copy)); + memcpy(offset, Z_STRVAL(zv_copy), Z_STRLEN(zv_copy)); + offset += Z_STRLEN(zv_copy); if (use_copy) { zval_dtor(zv_copy); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/Zend/zend_compile.c trunk/Zend/zend_compile.c
derick Tue, 13 Sep 2011 15:17:11 + Revision: http://svn.php.net/viewvc?view=revisionrevision=316654 Log: - Fixed compiler warnings (patch by Kalle Sommer Nielsen) Changed paths: U php/php-src/branches/PHP_5_4/Zend/zend_compile.c U php/php-src/trunk/Zend/zend_compile.c Modified: php/php-src/branches/PHP_5_4/Zend/zend_compile.c === --- php/php-src/branches/PHP_5_4/Zend/zend_compile.c2011-09-13 15:12:16 UTC (rev 316653) +++ php/php-src/branches/PHP_5_4/Zend/zend_compile.c2011-09-13 15:17:11 UTC (rev 316654) @@ -432,7 +432,7 @@ lc_literal = zend_add_literal(CG(active_op_array), c TSRMLS_CC); CALCULATE_LITERAL_HASH(lc_literal); - ns_separator = zend_memrchr(Z_STRVAL_P(zv), '\\', Z_STRLEN_P(zv)) + 1; + ns_separator = (const char*)zend_memrchr(Z_STRVAL_P(zv), '\\', Z_STRLEN_P(zv)) + 1; lc_len = Z_STRLEN_P(zv) - (ns_separator - Z_STRVAL_P(zv)); lc_name = zend_str_tolower_dup(ns_separator, lc_len); ZVAL_STRINGL(c, lc_name, lc_len, 0); Modified: php/php-src/trunk/Zend/zend_compile.c === --- php/php-src/trunk/Zend/zend_compile.c 2011-09-13 15:12:16 UTC (rev 316653) +++ php/php-src/trunk/Zend/zend_compile.c 2011-09-13 15:17:11 UTC (rev 316654) @@ -432,7 +432,7 @@ lc_literal = zend_add_literal(CG(active_op_array), c TSRMLS_CC); CALCULATE_LITERAL_HASH(lc_literal); - ns_separator = zend_memrchr(Z_STRVAL_P(zv), '\\', Z_STRLEN_P(zv)) + 1; + ns_separator = (const char*)zend_memrchr(Z_STRVAL_P(zv), '\\', Z_STRLEN_P(zv)) + 1; lc_len = Z_STRLEN_P(zv) - (ns_separator - Z_STRVAL_P(zv)); lc_name = zend_str_tolower_dup(ns_separator, lc_len); ZVAL_STRINGL(c, lc_name, lc_len, 0); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/Zend/zend_compile.c trunk/Zend/zend_compile.c
On Tue, 2011-08-16 at 12:37 -0700, Stas Malyshev wrote: Hi! On 8/16/11 6:19 AM, Johannes Schlüter wrote: It saves one character of typing. For me, it's the reason enough to prohibit it altogether :) Writing weird code to save one character of typing is the worst habit we could promote. But I digress since the idea of this patch was obviously not that. the feature itself is valid. Assume you have namespace Foo\Bar\Baz\Ba\Do with a few classes { class A {} class B {} ... class Z {} } then doing a use Foo\Bar\Baz\Ba\Do; from a different namespace makes sense, as you don't have to import all classes from the namespace, which gives a long list but still don't have to type the full name all the time, instead you can use new Do\A(); etc. That this works with a single (non nested) namespace name is imo consistent. Preventing this is an artificial restriction in the syntax. But the case here in this change is bit more specific (which i overlooked before). The new error message is only shown in cases where another error message was shown before (The use statement with non-compound name '%s' has no effect) where I consider the old error message good enough. I'd see the new one as an easter egg which I don't like. johannes Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/Zend/zend_compile.c trunk/Zend/zend_compile.c
bjoriTue, 16 Aug 2011 10:46:49 + Revision: http://svn.php.net/viewvc?view=revisionrevision=315002 Log: Improve errormessage on wrong use statements Changed paths: U php/php-src/branches/PHP_5_4/Zend/zend_compile.c U php/php-src/trunk/Zend/zend_compile.c Modified: php/php-src/branches/PHP_5_4/Zend/zend_compile.c === --- php/php-src/branches/PHP_5_4/Zend/zend_compile.c2011-08-16 10:44:47 UTC (rev 315001) +++ php/php-src/branches/PHP_5_4/Zend/zend_compile.c2011-08-16 10:46:49 UTC (rev 315002) @@ -6647,6 +6647,9 @@ zend_error(E_COMPILE_ERROR, Cannot use %s as %s because the name is already in use, Z_STRVAL_P(ns), Z_STRVAL_P(name)); } if (warn) { + if (!strcmp(Z_STRVAL_P(name), strict)) { + zend_error(E_COMPILE_ERROR, You seem to be trying to use a different language...); + } zend_error(E_WARNING, The use statement with non-compound name '%s' has no effect, Z_STRVAL_P(name)); } efree(lcname); Modified: php/php-src/trunk/Zend/zend_compile.c === --- php/php-src/trunk/Zend/zend_compile.c 2011-08-16 10:44:47 UTC (rev 315001) +++ php/php-src/trunk/Zend/zend_compile.c 2011-08-16 10:46:49 UTC (rev 315002) @@ -6647,6 +6647,9 @@ zend_error(E_COMPILE_ERROR, Cannot use %s as %s because the name is already in use, Z_STRVAL_P(ns), Z_STRVAL_P(name)); } if (warn) { + if (!strcmp(Z_STRVAL_P(name), strict)) { + zend_error(E_COMPILE_ERROR, You seem to be trying to use a different language...); + } zend_error(E_WARNING, The use statement with non-compound name '%s' has no effect, Z_STRVAL_P(name)); } efree(lcname); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/Zend/zend_compile.c trunk/Zend/zend_compile.c
Hi Hannes: On 16 Aug 2011, at 12:46, Hannes Magnusson wrote: + if (!strcmp(Z_STRVAL_P(name), strict)) { + zend_error(E_COMPILE_ERROR, You seem to be trying to use a different language...); + } Could we change that error to be a bit more explicit about what is not expected? Best regards Stefan -- Stefan Marr Software Languages Lab Vrije Universiteit Brussel Pleinlaan 2 / B-1050 Brussels / Belgium http://soft.vub.ac.be/~smarr Phone: +32 2 629 2974 Fax: +32 2 629 3525 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/Zend/zend_compile.c trunk/Zend/zend_compile.c
On Tue, Aug 16, 2011 at 13:05, Stefan Marr p...@stefan-marr.de wrote: Hi Hannes: On 16 Aug 2011, at 12:46, Hannes Magnusson wrote: + if (!strcmp(Z_STRVAL_P(name), strict)) { + zend_error(E_COMPILE_ERROR, You seem to be trying to use a different language...); + } Could we change that error to be a bit more explicit about what is not expected? I'm unsure what you are asking... Maybe http://perldoc.perl.org/strict.html explains the commit better then the intentionally ambiguous commit message? -Hannes -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/Zend/zend_compile.c trunk/Zend/zend_compile.c
On 16 Aug 2011, at 13:23, Hannes Magnusson wrote: On Tue, Aug 16, 2011 at 13:05, Stefan Marr p...@stefan-marr.de wrote: Hi Hannes: On 16 Aug 2011, at 12:46, Hannes Magnusson wrote: + if (!strcmp(Z_STRVAL_P(name), strict)) { + zend_error(E_COMPILE_ERROR, You seem to be trying to use a different language...); + } Could we change that error to be a bit more explicit about what is not expected? I'm unsure what you are asking... Sorry, I don't know anything about the context of that change, but I don't see how anyone but you knows what 'zend_error(E_COMPILE_ERROR, You seem to be trying to use a different language...);' means when it pops up in an error output. The goal of an error message should be to help to identify the cause for it, and even better to help to avoid it in the future, right? Best regards Stefan -- Stefan Marr Software Languages Lab Vrije Universiteit Brussel Pleinlaan 2 / B-1050 Brussels / Belgium http://soft.vub.ac.be/~smarr Phone: +32 2 629 2974 Fax: +32 2 629 3525 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/Zend/zend_compile.c trunk/Zend/zend_compile.c
On Tue, Aug 16, 2011 at 13:39, Stefan Marr p...@stefan-marr.de wrote: On 16 Aug 2011, at 13:23, Hannes Magnusson wrote: On Tue, Aug 16, 2011 at 13:05, Stefan Marr p...@stefan-marr.de wrote: Hi Hannes: On 16 Aug 2011, at 12:46, Hannes Magnusson wrote: + if (!strcmp(Z_STRVAL_P(name), strict)) { + zend_error(E_COMPILE_ERROR, You seem to be trying to use a different language...); + } Could we change that error to be a bit more explicit about what is not expected? I'm unsure what you are asking... Sorry, I don't know anything about the context of that change, but I don't see how anyone but you knows what 'zend_error(E_COMPILE_ERROR, You seem to be trying to use a different language...);' means when it pops up in an error output. The goal of an error message should be to help to identify the cause for it, and even better to help to avoid it in the future, right? use foobar; has no effect, at all, and you will get an warning message telling you that. If you however mix Perl with PHP and attempt to do use strict; you'll get a nice little errormessage easter egg alerting you of your mistakes. -Hannes -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/Zend/zend_compile.c trunk/Zend/zend_compile.c
On Tue, 2011-08-16 at 13:44 +0200, Hannes Magnusson wrote: use foobar; has no effect, at all, and you will get an warning message telling you that. It has an effect. In namespace strict { class C {} } namespace foo { use strict; new strict\C; } It saves one character of typing. Without the use strict I'd have to write \strict\C. If this is useful might be questioned but it is valid. If you however mix Perl with PHP and attempt to do use strict; you'll get a nice little errormessage easter egg alerting you of your mistakes. The message should at least be nicer. I'd remove it, though. johannes -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/Zend/zend_compile.c trunk/Zend/zend_compile.c
2011/8/16 Johannes Schlüter johan...@schlueters.de: On Tue, 2011-08-16 at 13:44 +0200, Hannes Magnusson wrote: use foobar; has no effect, at all, and you will get an warning message telling you that. It has an effect. In namespace strict { class C {} } namespace foo { use strict; new strict\C; } It saves one character of typing. Without the use strict I'd have to write \strict\C. If this is useful might be questioned but it is valid. And this code snippet will continue to work just fine, as it didn't trigger a warning before. When the use statement has no effect you get a warning The use statement with non-compound name '%s' has no effect, except now - we check if you have perl syndrome and let you know, forcefully. -Hannes -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/Zend/zend_compile.c trunk/Zend/zend_compile.c
Hi! On 8/16/11 6:19 AM, Johannes Schlüter wrote: It saves one character of typing. For me, it's the reason enough to prohibit it altogether :) Writing weird code to save one character of typing is the worst habit we could promote. But I digress since the idea of this patch was obviously not that. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/Zend/zend_compile.c trunk/Zend/zend_compile.c
gron Mon, 15 Aug 2011 08:29:48 + Revision: http://svn.php.net/viewvc?view=revisionrevision=314921 Log: Addendum for patch to bug #55214: Class name was freed before method literal referring to it. # Thanks to Felipe for catching this. # The fix duplicates the name into the literal to avoid the dependency Bug: https://bugs.php.net/55214 (To be documented) use of __CLASS__ within trait returns trait name not class name Changed paths: U php/php-src/branches/PHP_5_4/Zend/zend_compile.c U php/php-src/trunk/Zend/zend_compile.c Modified: php/php-src/branches/PHP_5_4/Zend/zend_compile.c === --- php/php-src/branches/PHP_5_4/Zend/zend_compile.c2011-08-15 07:38:54 UTC (rev 314920) +++ php/php-src/branches/PHP_5_4/Zend/zend_compile.c2011-08-15 08:29:48 UTC (rev 314921) @@ -3544,7 +3544,7 @@ /* Only on merge into an actual class */ (ZEND_ACC_TRAIT != (target_ce-ce_flags ZEND_ACC_TRAIT))) { INIT_ZVAL(class_name_zv); - ZVAL_STRINGL(class_name_zv, target_ce-name, target_ce-name_length, 0); + ZVAL_STRINGL(class_name_zv, target_ce-name, target_ce-name_length, 1); class_name_literal = zend_add_literal(fe-op_array, class_name_zv TSRMLS_CC); opcode_copy[i].op1.zv = fe-op_array.literals[class_name_literal].constant; } @@ -3564,7 +3564,7 @@ /* Only on merge into an actual class */ (ZEND_ACC_TRAIT != (target_ce-ce_flags ZEND_ACC_TRAIT))) { INIT_ZVAL(class_name_zv); - ZVAL_STRINGL(class_name_zv, target_ce-name, target_ce-name_length, 0); + ZVAL_STRINGL(class_name_zv, target_ce-name, target_ce-name_length, 1); class_name_literal = zend_add_literal(fe-op_array, class_name_zv TSRMLS_CC); opcode_copy[i].op2.zv = fe-op_array.literals[class_name_literal].constant; } Modified: php/php-src/trunk/Zend/zend_compile.c === --- php/php-src/trunk/Zend/zend_compile.c 2011-08-15 07:38:54 UTC (rev 314920) +++ php/php-src/trunk/Zend/zend_compile.c 2011-08-15 08:29:48 UTC (rev 314921) @@ -3544,7 +3544,7 @@ /* Only on merge into an actual class */ (ZEND_ACC_TRAIT != (target_ce-ce_flags ZEND_ACC_TRAIT))) { INIT_ZVAL(class_name_zv); - ZVAL_STRINGL(class_name_zv, target_ce-name, target_ce-name_length, 0); + ZVAL_STRINGL(class_name_zv, target_ce-name, target_ce-name_length, 1); class_name_literal = zend_add_literal(fe-op_array, class_name_zv TSRMLS_CC); opcode_copy[i].op1.zv = fe-op_array.literals[class_name_literal].constant; } @@ -3564,7 +3564,7 @@ /* Only on merge into an actual class */ (ZEND_ACC_TRAIT != (target_ce-ce_flags ZEND_ACC_TRAIT))) { INIT_ZVAL(class_name_zv); - ZVAL_STRINGL(class_name_zv, target_ce-name, target_ce-name_length, 0); + ZVAL_STRINGL(class_name_zv, target_ce-name, target_ce-name_length, 1); class_name_literal = zend_add_literal(fe-op_array, class_name_zv TSRMLS_CC); opcode_copy[i].op2.zv = fe-op_array.literals[class_name_literal].constant; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/Zend/zend_compile.c trunk/Zend/zend_compile.c
felipe Sun, 31 Jul 2011 12:27:47 + Revision: http://svn.php.net/viewvc?view=revisionrevision=313991 Log: - Fixed bug #55326 (Trait method copying misindentifies serialization callbacks) patch by: Gustavo Lopes (cataphract@php) Bug: https://bugs.php.net/55326 (Open) Trait method copying misindentifies serialization callbacks Changed paths: U php/php-src/branches/PHP_5_4/Zend/zend_compile.c U php/php-src/trunk/Zend/zend_compile.c Modified: php/php-src/branches/PHP_5_4/Zend/zend_compile.c === --- php/php-src/branches/PHP_5_4/Zend/zend_compile.c2011-07-31 10:11:20 UTC (rev 313990) +++ php/php-src/branches/PHP_5_4/Zend/zend_compile.c2011-07-31 12:27:47 UTC (rev 313991) @@ -3476,8 +3476,6 @@ else if (!IS_EQUAL(mname, mname_len, __isset)) (ce)-__isset = (fe); \ else if (!IS_EQUAL(mname, mname_len, __callstatic))(ce)-__callstatic = (fe); \ else if (!IS_EQUAL(mname, mname_len, __tostring)) (ce)-__tostring= (fe); \ - else if (!IS_EQUAL(mname, mname_len, serialize_func)) (ce)-serialize_func= (fe); \ - else if (!IS_EQUAL(mname, mname_len, unserialize_func))(ce)-unserialize_func = (fe); \ } /* {{{ Originates from php_runkit_function_copy_ctor Modified: php/php-src/trunk/Zend/zend_compile.c === --- php/php-src/trunk/Zend/zend_compile.c 2011-07-31 10:11:20 UTC (rev 313990) +++ php/php-src/trunk/Zend/zend_compile.c 2011-07-31 12:27:47 UTC (rev 313991) @@ -3476,8 +3476,6 @@ else if (!IS_EQUAL(mname, mname_len, __isset)) (ce)-__isset = (fe); \ else if (!IS_EQUAL(mname, mname_len, __callstatic))(ce)-__callstatic = (fe); \ else if (!IS_EQUAL(mname, mname_len, __tostring)) (ce)-__tostring= (fe); \ - else if (!IS_EQUAL(mname, mname_len, serialize_func)) (ce)-serialize_func= (fe); \ - else if (!IS_EQUAL(mname, mname_len, unserialize_func))(ce)-unserialize_func = (fe); \ } /* {{{ Originates from php_runkit_function_copy_ctor -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/Zend/zend_compile.c trunk/Zend/zend_compile.c
gron Sat, 23 Jul 2011 18:12:31 + Revision: http://svn.php.net/viewvc?view=revisionrevision=313638 Log: Fixed incorrect initialization when copied op_array.vars was NULL (TRAITS) Changed paths: U php/php-src/branches/PHP_5_4/Zend/zend_compile.c U php/php-src/trunk/Zend/zend_compile.c Modified: php/php-src/branches/PHP_5_4/Zend/zend_compile.c === --- php/php-src/branches/PHP_5_4/Zend/zend_compile.c2011-07-23 17:12:42 UTC (rev 313637) +++ php/php-src/branches/PHP_5_4/Zend/zend_compile.c2011-07-23 18:12:31 UTC (rev 313638) @@ -3502,15 +3502,20 @@ fe-op_array.refcount = emalloc(sizeof(zend_uint)); *(fe-op_array.refcount) = 1; - i = fe-op_array.last_var; - dupvars = safe_emalloc(fe-op_array.last_var, sizeof(zend_compiled_variable), 0); - while (i 0) { - i--; - dupvars[i].name = estrndup(fe-op_array.vars[i].name, fe-op_array.vars[i].name_len); - dupvars[i].name_len = fe-op_array.vars[i].name_len; - dupvars[i].hash_value = fe-op_array.vars[i].hash_value; - } - fe-op_array.vars = dupvars; + if (fe-op_array.vars) { +i = fe-op_array.last_var; +dupvars = safe_emalloc(fe-op_array.last_var, sizeof(zend_compiled_variable), 0); +while (i 0) { + i--; + dupvars[i].name = estrndup(fe-op_array.vars[i].name, fe-op_array.vars[i].name_len); + dupvars[i].name_len = fe-op_array.vars[i].name_len; + dupvars[i].hash_value = fe-op_array.vars[i].hash_value; +} +fe-op_array.vars = dupvars; + } + else { +fe-op_array.vars = NULL; + } opcode_copy = safe_emalloc(sizeof(zend_op), fe-op_array.last, 0); for(i = 0; i fe-op_array.last; i++) { Modified: php/php-src/trunk/Zend/zend_compile.c === --- php/php-src/trunk/Zend/zend_compile.c 2011-07-23 17:12:42 UTC (rev 313637) +++ php/php-src/trunk/Zend/zend_compile.c 2011-07-23 18:12:31 UTC (rev 313638) @@ -3502,15 +3502,20 @@ fe-op_array.refcount = emalloc(sizeof(zend_uint)); *(fe-op_array.refcount) = 1; - i = fe-op_array.last_var; - dupvars = safe_emalloc(fe-op_array.last_var, sizeof(zend_compiled_variable), 0); - while (i 0) { - i--; - dupvars[i].name = estrndup(fe-op_array.vars[i].name, fe-op_array.vars[i].name_len); - dupvars[i].name_len = fe-op_array.vars[i].name_len; - dupvars[i].hash_value = fe-op_array.vars[i].hash_value; - } - fe-op_array.vars = dupvars; + if (fe-op_array.vars) { +i = fe-op_array.last_var; +dupvars = safe_emalloc(fe-op_array.last_var, sizeof(zend_compiled_variable), 0); +while (i 0) { + i--; + dupvars[i].name = estrndup(fe-op_array.vars[i].name, fe-op_array.vars[i].name_len); + dupvars[i].name_len = fe-op_array.vars[i].name_len; + dupvars[i].hash_value = fe-op_array.vars[i].hash_value; +} +fe-op_array.vars = dupvars; + } + else { +fe-op_array.vars = NULL; + } opcode_copy = safe_emalloc(sizeof(zend_op), fe-op_array.last, 0); for(i = 0; i fe-op_array.last; i++) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/Zend/zend_compile.c trunk/Zend/zend_compile.c
dmitry Mon, 11 Jul 2011 07:10:30 + Revision: http://svn.php.net/viewvc?view=revisionrevision=313125 Log: Fixed bug #55150 (php -a segfaults) Bug: https://bugs.php.net/55150 (Assigned) php -a segfaults Changed paths: U php/php-src/branches/PHP_5_4/Zend/zend_compile.c U php/php-src/trunk/Zend/zend_compile.c Modified: php/php-src/branches/PHP_5_4/Zend/zend_compile.c === --- php/php-src/branches/PHP_5_4/Zend/zend_compile.c2011-07-11 06:32:41 UTC (rev 313124) +++ php/php-src/branches/PHP_5_4/Zend/zend_compile.c2011-07-11 07:10:30 UTC (rev 313125) @@ -70,6 +70,10 @@ #define GET_CACHE_SLOT(literal) do { \ CG(active_op_array)-literals[literal].cache_slot = CG(active_op_array)-last_cache_slot++; \ + if ((CG(active_op_array)-fn_flags ZEND_ACC_INTERACTIVE) CG(active_op_array)-run_time_cache) { \ + CG(active_op_array)-run_time_cache = erealloc(CG(active_op_array)-run_time_cache, CG(active_op_array)-last_cache_slot * sizeof(void*)); \ + CG(active_op_array)-run_time_cache[CG(active_op_array)-last_cache_slot - 1] = NULL; \ + } \ } while (0) #define POLYMORPHIC_CACHE_SLOT_SIZE 2 @@ -77,6 +81,11 @@ #define GET_POLYMORPHIC_CACHE_SLOT(literal) do { \ CG(active_op_array)-literals[literal].cache_slot = CG(active_op_array)-last_cache_slot; \ CG(active_op_array)-last_cache_slot += POLYMORPHIC_CACHE_SLOT_SIZE; \ + if ((CG(active_op_array)-fn_flags ZEND_ACC_INTERACTIVE) CG(active_op_array)-run_time_cache) { \ + CG(active_op_array)-run_time_cache = erealloc(CG(active_op_array)-run_time_cache, CG(active_op_array)-last_cache_slot * sizeof(void*)); \ + CG(active_op_array)-run_time_cache[CG(active_op_array)-last_cache_slot - 1] = NULL; \ + CG(active_op_array)-run_time_cache[CG(active_op_array)-last_cache_slot - 2] = NULL; \ + } \ } while (0) #define FREE_POLYMORPHIC_CACHE_SLOT(literal) do { \ Modified: php/php-src/trunk/Zend/zend_compile.c === --- php/php-src/trunk/Zend/zend_compile.c 2011-07-11 06:32:41 UTC (rev 313124) +++ php/php-src/trunk/Zend/zend_compile.c 2011-07-11 07:10:30 UTC (rev 313125) @@ -70,6 +70,10 @@ #define GET_CACHE_SLOT(literal) do { \ CG(active_op_array)-literals[literal].cache_slot = CG(active_op_array)-last_cache_slot++; \ + if ((CG(active_op_array)-fn_flags ZEND_ACC_INTERACTIVE) CG(active_op_array)-run_time_cache) { \ + CG(active_op_array)-run_time_cache = erealloc(CG(active_op_array)-run_time_cache, CG(active_op_array)-last_cache_slot * sizeof(void*)); \ + CG(active_op_array)-run_time_cache[CG(active_op_array)-last_cache_slot - 1] = NULL; \ + } \ } while (0) #define POLYMORPHIC_CACHE_SLOT_SIZE 2 @@ -77,6 +81,11 @@ #define GET_POLYMORPHIC_CACHE_SLOT(literal) do { \ CG(active_op_array)-literals[literal].cache_slot = CG(active_op_array)-last_cache_slot; \ CG(active_op_array)-last_cache_slot += POLYMORPHIC_CACHE_SLOT_SIZE; \ + if ((CG(active_op_array)-fn_flags ZEND_ACC_INTERACTIVE) CG(active_op_array)-run_time_cache) { \ + CG(active_op_array)-run_time_cache = erealloc(CG(active_op_array)-run_time_cache, CG(active_op_array)-last_cache_slot * sizeof(void*)); \ + CG(active_op_array)-run_time_cache[CG(active_op_array)-last_cache_slot - 1] = NULL; \ + CG(active_op_array)-run_time_cache[CG(active_op_array)-last_cache_slot - 2] = NULL; \ + } \ } while (0) #define FREE_POLYMORPHIC_CACHE_SLOT(literal) do { \ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/Zend/zend_compile.c trunk/Zend/zend_compile.c
felipe Fri, 08 Jul 2011 19:52:21 + Revision: http://svn.php.net/viewvc?view=revisionrevision=313078 Log: - CS and WS Changed paths: U php/php-src/branches/PHP_5_4/Zend/zend_compile.c U php/php-src/trunk/Zend/zend_compile.c Modified: php/php-src/branches/PHP_5_4/Zend/zend_compile.c === --- php/php-src/branches/PHP_5_4/Zend/zend_compile.c 2011-07-08 19:27:54 UTC (rev 313077) +++ php/php-src/branches/PHP_5_4/Zend/zend_compile.c 2011-07-08 19:52:21 UTC (rev 313078) @@ -3524,8 +3524,7 @@ fe-op_array.function_name = newname; /* was setting it to fe which does not work since fe is stack allocated and not a stable address */ - /* fe-op_array.prototype = fe-op_array.prototype; */ - + /* fe-op_array.prototype = fe-op_array.prototype; */ if (fe-op_array.arg_info) { zend_arg_info *tmpArginfo; @@ -3557,13 +3556,13 @@ } /* */ -static int zend_traits_merge_functions_to_class(zend_function *fn TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) +static int zend_traits_merge_functions_to_class(zend_function *fn TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */ { zend_class_entry *ce = va_arg(args, zend_class_entry*); int add = 0; zend_function* existing_fn; zend_function fn_copy, *fn_copy_p; - zend_function* prototype = NULL; /* is used to determine the prototype according to the inheritance chain */ + zend_function* prototype = NULL; /* is used to determine the prototype according to the inheritance chain */ if (zend_hash_quick_find(ce-function_table, hash_key-arKey, hash_key-nKeyLength, hash_key-h, (void**) existing_fn) == FAILURE) { add = 1; /* not found */ @@ -3623,8 +3622,9 @@ return ZEND_HASH_APPLY_REMOVE; } +/* }}} */ -static int zend_traits_copy_functions(zend_function *fn TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) +static int zend_traits_copy_functions(zend_function *fn TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) /* {{{ */ { HashTable* target; zend_trait_alias** aliases; @@ -3645,18 +3645,15 @@ /* apply aliases which are qualified with a class name, there should not be any ambiguity */ if (aliases) { while (aliases[i]) { - - if (/* Scope unset or equal to the function we compare to */ - (!aliases[i]-trait_method-ce || fn-common.scope == aliases[i]-trait_method-ce) - /* and, the alias applies to fn */ - (zend_binary_strcasecmp(aliases[i]-trait_method-method_name, - aliases[i]-trait_method-mname_len, - fn-common.function_name, fnname_len) == 0)) { + /* Scope unset or equal to the function we compare to, and the alias applies to fn */ + if ((!aliases[i]-trait_method-ce || fn-common.scope == aliases[i]-trait_method-ce) + (zend_binary_strcasecmp(aliases[i]-trait_method-method_name, aliases[i]-trait_method-mname_len, fn-common.function_name, fnname_len) == 0)) { if (aliases[i]-alias) { fn_copy = *fn; zend_traits_duplicate_function(fn_copy, estrndup(aliases[i]-alias, aliases[i]-alias_len) TSRMLS_CC); - - if (aliases[i]-modifiers) { /* if it is 0, no modifieres has been changed */ + + /* if it is 0, no modifieres has been changed */ + if (aliases[i]-modifiers) { fn_copy.common.fn_flags = aliases[i]-modifiers; if (!(aliases[i]-modifiers ZEND_ACC_PPP_MASK)) { fn_copy.common.fn_flags |= ZEND_ACC_PUBLIC; @@ -3686,17 +3683,15 @@ zend_traits_duplicate_function(fn_copy, estrndup(fn-common.function_name, fnname_len) TSRMLS_CC); /* apply aliases which are not qualified by a class name, or which have not - alias name, just setting visibility */ + * alias name, just setting visibility */ if (aliases) { i = 0; while (aliases[i]) { -if (/* Scope unset or equal to the function we compare to */ -(!aliases[i]-trait_method-ce || fn-common.scope == aliases[i]-trait_method-ce) - /* and, the alias applies to fn */ - (zend_binary_strcasecmp(aliases[i]-trait_method-method_name, -aliases[i]-trait_method-mname_len, - fn-common.function_name, fnname_len) == 0)) { - if (!aliases[i]-alias aliases[i]-modifiers) { /* if it is 0, no modifieres has been changed */ +/* Scope unset or equal to the function we compare to, and the alias applies to fn */ +if ((!aliases[i]-trait_method-ce || fn-common.scope == aliases[i]-trait_method-ce) + (zend_binary_strcasecmp(aliases[i]-trait_method-method_name, aliases[i]-trait_method-mname_len, fn-common.function_name, fnname_len) == 0)) { + /* if it is 0, no modifieres has been changed */ + if (!aliases[i]-alias aliases[i]-modifiers) { fn_copy.common.fn_flags = aliases[i]-modifiers; if (!(aliases[i]-modifiers ZEND_ACC_PPP_MASK)) { fn_copy.common.fn_flags |= ZEND_ACC_PUBLIC; @@ -3717,14
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/Zend/zend_compile.c trunk/Zend/zend_compile.c
felipe Sun, 19 Jun 2011 20:16:08 + Revision: http://svn.php.net/viewvc?view=revisionrevision=312303 Log: - Removed unnecessary TSRMLS_FETCH Changed paths: U php/php-src/branches/PHP_5_4/Zend/zend_compile.c U php/php-src/trunk/Zend/zend_compile.c Modified: php/php-src/branches/PHP_5_4/Zend/zend_compile.c === --- php/php-src/branches/PHP_5_4/Zend/zend_compile.c2011-06-19 20:15:33 UTC (rev 312302) +++ php/php-src/branches/PHP_5_4/Zend/zend_compile.c2011-06-19 20:16:08 UTC (rev 312303) @@ -340,7 +340,6 @@ } if (Z_TYPE_P(zv) == IS_STRING || Z_TYPE_P(zv) == IS_CONSTANT) { zval *z = (zval*)zv; - TSRMLS_FETCH(); Z_STRVAL_P(z) = zend_new_interned_string(Z_STRVAL_P(zv), Z_STRLEN_P(zv) + 1, 1 TSRMLS_CC); Modified: php/php-src/trunk/Zend/zend_compile.c === --- php/php-src/trunk/Zend/zend_compile.c 2011-06-19 20:15:33 UTC (rev 312302) +++ php/php-src/trunk/Zend/zend_compile.c 2011-06-19 20:16:08 UTC (rev 312303) @@ -340,7 +340,6 @@ } if (Z_TYPE_P(zv) == IS_STRING || Z_TYPE_P(zv) == IS_CONSTANT) { zval *z = (zval*)zv; - TSRMLS_FETCH(); Z_STRVAL_P(z) = zend_new_interned_string(Z_STRVAL_P(zv), Z_STRLEN_P(zv) + 1, 1 TSRMLS_CC); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/Zend/zend_compile.c trunk/Zend/zend_compile.c
felipe Mon, 20 Jun 2011 01:21:47 + Revision: http://svn.php.net/viewvc?view=revisionrevision=312320 Log: - Avoid re-hash here too Changed paths: U php/php-src/branches/PHP_5_4/Zend/zend_compile.c U php/php-src/trunk/Zend/zend_compile.c Modified: php/php-src/branches/PHP_5_4/Zend/zend_compile.c === --- php/php-src/branches/PHP_5_4/Zend/zend_compile.c2011-06-20 00:03:39 UTC (rev 312319) +++ php/php-src/branches/PHP_5_4/Zend/zend_compile.c2011-06-20 01:21:47 UTC (rev 312320) @@ -633,8 +633,12 @@ zend_llist *fetch_list_ptr; if (varname-op_type == IS_CONST) { + ulong hash = 0; + if (Z_TYPE(varname-u.constant) != IS_STRING) { convert_to_string(varname-u.constant); + } else if (IS_INTERNED(Z_STRVAL(varname-u.constant))) { + hash = INTERNED_HASH(Z_STRVAL(varname-u.constant)); } if (!zend_is_auto_global(varname-u.constant.value.str.val, varname-u.constant.value.str.len TSRMLS_CC) !(varname-u.constant.value.str.len == (sizeof(this)-1) @@ -642,7 +646,7 @@ (CG(active_op_array)-last == 0 || CG(active_op_array)-opcodes[CG(active_op_array)-last-1].opcode != ZEND_BEGIN_SILENCE)) { result-op_type = IS_CV; - result-u.op.var = lookup_cv(CG(active_op_array), varname-u.constant.value.str.val, varname-u.constant.value.str.len, 0 TSRMLS_CC); + result-u.op.var = lookup_cv(CG(active_op_array), varname-u.constant.value.str.val, varname-u.constant.value.str.len, hash TSRMLS_CC); varname-u.constant.value.str.val = CG(active_op_array)-vars[result-u.op.var].name; result-EA = 0; return; Modified: php/php-src/trunk/Zend/zend_compile.c === --- php/php-src/trunk/Zend/zend_compile.c 2011-06-20 00:03:39 UTC (rev 312319) +++ php/php-src/trunk/Zend/zend_compile.c 2011-06-20 01:21:47 UTC (rev 312320) @@ -633,8 +633,12 @@ zend_llist *fetch_list_ptr; if (varname-op_type == IS_CONST) { + ulong hash = 0; + if (Z_TYPE(varname-u.constant) != IS_STRING) { convert_to_string(varname-u.constant); + } else if (IS_INTERNED(Z_STRVAL(varname-u.constant))) { + hash = INTERNED_HASH(Z_STRVAL(varname-u.constant)); } if (!zend_is_auto_global(varname-u.constant.value.str.val, varname-u.constant.value.str.len TSRMLS_CC) !(varname-u.constant.value.str.len == (sizeof(this)-1) @@ -642,7 +646,7 @@ (CG(active_op_array)-last == 0 || CG(active_op_array)-opcodes[CG(active_op_array)-last-1].opcode != ZEND_BEGIN_SILENCE)) { result-op_type = IS_CV; - result-u.op.var = lookup_cv(CG(active_op_array), varname-u.constant.value.str.val, varname-u.constant.value.str.len, 0 TSRMLS_CC); + result-u.op.var = lookup_cv(CG(active_op_array), varname-u.constant.value.str.val, varname-u.constant.value.str.len, hash TSRMLS_CC); varname-u.constant.value.str.val = CG(active_op_array)-vars[result-u.op.var].name; result-EA = 0; return; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/Zend/zend_compile.c trunk/Zend/zend_compile.c
felipe Mon, 20 Jun 2011 01:36:23 + Revision: http://svn.php.net/viewvc?view=revisionrevision=312321 Log: - Simplify function code Changed paths: U php/php-src/branches/PHP_5_4/Zend/zend_compile.c U php/php-src/trunk/Zend/zend_compile.c Modified: php/php-src/branches/PHP_5_4/Zend/zend_compile.c === --- php/php-src/branches/PHP_5_4/Zend/zend_compile.c2011-06-20 01:21:47 UTC (rev 312320) +++ php/php-src/branches/PHP_5_4/Zend/zend_compile.c2011-06-20 01:36:23 UTC (rev 312321) @@ -3769,27 +3769,28 @@ /* }}} */ static void zend_traits_compile_exclude_table(HashTable* exclude_table, zend_trait_precedence **precedences, zend_class_entry *trait) { - size_t i, j; - if (precedences) { - i = 0; - while (precedences[i]) { - if (precedences[i]-exclude_from_classes) { - j = 0; - while (precedences[i]-exclude_from_classes[j]) { - if (precedences[i]-exclude_from_classes[j] == trait) { - zend_uint lcname_len = precedences[i]-trait_method-mname_len; - char* lcname = zend_str_tolower_dup(precedences[i]-trait_method-method_name, - lcname_len); - if (zend_hash_add(exclude_table, lcname, lcname_len, NULL, 0, NULL)==FAILURE) { - zend_error(E_COMPILE_ERROR, Failed to evaluate a trait precedence (%s). Method of trait %s was defined to be excluded multiple times, precedences[i]-trait_method-method_name, trait-name); - } + size_t i = 0, j; + + if (!precedences) { + return; + } + while (precedences[i]) { + if (precedences[i]-exclude_from_classes) { + j = 0; + while (precedences[i]-exclude_from_classes[j]) { + if (precedences[i]-exclude_from_classes[j] == trait) { + zend_uint lcname_len = precedences[i]-trait_method-mname_len; + char *lcname = zend_str_tolower_dup(precedences[i]-trait_method-method_name, lcname_len); + if (zend_hash_add(exclude_table, lcname, lcname_len, NULL, 0, NULL) == FAILURE) { efree(lcname); + zend_error(E_COMPILE_ERROR, Failed to evaluate a trait precedence (%s). Method of trait %s was defined to be excluded multiple times, precedences[i]-trait_method-method_name, trait-name); } - j++; + efree(lcname); } + ++j; } - i++; } + ++i; } } Modified: php/php-src/trunk/Zend/zend_compile.c === --- php/php-src/trunk/Zend/zend_compile.c 2011-06-20 01:21:47 UTC (rev 312320) +++ php/php-src/trunk/Zend/zend_compile.c 2011-06-20 01:36:23 UTC (rev 312321) @@ -3769,27 +3769,28 @@ /* }}} */ static void zend_traits_compile_exclude_table(HashTable* exclude_table, zend_trait_precedence **precedences, zend_class_entry *trait) { - size_t i, j; - if (precedences) { - i = 0; - while (precedences[i]) { - if (precedences[i]-exclude_from_classes) { - j = 0; - while (precedences[i]-exclude_from_classes[j]) { - if (precedences[i]-exclude_from_classes[j] == trait) { - zend_uint lcname_len = precedences[i]-trait_method-mname_len; - char* lcname = zend_str_tolower_dup(precedences[i]-trait_method-method_name, - lcname_len); - if (zend_hash_add(exclude_table, lcname, lcname_len, NULL, 0, NULL)==FAILURE) { - zend_error(E_COMPILE_ERROR, Failed to evaluate a trait precedence (%s). Method of trait %s was defined to be
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/Zend/zend_compile.c trunk/Zend/zend_compile.c
felipe Mon, 20 Jun 2011 02:04:13 + Revision: http://svn.php.net/viewvc?view=revisionrevision=312322 Log: - Optimize property finding by zend_hash_quick_find Changed paths: U php/php-src/branches/PHP_5_4/Zend/zend_compile.c U php/php-src/trunk/Zend/zend_compile.c Modified: php/php-src/branches/PHP_5_4/Zend/zend_compile.c === --- php/php-src/branches/PHP_5_4/Zend/zend_compile.c 2011-06-20 01:36:23 UTC (rev 312321) +++ php/php-src/branches/PHP_5_4/Zend/zend_compile.c 2011-06-20 02:04:13 UTC (rev 312322) @@ -3851,12 +3851,12 @@ free(resulting_table); } -static zend_class_entry* find_first_definition(zend_class_entry *ce, size_t current_trait, char* prop_name, int prop_name_length, zend_class_entry *coliding_ce) /* {{{ */ +static zend_class_entry* find_first_definition(zend_class_entry *ce, size_t current_trait, char* prop_name, int prop_name_length, ulong prop_hash, zend_class_entry *coliding_ce) /* {{{ */ { size_t i; zend_property_info *coliding_prop; for (i = 0; (i current_trait) (i ce-num_traits); i++) { - if (zend_hash_find(ce-traits[i]-properties_info, prop_name, prop_name_length+1, (void **) coliding_prop) == SUCCESS) { + if (zend_hash_quick_find(ce-traits[i]-properties_info, prop_name, prop_name_length+1, prop_hash, (void **) coliding_prop) == SUCCESS) { return ce-traits[i]; } } @@ -3872,6 +3872,7 @@ zval compare_result; char* prop_name; int prop_name_length; + ulong prop_hash; char* class_name_unused; zend_bool prop_found; zend_bool not_compatible; @@ -3894,6 +3895,7 @@ /* first get the unmangeld name if necessary, then check whether the property is already there */ if ((property_info-flags ZEND_ACC_PPP_MASK) == ZEND_ACC_PUBLIC) { +prop_hash = property_info-h; prop_name = property_info-name; prop_name_length = property_info-name_length; prop_found = zend_hash_quick_find(ce-properties_info, @@ -3904,14 +3906,15 @@ zend_unmangle_property_name(property_info-name, property_info-name_length, class_name_unused, prop_name); prop_name_length = strlen(prop_name); -prop_found = zend_hash_find(ce-properties_info, prop_name, prop_name_length+1, (void **) coliding_prop) == SUCCESS; +prop_hash = zend_get_hash_value(prop_name, prop_name_length + 1); +prop_found = zend_hash_quick_find(ce-properties_info, prop_name, prop_name_length+1, prop_hash, (void **) coliding_prop) == SUCCESS; } /* next: check for conflicts with current class */ if (prop_found) { if (coliding_prop-flags ZEND_ACC_SHADOW) { /* this one is inherited, lets look it up in its own class */ - zend_hash_find(coliding_prop-ce-properties_info, prop_name, prop_name_length+1, (void **) coliding_prop); + zend_hash_quick_find(coliding_prop-ce-properties_info, prop_name, prop_name_length+1, prop_hash, (void **) coliding_prop); } if ((coliding_prop-flags ZEND_ACC_PPP_MASK) == (property_info-flags ZEND_ACC_PPP_MASK)) { /* flags are identical, now the value needs to be checked */ @@ -3921,8 +3924,8 @@ ce-traits[i]-default_static_members_table[property_info-offset] TSRMLS_CC) == FAILURE; } else { not_compatible = compare_function(compare_result, - ce-default_properties_table[coliding_prop-offset], - ce-traits[i]-default_properties_table[property_info-offset] TSRMLS_CC) == FAILURE; + ce-default_properties_table[coliding_prop-offset], + ce-traits[i]-default_properties_table[property_info-offset] TSRMLS_CC) == FAILURE; } } else { /* the flags are not identical, thus, we assume properties are not compatible */ @@ -3932,14 +3935,14 @@ if (not_compatible) { zend_error(E_COMPILE_ERROR, %s and %s define the same property ($%s) in the composition of %s. However, the definition differs and is considered incompatible. Class was composed, -find_first_definition(ce, i, prop_name, prop_name_length, coliding_prop-ce)-name, +find_first_definition(ce, i, prop_name, prop_name_length, prop_hash, coliding_prop-ce)-name, property_info-ce-name, prop_name, ce-name); } else { zend_error(E_STRICT, %s and %s define the same property ($%s) in the composition of %s. This might be incompatible, to improve maintainability consider using accessor methods in traits instead. Class was composed, -find_first_definition(ce, i, prop_name, prop_name_length, coliding_prop-ce)-name, +find_first_definition(ce, i, prop_name, prop_name_length, prop_hash, coliding_prop-ce)-name, property_info-ce-name, prop_name, ce-name); Modified: php/php-src/trunk/Zend/zend_compile.c === --- php/php-src/trunk/Zend/zend_compile.c 2011-06-20
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/Zend/zend_compile.c trunk/Zend/zend_compile.c
pajoye Tue, 17 May 2011 10:39:18 + Revision: http://svn.php.net/viewvc?view=revisionrevision=311123 Log: - WS Changed paths: U php/php-src/branches/PHP_5_4/Zend/zend_compile.c U php/php-src/trunk/Zend/zend_compile.c Modified: php/php-src/branches/PHP_5_4/Zend/zend_compile.c === --- php/php-src/branches/PHP_5_4/Zend/zend_compile.c2011-05-17 09:44:11 UTC (rev 311122) +++ php/php-src/branches/PHP_5_4/Zend/zend_compile.c2011-05-17 10:39:18 UTC (rev 311123) @@ -2256,7 +2256,7 @@ CG(in_compilation) = 1; CG(active_op_array) = op_array; CG(zend_lineno) = opline-lineno; - zend_error(E_COMPILE_ERROR, 'goto' to undefined label '%s', Z_STRVAL_P(label)); + zend_error(E_COMPILE_ERROR, 'goto' to undefined label '%s', Z_STRVAL_P(label)); } else { /* Label is not defined. Delay to pass 2. */ INC_BPC(op_array); Modified: php/php-src/trunk/Zend/zend_compile.c === --- php/php-src/trunk/Zend/zend_compile.c 2011-05-17 09:44:11 UTC (rev 311122) +++ php/php-src/trunk/Zend/zend_compile.c 2011-05-17 10:39:18 UTC (rev 311123) @@ -2256,7 +2256,7 @@ CG(in_compilation) = 1; CG(active_op_array) = op_array; CG(zend_lineno) = opline-lineno; - zend_error(E_COMPILE_ERROR, 'goto' to undefined label '%s', Z_STRVAL_P(label)); + zend_error(E_COMPILE_ERROR, 'goto' to undefined label '%s', Z_STRVAL_P(label)); } else { /* Label is not defined. Delay to pass 2. */ INC_BPC(op_array); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php