Re: com php-src: Fixed Bug #62005 (unexpected behavior when incrementally assigning to a member of a null object): NEWS Zend/tests/bug62005.phpt
Zend/zend_execute.c

From: Date: Sat, 12 May 2012 05:39:54 +0000
Subject: Re: com php-src: Fixed Bug #62005 (unexpected behavior when incrementally assigning to a member of a null object): NEWS Zend/tests/bug62005.phpt
Zend/zend_execute.c
References: 1 2  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-69041@lists.php.net to get a copy of this message
On Sat, May 12, 2012 at 1:23 PM, Laruence <laruence@php.net> wrote: > Hi: >   this bug is kind of a serious one, since it's behavior wrongly. RMS: I think I should note that the reason why I said it is a serious one, following script: <?php function add_points($player, $points) { $player->energy += $points; var_dump($player); } add_points(NULL, 2); ?> will ouput: NULL in 5.3 and 5.4 thanks > >   so maybe this one should merged to 5.3 and 5.4 branch.. > > thanks > > On Sat, May 12, 2012 at 1:13 PM, Xinchen Hui <laruence@php.net> wrote: >> Commit:    3332943c9d20a8b5e09816b11f38742de0e16085 >> Author:    Xinchen Hui <laruence@php.net>         Sat, 12 May 2012 13:13:44 >> +0800 >> Parents:   950d5ee590214742799836d3d939ee59f641bdf4 >> Branches:  PHP-5.3 >> >> Link:       >> http://git.php.net/?p=php-src.git;a=commitdiff;h=3332943c9d20a8b5e09816b11f38742de0e16085 >> >> Log: >> Fixed Bug #62005 (unexpected behavior when incrementally assigning to a member of a null >> object) >> >> Bugs: >> https://bugs.php.net/62005 >> >> Changed paths: >>  M  NEWS >>  A  Zend/tests/bug62005.phpt >>  M  Zend/zend_execute.c >> >> >> Diff: >> diff --git a/NEWS b/NEWS >> index e9c1370..1057db7 100644 >> --- a/NEWS >> +++ b/NEWS >> @@ -11,6 +11,8 @@ PHP                                               >>                          NEWS >>     (Laruence) >> >>  - Core: >> +  . Fixed bug #62005 (unexpected behavior when incrementally assigning to a >> +    member of a null object). (Laruence) >>   . Fixed bug #61730 (Segfault from array_walk modifying an array passed by >>     reference). (Laruence) >>   . Fixed missing bound check in iptcparse(). (chris at chiappa.net) >> diff --git a/Zend/tests/bug62005.phpt b/Zend/tests/bug62005.phpt >> new file mode 100644 >> index 0000000..4ff4b2c >> --- /dev/null >> +++ b/Zend/tests/bug62005.phpt >> @@ -0,0 +1,15 @@ >> +--TEST-- >> +Bug #62005 (unexpected behavior when incrementally assigning to a member of a null object) >> +--FILE-- >> +<?php >> +function add_points($player, $points) { >> +    $player->energy += $points; >> +    print_r($player); >> +} >> +add_points(NULL, 2); >> +--EXPECTF-- >> +Strict Standards: Creating default object from empty value in %sbug62005.php on line %d >> +stdClass Object >> +( >> +    [energy] => 2 >> +) >> diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c >> index 705c713..4423921 100644 >> --- a/Zend/zend_execute.c >> +++ b/Zend/zend_execute.c >> @@ -432,11 +432,10 @@ static inline void make_real_object(zval **object_ptr TSRMLS_DC) >>                || (Z_TYPE_PP(object_ptr) == IS_BOOL && >> Z_LVAL_PP(object_ptr) == 0) >>                || (Z_TYPE_PP(object_ptr) == IS_STRING && >> Z_STRLEN_PP(object_ptr) == 0) >>        ) { >> -               zend_error(E_STRICT, "Creating default object from empty >> value"); >> - >>                SEPARATE_ZVAL_IF_NOT_REF(object_ptr); >>                zval_dtor(*object_ptr); >>                object_init(*object_ptr); >> +               zend_error(E_STRICT, "Creating default object from empty >> value"); >>        } >>  } >> >> >> -- >> PHP CVS Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> > > > > -- > Laruence  Xinchen Hui > http://www.laruence.com/ -- Laruence  Xinchen Hui http://www.laruence.com/

« previous php.cvs (#69041) next »