dmitry          Tue Jan 29 10:45:19 2008 UTC

  Modified files:              
    /php-src/ext/standard       array.c 
    /php-src/ext/standard/tests/array   bug43505.phpt 
  Log:
  Fixed bug #43505 (Assign by reference bug)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.439&r2=1.440&diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.439 php-src/ext/standard/array.c:1.440
--- php-src/ext/standard/array.c:1.439  Tue Jan 29 00:39:26 2008
+++ php-src/ext/standard/array.c        Tue Jan 29 10:45:19 2008
@@ -21,7 +21,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: array.c,v 1.439 2008/01/29 00:39:26 tony2001 Exp $ */
+/* $Id: array.c,v 1.440 2008/01/29 10:45:19 dmitry Exp $ */
 
 #include "php.h"
 #include "php_ini.h"
@@ -324,7 +324,7 @@
                        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);
                                }
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/bug43505.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/standard/tests/array/bug43505.phpt
diff -u /dev/null php-src/ext/standard/tests/array/bug43505.phpt:1.2
--- /dev/null   Tue Jan 29 10:45:19 2008
+++ php-src/ext/standard/tests/array/bug43505.phpt      Tue Jan 29 10:45:19 2008
@@ -0,0 +1,43 @@
+--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
+}
+--UEXPECT--
+array(1) {
+  [u"test"]=>
+  &NULL
+}
+array(1) {
+  [u"test"]=>
+  &NULL
+}
+



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to