Skip to content

Commit

Permalink
Merge branch 'PHP-5.4'
Browse files Browse the repository at this point in the history
* PHP-5.4:
  Fixed Bug #62005 (unexpected behavior when incrementally assigning to a member of a null object)
  fix stack overflow in php_intlog10abs()
  fix stack overflow in php_intlog10abs()
  • Loading branch information
laruence committed May 12, 2012
2 parents 3478b49 + 6a50955 commit 5852e5f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
15 changes: 15 additions & 0 deletions 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--
Warning: Creating default object from empty value in %sbug62005.php on line %d
stdClass Object
(
[energy] => 2
)
3 changes: 1 addition & 2 deletions Zend/zend_execute.c
Expand Up @@ -554,11 +554,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_WARNING, "Creating default object from empty value");

SEPARATE_ZVAL_IF_NOT_REF(object_ptr);
zval_dtor(*object_ptr);
object_init(*object_ptr);
zend_error(E_WARNING, "Creating default object from empty value");
}
}

Expand Down

0 comments on commit 5852e5f

Please sign in to comment.