diff options
author | Dmitry Stogov <dmitry@php.net> | 2008-01-29 10:45:07 +0000 |
---|---|---|
committer | Dmitry Stogov <dmitry@php.net> | 2008-01-29 10:45:07 +0000 |
commit | 382f1dddfaa60707eb376c8904a54ef043132099 (patch) | |
tree | b695119b3376dd0dc86aeeaf58d45f5b12931810 /ext | |
parent | 58433c9b11a27d24eb1476d71555602cc13d6aea (diff) | |
download | php-git-382f1dddfaa60707eb376c8904a54ef043132099.tar.gz |
Fixed bug #43505 (Assign by reference bug)
Diffstat (limited to 'ext')
-rw-r--r-- | ext/standard/array.c | 2 | ||||
-rw-r--r-- | ext/standard/tests/array/bug43505.phpt | 34 |
2 files changed, 35 insertions, 1 deletions
diff --git a/ext/standard/array.c b/ext/standard/array.c index a66a9366e5..415469f94c 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -318,7 +318,7 @@ PHP_FUNCTION(count) if (Z_OBJ_HT_P(array)->get_class_entry && instanceof_function(Z_OBJCE_P(array), spl_ce_Countable TSRMLS_CC)) { zend_call_method_with_0_params(&array, NULL, NULL, "count", &retval); if (retval) { - convert_to_long(retval); + convert_to_long_ex(&retval); RETVAL_LONG(Z_LVAL_P(retval)); zval_ptr_dtor(&retval); } diff --git a/ext/standard/tests/array/bug43505.phpt b/ext/standard/tests/array/bug43505.phpt new file mode 100644 index 0000000000..0a304793c5 --- /dev/null +++ b/ext/standard/tests/array/bug43505.phpt @@ -0,0 +1,34 @@ +--TEST-- +Bug #43505 (Assign by reference bug) +--INI-- +error_reporting=0 +--FILE-- +<?php +class Test implements Countable { + public function count() { + return $some; + } +} + +$obj = new Test(); + +$a = array(); +$b =& $a['test']; +var_dump($a); + +$t = count($obj); + +$a = array(); +$b =& $a['test']; +var_dump($a); +?> +--EXPECT-- +array(1) { + ["test"]=> + &NULL +} +array(1) { + ["test"]=> + &NULL +} + |