Skip to content

Commit 5852e5f

Browse files
committed
Merge branch 'PHP-5.4'
* 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()
2 parents 3478b49 + 6a50955 commit 5852e5f

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

Zend/tests/bug62005.phpt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
--TEST--
2+
Bug #62005 (unexpected behavior when incrementally assigning to a member of a null object)
3+
--FILE--
4+
<?php
5+
function add_points($player, $points) {
6+
$player->energy += $points;
7+
print_r($player);
8+
}
9+
add_points(NULL, 2);
10+
--EXPECTF--
11+
Warning: Creating default object from empty value in %sbug62005.php on line %d
12+
stdClass Object
13+
(
14+
[energy] => 2
15+
)

Zend/zend_execute.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -554,11 +554,10 @@ static inline void make_real_object(zval **object_ptr TSRMLS_DC)
554554
|| (Z_TYPE_PP(object_ptr) == IS_BOOL && Z_LVAL_PP(object_ptr) == 0)
555555
|| (Z_TYPE_PP(object_ptr) == IS_STRING && Z_STRLEN_PP(object_ptr) == 0)
556556
) {
557-
zend_error(E_WARNING, "Creating default object from empty value");
558-
559557
SEPARATE_ZVAL_IF_NOT_REF(object_ptr);
560558
zval_dtor(*object_ptr);
561559
object_init(*object_ptr);
560+
zend_error(E_WARNING, "Creating default object from empty value");
562561
}
563562
}
564563

0 commit comments

Comments
 (0)