⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bug33136.phpt

📁 PHP v6.0 For Linux 运行环境:Win9X/ WinME/ WinNT/ Win2K/ WinXP
💻 PHPT
字号:
--TEST--Bug #33136 method offsetSet in class extended from ArrayObject crash PHP --SKIPIF--<?php if (!extension_loaded("spl")) print "skip"; ?>--FILE--<?phpclass Collection extends ArrayObject{	private $data;		function __construct()	{		$this->data = array();		parent::__construct($this->data);	}		function offsetGet($index)	{		echo __METHOD__ . "($index)\n";		return parent::offsetGet($index);	}		function offsetSet($index, $value)	{		echo __METHOD__ . "(" . (is_null($index) ? "NULL" : $index) . ",$value)\n";		parent::offsetSet($index, $value);	}}echo "\n\nInitiate Obj\n";$arrayObj = new Collection();echo "Assign values\n";$arrayObj[] = "foo";var_dump($arrayObj[0]);$arrayObj[] = "bar";var_dump($arrayObj[0]);var_dump($arrayObj[1]);$arrayObj["foo"] = "baz";var_dump($arrayObj["foo"]);print_r($arrayObj);var_dump(count($arrayObj));?>===DONE===<?php //exit(0); ?>--EXPECT--Initiate ObjAssign valuesCollection::offsetSet(NULL,foo)Collection::offsetGet(0)string(3) "foo"Collection::offsetSet(NULL,bar)Collection::offsetGet(0)string(3) "foo"Collection::offsetGet(1)string(3) "bar"Collection::offsetSet(foo,baz)Collection::offsetGet(foo)string(3) "baz"Collection Object(    [0] => foo    [1] => bar    [foo] => baz)int(3)===DONE===--UEXPECT--Initiate ObjAssign valuesCollection::offsetSet(NULL,foo)Collection::offsetGet(0)unicode(3) "foo"Collection::offsetSet(NULL,bar)Collection::offsetGet(0)unicode(3) "foo"Collection::offsetGet(1)unicode(3) "bar"Collection::offsetSet(foo,baz)Collection::offsetGet(foo)unicode(3) "baz"Collection Object(    [0] => foo    [1] => bar    [foo] => baz)int(3)===DONE===

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -