tony2001                Sat Apr  1 19:14:01 2006 UTC

  Modified files:              
    /php-src/ext/spl    spl_array.c 
    /php-src/ext/spl/tests      iterator_035.phpt 
  Log:
  MF51: fix segfault when assigning value by ref and add test
  
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/spl_array.c?r1=1.104&r2=1.105&diff_format=u
Index: php-src/ext/spl/spl_array.c
diff -u php-src/ext/spl/spl_array.c:1.104 php-src/ext/spl/spl_array.c:1.105
--- php-src/ext/spl/spl_array.c:1.104   Wed Mar 29 15:08:52 2006
+++ php-src/ext/spl/spl_array.c Sat Apr  1 19:14:01 2006
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: spl_array.c,v 1.104 2006/03/29 15:08:52 tony2001 Exp $ */
+/* $Id: spl_array.c,v 1.105 2006/04/01 19:14:01 tony2001 Exp $ */
 
 #ifdef HAVE_CONFIG_H
 # include "config.h"
@@ -247,6 +247,10 @@
        if (check_inherited && intern->fptr_offset_get) {
                return zend_call_method_with_1_params(&object, 
Z_OBJCE_P(object), &intern->fptr_offset_get, "offsetGet", NULL, offset);
        }*/
+
+       if (!offset) {
+               return &EG(uninitialized_zval_ptr);
+       }
        
        switch(Z_TYPE_P(offset)) {
        case IS_STRING:
http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/tests/iterator_035.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/spl/tests/iterator_035.phpt
diff -u /dev/null php-src/ext/spl/tests/iterator_035.phpt:1.2
--- /dev/null   Sat Apr  1 19:14:01 2006
+++ php-src/ext/spl/tests/iterator_035.phpt     Sat Apr  1 19:14:01 2006
@@ -0,0 +1,17 @@
+--TEST--
+SPL: ArrayIterator and values assigned by reference
+--SKIPIF--
+<?php if (!extension_loaded("spl")) print "skip"; ?>
+--FILE--
+<?php
+       
+$tmp = 1;
+
+$a = new ArrayIterator();
+$a[] = $tmp;
+$a[] = &$tmp;
+
+echo "Done\n";
+?>
+--EXPECTF--    
+Fatal error: Objects used as arrays in post/pre increment/decrement must 
return values by reference in %s on line %d

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

Reply via email to