tony2001                Mon Sep 19 14:59:50 2005 EDT

  Modified files:              
    /php-src/ext/spl/tests      bug34548.phpt 
  Log:
  MF5.0: add new test
  
  
http://cvs.php.net/diff.php/php-src/ext/spl/tests/bug34548.phpt?r1=1.1&r2=1.2&ty=u
Index: php-src/ext/spl/tests/bug34548.phpt
diff -u /dev/null php-src/ext/spl/tests/bug34548.phpt:1.2
--- /dev/null   Mon Sep 19 14:59:50 2005
+++ php-src/ext/spl/tests/bug34548.phpt Mon Sep 19 14:59:50 2005
@@ -0,0 +1,38 @@
+--TEST--
+bug #34548 (Method append() in class extended from ArrayObject crashes PHP)
+--FILE--
+<?php
+
+class Collection extends ArrayObject
+{
+       public function add($dataArray)
+       {
+               foreach($dataArray as $value) $this->append($value);
+       }
+
+       public function offsetSet($index, $value)
+       {
+               parent::offsetSet($index, $value);
+       }
+}
+
+$data1=array('one', 'two', 'three');
+$data2=array('four', 'five');
+
+$foo=new Collection($data1);
+$foo->add($data2);
+
+print_r($foo->getArrayCopy());
+
+echo "Done\n";
+?>
+--EXPECT--     
+Array
+(
+    [0] => one
+    [1] => two
+    [2] => three
+    [3] => four
+    [4] => five
+)
+Done

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

Reply via email to