summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMark A. Hershberger <mah@debian.(none)>2009-03-25 00:34:59 -0400
committerMark A. Hershberger <mah@debian.(none)>2009-03-25 00:34:59 -0400
commitce7edc9b3c7370f32fec0bc7a8ec3e29ed9a5f61 (patch)
treeacdb9a8816483652a9db1a47db71df5df43707c5 /tests
parent10f5b47dc7c1cf2b9a00991629f43652710322d3 (diff)
downloadphp-ce7edc9b3c7370f32fec0bc7a8ec3e29ed9a5f61.tar.gz
Imported Upstream version 5.1.1upstream/5.1.1
Diffstat (limited to 'tests')
-rw-r--r--tests/basic/bug20539.phpt1
-rw-r--r--tests/basic/bug31672.phpt8
-rwxr-xr-xtests/classes/__set__get_004.phpt39
-rwxr-xr-xtests/classes/__set__get_005.phpt68
-rw-r--r--tests/classes/array_access_001.phpt4
-rw-r--r--tests/classes/array_access_002.phpt4
-rw-r--r--tests/classes/array_access_003.phpt11
-rwxr-xr-xtests/classes/array_access_005.phpt28
-rwxr-xr-xtests/classes/array_access_008.phpt59
-rwxr-xr-xtests/classes/array_access_009.phpt190
-rwxr-xr-xtests/classes/array_access_010.phpt168
-rwxr-xr-xtests/classes/array_access_011.phpt187
-rwxr-xr-xtests/classes/array_access_012.phpt34
-rwxr-xr-xtests/classes/array_access_013.phpt58
-rw-r--r--tests/classes/bug26737.phpt1
-rw-r--r--tests/classes/bug29446.phpt19
-rw-r--r--tests/classes/ctor_name_clash.phpt22
-rwxr-xr-xtests/classes/destructor_and_exceptions.phpt60
-rwxr-xr-xtests/classes/interface_and_extends.phpt2
-rw-r--r--tests/classes/interface_doubled.phpt10
-rw-r--r--tests/classes/interface_implemented.phpt4
-rw-r--r--tests/classes/interface_instantiate.phpt2
-rw-r--r--tests/classes/interface_method_private.phpt2
-rwxr-xr-xtests/classes/interfaces_003.phpt33
-rwxr-xr-xtests/classes/iterators_001.phpt16
-rwxr-xr-xtests/classes/iterators_002.phpt6
-rwxr-xr-xtests/classes/iterators_003.phpt1
-rwxr-xr-xtests/classes/iterators_004.phpt1
-rwxr-xr-xtests/classes/iterators_005.phpt1
-rwxr-xr-xtests/classes/iterators_007.phpt43
-rwxr-xr-xtests/classes/property_exists.phpt222
-rwxr-xr-xtests/classes/serialize_001.phpt79
-rw-r--r--tests/classes/type_hinting_001.phpt2
-rwxr-xr-xtests/classes/type_hinting_003.phpt60
-rw-r--r--tests/lang/023.phpt2
-rwxr-xr-xtests/lang/040.phpt15
-rw-r--r--tests/lang/bug19943.phpt2
-rw-r--r--tests/lang/bug21800.phpt19
-rw-r--r--tests/lang/bug22231.phpt2
-rw-r--r--tests/lang/bug22367.phpt3
-rw-r--r--tests/lang/bug22510.phpt10
-rw-r--r--tests/lang/bug22592.phpt20
-rw-r--r--tests/lang/bug24658.phpt2
-rw-r--r--tests/lang/bug26696.phpt4
-rw-r--r--tests/lang/bug30085.phpt24
-rw-r--r--tests/lang/bug30578.phpt31
-rw-r--r--tests/lang/bug32924.phpt14
-rwxr-xr-xtests/lang/bug35176.phpt14
-rwxr-xr-xtests/lang/bug35382.phpt9
-rw-r--r--tests/lang/inc.inc3
-rw-r--r--tests/lang/type_hints_001.phpt2
-rwxr-xr-xtests/reflection/006.phpt103
-rwxr-xr-xtests/reflection/bug33389.phpt97
-rw-r--r--tests/reflection/exception.inc2
-rwxr-xr-xtests/reflection/parameters_001.phpt8
-rw-r--r--tests/strings/001.phpt5
-rwxr-xr-xtests/strings/bug22592.phpt8
57 files changed, 1710 insertions, 134 deletions
diff --git a/tests/basic/bug20539.phpt b/tests/basic/bug20539.phpt
index 635296099..372285bfa 100644
--- a/tests/basic/bug20539.phpt
+++ b/tests/basic/bug20539.phpt
@@ -2,6 +2,7 @@
Bug #20539 (PHP CLI Segmentation Fault)
--INI--
session.auto_start=1
+session.save_handler=files
--FILE--
<?php
print "good :)\n";
diff --git a/tests/basic/bug31672.phpt b/tests/basic/bug31672.phpt
deleted file mode 100644
index 450427630..000000000
--- a/tests/basic/bug31672.phpt
+++ /dev/null
@@ -1,8 +0,0 @@
---TEST--
-Bug #31672 (one-line comment with </script>)
---FILE--
-<?php echo "Foo"; // ?>bar
-<?php echo "Foo"; // </script>bar
---EXPECT--
-Foobar
-Foobar
diff --git a/tests/classes/__set__get_004.phpt b/tests/classes/__set__get_004.phpt
new file mode 100755
index 000000000..e3061da4f
--- /dev/null
+++ b/tests/classes/__set__get_004.phpt
@@ -0,0 +1,39 @@
+--TEST--
+ZE2 __set() and __get()
+--SKIPIF--
+<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
+--FILE--
+<?php
+class Test {
+ protected $x;
+
+ function __get($name) {
+ if (isset($this->x[$name])) {
+ return $this->x[$name];
+ }
+ else
+ {
+ return NULL;
+ }
+ }
+
+ function __set($name, $val) {
+ $this->x[$name] = $val;
+ }
+}
+
+$foo = new Test();
+$bar = new Test();
+$bar->baz = "Check";
+
+$foo->bar = $bar;
+
+var_dump($bar->baz);
+var_dump($foo->bar->baz);
+
+?>
+===DONE===
+--EXPECTF--
+string(5) "Check"
+string(5) "Check"
+===DONE===
diff --git a/tests/classes/__set__get_005.phpt b/tests/classes/__set__get_005.phpt
new file mode 100755
index 000000000..1a5533406
--- /dev/null
+++ b/tests/classes/__set__get_005.phpt
@@ -0,0 +1,68 @@
+--TEST--
+ZE2 __set() and __get()
+--SKIPIF--
+<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
+--FILE--
+<?php
+class Test
+{
+ protected $x;
+
+ function __get($name) {
+ echo __METHOD__ . "\n";
+ if (isset($this->x[$name])) {
+ return $this->x[$name];
+ }
+ else
+ {
+ return NULL;
+ }
+ }
+
+ function __set($name, $val) {
+ echo __METHOD__ . "\n";
+ $this->x[$name] = $val;
+ }
+}
+
+class AutoGen
+{
+ protected $x;
+
+ function __get($name) {
+ echo __METHOD__ . "\n";
+ if (!isset($this->x[$name])) {
+ $this->x[$name] = new Test();
+ }
+ return $this->x[$name];
+ }
+
+ function __set($name, $val) {
+ echo __METHOD__ . "\n";
+ $this->x[$name] = $val;
+ }
+}
+
+$foo = new AutoGen();
+$foo->bar->baz = "Check";
+
+var_dump($foo->bar);
+var_dump($foo->bar->baz);
+
+?>
+===DONE===
+--EXPECTF--
+AutoGen::__get
+Test::__set
+AutoGen::__get
+object(Test)#%d (1) {
+ ["x:protected"]=>
+ array(1) {
+ ["baz"]=>
+ string(5) "Check"
+ }
+}
+AutoGen::__get
+Test::__get
+string(5) "Check"
+===DONE===
diff --git a/tests/classes/array_access_001.phpt b/tests/classes/array_access_001.phpt
index 9b3d8891e..82f96d523 100644
--- a/tests/classes/array_access_001.phpt
+++ b/tests/classes/array_access_001.phpt
@@ -96,12 +96,16 @@ array(4) {
}
===EMPTY===
object::offsetExists(0)
+object::offsetGet(0)
bool(false)
object::offsetExists(1)
+object::offsetGet(1)
bool(false)
object::offsetExists(2)
+object::offsetGet(2)
bool(false)
object::offsetExists(4th)
+object::offsetGet(4th)
bool(false)
object::offsetExists(5th)
bool(true)
diff --git a/tests/classes/array_access_002.phpt b/tests/classes/array_access_002.phpt
index 7aebb035a..fd08eb394 100644
--- a/tests/classes/array_access_002.phpt
+++ b/tests/classes/array_access_002.phpt
@@ -96,12 +96,16 @@ array(4) {
}
===EMPTY===
object::offsetExists(0)
+object::offsetGet(0)
bool(false)
object::offsetExists(1)
+object::offsetGet(1)
bool(false)
object::offsetExists(2)
+object::offsetGet(2)
bool(false)
object::offsetExists(4th)
+object::offsetGet(4th)
bool(false)
object::offsetExists(5th)
bool(true)
diff --git a/tests/classes/array_access_003.phpt b/tests/classes/array_access_003.phpt
index 7a803b7a2..2d42665fc 100644
--- a/tests/classes/array_access_003.phpt
+++ b/tests/classes/array_access_003.phpt
@@ -1,5 +1,7 @@
--TEST--
ZE2 ArrayAccess::offsetGet ambiguties
+--INI--
+error_reporting=4095
--FILE--
<?php
class object implements ArrayAccess {
@@ -10,7 +12,7 @@ class object implements ArrayAccess {
echo __METHOD__ . "($index)\n";
return array_key_exists($index, $this->a);
}
- function &offsetGet($index) {
+ function offsetGet($index) {
echo __METHOD__ . "($index)\n";
switch($index) {
case 1:
@@ -46,12 +48,9 @@ var_dump($obj[2]);
===DONE===
--EXPECTF--
object::offsetGet(1)
-
-Strict Standards: Only variable references should be returned by reference in %sarray_access_003.php on line %d
string(6) "fooBar"
object::offsetGet(2)
int(1)
object::offsetGet(2)
-object::offsetGet(2)
-int(2)
-===DONE===
+
+Fatal error: Objects used as arrays in post/pre increment/decrement must return values by reference in %sarray_access_003.php on line %d
diff --git a/tests/classes/array_access_005.phpt b/tests/classes/array_access_005.phpt
index 5c6271d25..f248f2172 100755
--- a/tests/classes/array_access_005.phpt
+++ b/tests/classes/array_access_005.phpt
@@ -14,7 +14,7 @@ class Peoples implements ArrayAccess {
return array_key_exists($this->person, $index);
}
- function &offsetGet($index) {
+ function offsetGet($index) {
return $this->person[$index];
}
@@ -39,20 +39,34 @@ echo "---ArrayOverloading---\n";
$people = new Peoples;
+var_dump($people[0]);
var_dump($people[0]['name']);
-$people[0]['name'] = $people->person[0]['name'] . 'Foo';
+var_dump($people->person[0]['name'] . 'Foo'); // impossible to assign this since we don't return references here
+$x = $people[0]; // creates a copy
+$x['name'] .= 'Foo';
+$people[0] = $x;
+var_dump($people[0]);
+$people[0]['name'] = 'JoeFoo';
var_dump($people[0]['name']);
-$people[0]['name'] .= 'Bar';
+$people[0]['name'] = 'JoeFooBar';
var_dump($people[0]['name']);
-echo "---Done---\n";
?>
---EXPECT--
+===DONE===
+--EXPECTF--
string(3) "Joe"
string(6) "JoeFoo"
string(9) "JoeFooBar"
---ArrayOverloading---
+array(1) {
+ ["name"]=>
+ string(3) "Joe"
+}
string(3) "Joe"
string(6) "JoeFoo"
-string(9) "JoeFooBar"
----Done---
+array(1) {
+ ["name"]=>
+ string(6) "JoeFoo"
+}
+
+Fatal error: Objects used as arrays in post/pre increment/decrement must return values by reference in %sarray_access_005.php on line %d
diff --git a/tests/classes/array_access_008.phpt b/tests/classes/array_access_008.phpt
new file mode 100755
index 000000000..013038824
--- /dev/null
+++ b/tests/classes/array_access_008.phpt
@@ -0,0 +1,59 @@
+--TEST--
+ZE2 ArrayAccess and ASSIGN_OP operators (.=)
+--FILE--
+<?php
+
+class Peoples implements ArrayAccess {
+ public $person;
+
+ function __construct() {
+ $this->person = array(array('name'=>'Foo'));
+ }
+
+ function offsetExists($index) {
+ return array_key_exists($this->person, $index);
+ }
+
+ function offsetGet($index) {
+ return $this->person[$index];
+ }
+
+ function offsetSet($index, $value) {
+ $this->person[$index] = $value;
+ }
+
+ function offsetUnset($index) {
+ unset($this->person[$index]);
+ }
+}
+
+$people = new Peoples;
+
+var_dump($people->person[0]['name']);
+$people->person[0]['name'] = $people->person[0]['name'] . 'Bar';
+var_dump($people->person[0]['name']);
+$people->person[0]['name'] .= 'Baz';
+var_dump($people->person[0]['name']);
+
+echo "===ArrayOverloading===\n";
+
+$people = new Peoples;
+
+var_dump($people[0]['name']);
+$people[0]['name'] = 'FooBar';
+var_dump($people[0]['name']);
+$people[0]['name'] = $people->person[0]['name'] . 'Bar';
+var_dump($people[0]['name']);
+$people[0]['name'] .= 'Baz';
+var_dump($people[0]['name']);
+
+?>
+===DONE===
+--EXPECTF--
+string(3) "Foo"
+string(6) "FooBar"
+string(9) "FooBarBaz"
+===ArrayOverloading===
+string(3) "Foo"
+
+Fatal error: Objects used as arrays in post/pre increment/decrement must return values by reference in %sarray_access_008.php on line %d
diff --git a/tests/classes/array_access_009.phpt b/tests/classes/array_access_009.phpt
new file mode 100755
index 000000000..32573f5a4
--- /dev/null
+++ b/tests/classes/array_access_009.phpt
@@ -0,0 +1,190 @@
+--TEST--
+ZE2 ArrayAccess and ArrayProxyAccess, ArrayProxy
+--FILE--
+<?php
+
+// NOTE: This will become part of SPL
+
+interface ArrayProxyAccess extends ArrayAccess
+{
+ function proxyGet($element);
+ function proxySet($element, $index, $value);
+ function proxyUnset($element, $index);
+}
+
+class ArrayProxy implements ArrayAccess
+{
+ private $object;
+ private $element;
+
+ function __construct(ArrayProxyAccess $object, $element)
+ {
+ echo __METHOD__ . "($element)\n";
+ if (!$object->offsetExists($element))
+ {
+ $object[$element] = array();
+ }
+ $this->object = $object;
+ $this->element = $element;
+ }
+
+ function offsetExists($index) {
+ echo __METHOD__ . "($this->element, $index)\n";
+ return array_key_exists($index, $this->object->proxyGet($this->element));
+ }
+
+ function offsetGet($index) {
+ echo __METHOD__ . "($this->element, $index)\n";
+ $tmp = $this->object->proxyGet($this->element);
+ return isset($tmp[$index]) ? $tmp[$index] : NULL;
+ }
+
+ function offsetSet($index, $value) {
+ echo __METHOD__ . "($this->element, $index, $value)\n";
+ $this->object->proxySet($this->element, $index, $value);
+ }
+
+ function offsetUnset($index) {
+ echo __METHOD__ . "($this->element, $index)\n";
+ $this->object->proxyUnset($this->element, $index);
+ }
+}
+
+class Peoples implements ArrayProxyAccess
+{
+ public $person;
+
+ function __construct()
+ {
+ $this->person = array(array('name'=>'Foo'));
+ }
+
+ function offsetExists($index)
+ {
+ return array_key_exists($index, $this->person);
+ }
+
+ function offsetGet($index)
+ {
+ return new ArrayProxy($this, $index);
+ }
+
+ function offsetSet($index, $value)
+ {
+ $this->person[$index] = $value;
+ }
+
+ function offsetUnset($index)
+ {
+ unset($this->person[$index]);
+ }
+
+ function proxyGet($element)
+ {
+ return $this->person[$element];
+ }
+
+ function proxySet($element, $index, $value)
+ {
+ $this->person[$element][$index] = $value;
+ }
+
+ function proxyUnset($element, $index)
+ {
+ unset($this->person[$element][$index]);
+ }
+}
+
+$people = new Peoples;
+
+var_dump($people->person[0]['name']);
+$people->person[0]['name'] = $people->person[0]['name'] . 'Bar';
+var_dump($people->person[0]['name']);
+$people->person[0]['name'] .= 'Baz';
+var_dump($people->person[0]['name']);
+
+echo "===ArrayOverloading===\n";
+
+$people = new Peoples;
+
+var_dump($people[0]);
+var_dump($people[0]['name']);
+$people[0]['name'] = 'FooBar';
+var_dump($people[0]['name']);
+$people[0]['name'] = $people->person[0]['name'] . 'Bar';
+var_dump($people[0]['name']);
+$people[0]['name'] .= 'Baz';
+var_dump($people[0]['name']);
+unset($people[0]['name']);
+var_dump($people[0]);
+var_dump($people[0]['name']);
+$people[0]['name'] = 'BlaBla';
+var_dump($people[0]['name']);
+
+?>
+===DONE===
+--EXPECTF--
+string(3) "Foo"
+string(6) "FooBar"
+string(9) "FooBarBaz"
+===ArrayOverloading===
+ArrayProxy::__construct(0)
+object(ArrayProxy)#1 (2) {
+ ["object:private"]=>
+ object(Peoples)#2 (1) {
+ ["person"]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ ["name"]=>
+ string(3) "Foo"
+ }
+ }
+ }
+ ["element:private"]=>
+ int(0)
+}
+ArrayProxy::__construct(0)
+ArrayProxy::offsetGet(0, name)
+string(3) "Foo"
+ArrayProxy::__construct(0)
+ArrayProxy::offsetSet(0, name, FooBar)
+ArrayProxy::__construct(0)
+ArrayProxy::offsetGet(0, name)
+string(6) "FooBar"
+ArrayProxy::__construct(0)
+ArrayProxy::offsetSet(0, name, FooBarBar)
+ArrayProxy::__construct(0)
+ArrayProxy::offsetGet(0, name)
+string(9) "FooBarBar"
+ArrayProxy::__construct(0)
+ArrayProxy::offsetGet(0, name)
+ArrayProxy::offsetSet(0, name, FooBarBarBaz)
+ArrayProxy::__construct(0)
+ArrayProxy::offsetGet(0, name)
+string(12) "FooBarBarBaz"
+ArrayProxy::__construct(0)
+ArrayProxy::offsetUnset(0, name)
+ArrayProxy::__construct(0)
+object(ArrayProxy)#1 (2) {
+ ["object:private"]=>
+ object(Peoples)#2 (1) {
+ ["person"]=>
+ array(1) {
+ [0]=>
+ array(0) {
+ }
+ }
+ }
+ ["element:private"]=>
+ int(0)
+}
+ArrayProxy::__construct(0)
+ArrayProxy::offsetGet(0, name)
+NULL
+ArrayProxy::__construct(0)
+ArrayProxy::offsetSet(0, name, BlaBla)
+ArrayProxy::__construct(0)
+ArrayProxy::offsetGet(0, name)
+string(6) "BlaBla"
+===DONE===
diff --git a/tests/classes/array_access_010.phpt b/tests/classes/array_access_010.phpt
new file mode 100755
index 000000000..05a169b2f
--- /dev/null
+++ b/tests/classes/array_access_010.phpt
@@ -0,0 +1,168 @@
+--TEST--
+ZE2 ArrayAccess and ArrayReferenceProxy with references
+--FILE--
+<?php
+
+// NOTE: This will become part of SPL
+
+class ArrayReferenceProxy implements ArrayAccess
+{
+ private $object;
+ private $element;
+
+ function __construct(ArrayAccess $object, array &$element)
+ {
+ echo __METHOD__ . "($element)\n";
+ $this->object = $object;
+ $this->element = &$element;
+ }
+
+ function offsetExists($index) {
+ echo __METHOD__ . "($this->element, $index)\n";
+ return array_key_exists($index, $this->element);
+ }
+
+ function offsetGet($index) {
+ echo __METHOD__ . "($this->element, $index)\n";
+ return isset($this->element[$index]) ? $this->element[$index] : NULL;
+ }
+
+ function offsetSet($index, $value) {
+ echo __METHOD__ . "($this->element, $index, $value)\n";
+ $this->element[$index] = $value;
+ }
+
+ function offsetUnset($index) {
+ echo __METHOD__ . "($this->element, $index)\n";
+ unset($this->element[$index]);
+ }
+}
+
+class Peoples implements ArrayAccess
+{
+ public $person;
+
+ function __construct()
+ {
+ $this->person = array(array('name'=>'Foo'));
+ }
+
+ function offsetExists($index)
+ {
+ return array_key_exists($index, $this->person);
+ }
+
+ function offsetGet($index)
+ {
+ return new ArrayReferenceProxy($this, $this->person[$index]);
+ }
+
+ function offsetSet($index, $value)
+ {
+ $this->person[$index] = $value;
+ }
+
+ function offsetUnset($index)
+ {
+ unset($this->person[$index]);
+ }
+}
+
+$people = new Peoples;
+
+var_dump($people->person[0]['name']);
+$people->person[0]['name'] = $people->person[0]['name'] . 'Bar';
+var_dump($people->person[0]['name']);
+$people->person[0]['name'] .= 'Baz';
+var_dump($people->person[0]['name']);
+
+echo "===ArrayOverloading===\n";
+
+$people = new Peoples;
+
+var_dump($people[0]);
+var_dump($people[0]['name']);
+$people[0]['name'] = 'FooBar';
+var_dump($people[0]['name']);
+$people[0]['name'] = $people->person[0]['name'] . 'Bar';
+var_dump($people[0]['name']);
+$people[0]['name'] .= 'Baz';
+var_dump($people[0]['name']);
+unset($people[0]['name']);
+var_dump($people[0]);
+var_dump($people[0]['name']);
+$people[0]['name'] = 'BlaBla';
+var_dump($people[0]['name']);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+string(3) "Foo"
+string(6) "FooBar"
+string(9) "FooBarBaz"
+===ArrayOverloading===
+ArrayReferenceProxy::__construct(Array)
+object(ArrayReferenceProxy)#1 (2) {
+ ["object:private"]=>
+ object(Peoples)#2 (1) {
+ ["person"]=>
+ array(1) {
+ [0]=>
+ &array(1) {
+ ["name"]=>
+ string(3) "Foo"
+ }
+ }
+ }
+ ["element:private"]=>
+ &array(1) {
+ ["name"]=>
+ string(3) "Foo"
+ }
+}
+ArrayReferenceProxy::__construct(Array)
+ArrayReferenceProxy::offsetGet(Array, name)
+string(3) "Foo"
+ArrayReferenceProxy::__construct(Array)
+ArrayReferenceProxy::offsetSet(Array, name, FooBar)
+ArrayReferenceProxy::__construct(Array)
+ArrayReferenceProxy::offsetGet(Array, name)
+string(6) "FooBar"
+ArrayReferenceProxy::__construct(Array)
+ArrayReferenceProxy::offsetSet(Array, name, FooBarBar)
+ArrayReferenceProxy::__construct(Array)
+ArrayReferenceProxy::offsetGet(Array, name)
+string(9) "FooBarBar"
+ArrayReferenceProxy::__construct(Array)
+ArrayReferenceProxy::offsetGet(Array, name)
+ArrayReferenceProxy::offsetSet(Array, name, FooBarBarBaz)
+ArrayReferenceProxy::__construct(Array)
+ArrayReferenceProxy::offsetGet(Array, name)
+string(12) "FooBarBarBaz"
+ArrayReferenceProxy::__construct(Array)
+ArrayReferenceProxy::offsetUnset(Array, name)
+ArrayReferenceProxy::__construct(Array)
+object(ArrayReferenceProxy)#1 (2) {
+ ["object:private"]=>
+ object(Peoples)#2 (1) {
+ ["person"]=>
+ array(1) {
+ [0]=>
+ &array(0) {
+ }
+ }
+ }
+ ["element:private"]=>
+ &array(0) {
+ }
+}
+ArrayReferenceProxy::__construct(Array)
+ArrayReferenceProxy::offsetGet(Array, name)
+NULL
+ArrayReferenceProxy::__construct(Array)
+ArrayReferenceProxy::offsetSet(Array, name, BlaBla)
+ArrayReferenceProxy::__construct(Array)
+ArrayReferenceProxy::offsetGet(Array, name)
+string(6) "BlaBla"
+===DONE===
diff --git a/tests/classes/array_access_011.phpt b/tests/classes/array_access_011.phpt
new file mode 100755
index 000000000..20d39568b
--- /dev/null
+++ b/tests/classes/array_access_011.phpt
@@ -0,0 +1,187 @@
+--TEST--
+ZE2 ArrayAccess and ArrayAccessReferenceProxy with references to main array
+--FILE--
+<?php
+
+// NOTE: This will become part of SPL
+
+class ArrayAccessReferenceProxy implements ArrayAccess
+{
+ private $object;
+ private $oarray;
+ private $element;
+
+ function __construct(ArrayAccess $object, array &$array, $element)
+ {
+ echo __METHOD__ . "($element)\n";
+ $this->object = $object;
+ $this->oarray = &$array;
+ $this->element = $element;
+ }
+
+ function offsetExists($index) {
+ echo __METHOD__ . "($this->element, $index)\n";
+ return array_key_exists($index, $this->oarray[$this->element]);
+ }
+
+ function offsetGet($index) {
+ echo __METHOD__ . "($this->element, $index)\n";
+ return isset($this->oarray[$this->element][$index]) ? $this->oarray[$this->element][$index] : NULL;
+ }
+
+ function offsetSet($index, $value) {
+ echo __METHOD__ . "($this->element, $index, $value)\n";
+ $this->oarray[$this->element][$index] = $value;
+ }
+
+ function offsetUnset($index) {
+ echo __METHOD__ . "($this->element, $index)\n";
+ unset($this->oarray[$this->element][$index]);
+ }
+}
+
+class Peoples implements ArrayAccess
+{
+ public $person;
+
+ function __construct()
+ {
+ $this->person = array(array('name'=>'Foo'));
+ }
+
+ function offsetExists($index)
+ {
+ return array_key_exists($index, $this->person);
+ }
+
+ function offsetGet($index)
+ {
+ if (is_array($this->person[$index]))
+ {
+ return new ArrayAccessReferenceProxy($this, $this->person, $index);
+ }
+ else
+ {
+ return $this->person[$index];
+ }
+ }
+
+ function offsetSet($index, $value)
+ {
+ $this->person[$index] = $value;
+ }
+
+ function offsetUnset($index)
+ {
+ unset($this->person[$index]);
+ }
+}
+
+$people = new Peoples;
+
+var_dump($people->person[0]['name']);
+$people->person[0]['name'] = $people->person[0]['name'] . 'Bar';
+var_dump($people->person[0]['name']);
+$people->person[0]['name'] .= 'Baz';
+var_dump($people->person[0]['name']);
+
+echo "===ArrayOverloading===\n";
+
+$people = new Peoples;
+
+var_dump($people[0]);
+var_dump($people[0]['name']);
+$people[0]['name'] = 'FooBar';
+var_dump($people[0]['name']);
+$people[0]['name'] = $people->person[0]['name'] . 'Bar';
+var_dump($people[0]['name']);
+$people[0]['name'] .= 'Baz';
+var_dump($people[0]['name']);
+unset($people[0]['name']);
+var_dump($people[0]);
+var_dump($people[0]['name']);
+$people[0]['name'] = 'BlaBla';
+var_dump($people[0]['name']);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+string(3) "Foo"
+string(6) "FooBar"
+string(9) "FooBarBaz"
+===ArrayOverloading===
+ArrayAccessReferenceProxy::__construct(0)
+object(ArrayAccessReferenceProxy)#1 (3) {
+ ["object:private"]=>
+ object(Peoples)#2 (1) {
+ ["person"]=>
+ &array(1) {
+ [0]=>
+ array(1) {
+ ["name"]=>
+ string(3) "Foo"
+ }
+ }
+ }
+ ["oarray:private"]=>
+ &array(1) {
+ [0]=>
+ array(1) {
+ ["name"]=>
+ string(3) "Foo"
+ }
+ }
+ ["element:private"]=>
+ int(0)
+}
+ArrayAccessReferenceProxy::__construct(0)
+ArrayAccessReferenceProxy::offsetGet(0, name)
+string(3) "Foo"
+ArrayAccessReferenceProxy::__construct(0)
+ArrayAccessReferenceProxy::offsetSet(0, name, FooBar)
+ArrayAccessReferenceProxy::__construct(0)
+ArrayAccessReferenceProxy::offsetGet(0, name)
+string(6) "FooBar"
+ArrayAccessReferenceProxy::__construct(0)
+ArrayAccessReferenceProxy::offsetSet(0, name, FooBarBar)
+ArrayAccessReferenceProxy::__construct(0)
+ArrayAccessReferenceProxy::offsetGet(0, name)
+string(9) "FooBarBar"
+ArrayAccessReferenceProxy::__construct(0)
+ArrayAccessReferenceProxy::offsetGet(0, name)
+ArrayAccessReferenceProxy::offsetSet(0, name, FooBarBarBaz)
+ArrayAccessReferenceProxy::__construct(0)
+ArrayAccessReferenceProxy::offsetGet(0, name)
+string(12) "FooBarBarBaz"
+ArrayAccessReferenceProxy::__construct(0)
+ArrayAccessReferenceProxy::offsetUnset(0, name)
+ArrayAccessReferenceProxy::__construct(0)
+object(ArrayAccessReferenceProxy)#1 (3) {
+ ["object:private"]=>
+ object(Peoples)#2 (1) {
+ ["person"]=>
+ &array(1) {
+ [0]=>
+ array(0) {
+ }
+ }
+ }
+ ["oarray:private"]=>
+ &array(1) {
+ [0]=>
+ array(0) {
+ }
+ }
+ ["element:private"]=>
+ int(0)
+}
+ArrayAccessReferenceProxy::__construct(0)
+ArrayAccessReferenceProxy::offsetGet(0, name)
+NULL
+ArrayAccessReferenceProxy::__construct(0)
+ArrayAccessReferenceProxy::offsetSet(0, name, BlaBla)
+ArrayAccessReferenceProxy::__construct(0)
+ArrayAccessReferenceProxy::offsetGet(0, name)
+string(6) "BlaBla"
+===DONE===
diff --git a/tests/classes/array_access_012.phpt b/tests/classes/array_access_012.phpt
new file mode 100755
index 000000000..d7503ec05
--- /dev/null
+++ b/tests/classes/array_access_012.phpt
@@ -0,0 +1,34 @@
+--TEST--
+ZE2 ArrayAccess cannot assign by reference
+--FILE--
+<?php
+
+class ArrayAccessImpl implements ArrayAccess {
+ private $data = array();
+
+ public function offsetUnset($index) {}
+
+ public function offsetSet($index, $value) {
+ $this->data[$index] = $value;
+ }
+
+ public function offsetGet($index) {
+ return $this->data[$index];
+ }
+
+ public function offsetExists($index) {
+ return isset($this->data[$index]);
+ }
+}
+
+$data = new ArrayAccessImpl();
+$test = 'some data';
+$data['element'] = NULL; // prevent notice
+$data['element'] = &$test;
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+
+Fatal error: Objects used as arrays in post/pre increment/decrement must return values by reference in %sarray_access_012.php on line %d
diff --git a/tests/classes/array_access_013.phpt b/tests/classes/array_access_013.phpt
new file mode 100755
index 000000000..c3dee3f5c
--- /dev/null
+++ b/tests/classes/array_access_013.phpt
@@ -0,0 +1,58 @@
+--TEST--
+ZE2 arrayAcces & exceptions
+--FILE--
+<?php
+
+class Test implements ArrayAccess
+{
+ public function offsetExists($offset) { throw new Exception(__METHOD__); return false; }
+ public function offsetGet($offset) { throw new Exception(__METHOD__); return $offset; }
+ public function offsetSet($offset, $data ) { throw new Exception(__METHOD__); }
+ public function offsetUnset($offset) { throw new Exception(__METHOD__); }
+}
+
+$t = new Test;
+
+try
+{
+ echo isset($t[0]);
+}
+catch(Exception $e)
+{
+ echo "Caught in " . $e->getMessage() . "()\n";
+}
+
+try
+{
+ echo $t[0];
+}
+catch(Exception $e)
+{
+ echo "Caught in " . $e->getMessage() . "()\n";
+}
+
+try
+{
+ $t[0] = 1;
+}
+catch(Exception $e)
+{
+ echo "Caught in " . $e->getMessage() . "()\n";
+}
+
+try
+{
+ unset($t[0]);
+}
+catch(Exception $e)
+{
+ echo "Caught in " . $e->getMessage() . "()\n";
+}
+?>
+===DONE===
+--EXPECT--
+Caught in Test::offsetExists()
+Caught in Test::offsetGet()
+Caught in Test::offsetSet()
+Caught in Test::offsetUnset()
+===DONE===
diff --git a/tests/classes/bug26737.phpt b/tests/classes/bug26737.phpt
index 39ac9b1ed..e190318ff 100644
--- a/tests/classes/bug26737.phpt
+++ b/tests/classes/bug26737.phpt
@@ -2,7 +2,6 @@
Bug #26737 (Protected and private variables are not saved on serialization when a user defined __sleep is used)
--FILE--
<?php
-error_reporting(E_ALL);
class foo
{
private $private = 'private';
diff --git a/tests/classes/bug29446.phpt b/tests/classes/bug29446.phpt
new file mode 100644
index 000000000..5e30e8e74
--- /dev/null
+++ b/tests/classes/bug29446.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Bug #29446 (ZE allows multiple declarations of the same class constant)
+--FILE--
+<?php
+
+class testClass {
+ const TEST_CONST = 'test';
+ const TEST_CONST = 'test1';
+
+ function testClass() {
+ echo self::TEST_CONST;
+ }
+}
+
+$test = new testClass;
+
+?>
+--EXPECTF--
+Fatal error: Cannot redefine class constant testClass::TEST_CONST in %s on line 5 \ No newline at end of file
diff --git a/tests/classes/ctor_name_clash.phpt b/tests/classes/ctor_name_clash.phpt
new file mode 100644
index 000000000..1a1d6fa51
--- /dev/null
+++ b/tests/classes/ctor_name_clash.phpt
@@ -0,0 +1,22 @@
+--TEST--
+ZE2 The child class can re-use the parent class name for a function member
+--FILE--
+<?php
+class base {
+ function base() {
+ echo __CLASS__."::".__FUNCTION__."\n";
+ }
+}
+
+class derived extends base {
+ function base() {
+ echo __CLASS__."::".__FUNCTION__."\n";
+ }
+}
+
+$obj = new derived();
+$obj->base();
+?>
+--EXPECTF--
+base::base
+derived::base
diff --git a/tests/classes/destructor_and_exceptions.phpt b/tests/classes/destructor_and_exceptions.phpt
new file mode 100755
index 000000000..947aa5bb9
--- /dev/null
+++ b/tests/classes/destructor_and_exceptions.phpt
@@ -0,0 +1,60 @@
+--TEST--
+ZE2 catch exception thrown in destructor
+--FILE--
+<?php
+
+class FailClass
+{
+ public $fatal;
+
+ function __destruct()
+ {
+ echo __METHOD__ . "\n";
+ throw new exception("FailClass");
+ echo "Done: " . __METHOD__ . "\n";
+ }
+}
+
+try
+{
+ $a = new FailClass;
+ unset($a);
+}
+catch(Exception $e)
+{
+ echo "Caught: " . $e->getMessage() . "\n";
+}
+
+class FatalException extends Exception
+{
+ function __construct($what)
+ {
+ echo __METHOD__ . "\n";
+ $o = new FailClass;
+ unset($o);
+ echo "Done: " . __METHOD__ . "\n";
+ }
+}
+
+try
+{
+ throw new FatalException("Damn");
+}
+catch(Exception $e)
+{
+ echo "Caught Exception: " . $e->getMessage() . "\n";
+}
+catch(FatalException $e)
+{
+ echo "Caught FatalException: " . $e->getMessage() . "\n";
+}
+
+?>
+===DONE===
+--EXPECTF--
+FailClass::__destruct
+Caught: FailClass
+FatalException::__construct
+FailClass::__destruct
+Caught Exception: FailClass
+===DONE===
diff --git a/tests/classes/interface_and_extends.phpt b/tests/classes/interface_and_extends.phpt
index 559b61125..f9040ae4a 100755
--- a/tests/classes/interface_and_extends.phpt
+++ b/tests/classes/interface_and_extends.phpt
@@ -23,4 +23,4 @@ $o->show();
?>
===DONE===
--EXPECTF--
-Fatal error: Class Tester cannot extend from interface Test in %sinterface_and_extends.php on line %d \ No newline at end of file
+Fatal error: Class Tester cannot extend from interface Test in %sinterface_and_extends.php on line %d
diff --git a/tests/classes/interface_doubled.phpt b/tests/classes/interface_doubled.phpt
index cf3b09974..e1dd31fd4 100644
--- a/tests/classes/interface_doubled.phpt
+++ b/tests/classes/interface_doubled.phpt
@@ -6,23 +6,23 @@ ZE2 An interface extends base interfaces
<?php
interface if_a {
- abstract function f_a();
+ function f_a();
}
interface if_b {
- abstract function f_b();
+ function f_b();
}
interface if_c extends if_a, if_b {
- abstract function f_c();
+ function f_c();
}
interface if_d extends if_a, if_b {
- abstract function f_d();
+ function f_d();
}
interface if_e {
- abstract function f_d();
+ function f_d();
}
interface if_f extends /*if_e,*/ if_a, if_b, if_c, if_d /*, if_e*/ {
diff --git a/tests/classes/interface_implemented.phpt b/tests/classes/interface_implemented.phpt
index 0f5e5cbe7..e33a4da00 100644
--- a/tests/classes/interface_implemented.phpt
+++ b/tests/classes/interface_implemented.phpt
@@ -6,11 +6,11 @@ ZE2 An interface is inherited
<?php
interface if_a {
- abstract function f_a();
+ function f_a();
}
interface if_b extends if_a {
- abstract function f_b();
+ function f_b();
}
class base {
diff --git a/tests/classes/interface_instantiate.phpt b/tests/classes/interface_instantiate.phpt
index d13bb9a6a..61c4e6b95 100644
--- a/tests/classes/interface_instantiate.phpt
+++ b/tests/classes/interface_instantiate.phpt
@@ -6,7 +6,7 @@ ZE2 An interface cannot be instantiated
<?php
interface if_a {
- abstract function f_a();
+ function f_a();
}
$t = new if_a();
diff --git a/tests/classes/interface_method_private.phpt b/tests/classes/interface_method_private.phpt
index f0f671b52..aa46a033a 100644
--- a/tests/classes/interface_method_private.phpt
+++ b/tests/classes/interface_method_private.phpt
@@ -12,4 +12,4 @@ interface if_a {
?>
--EXPECTF--
-Fatal error: Access type for interface method if_a::err() must be omitted or declared public in %s on line %d
+Fatal error: Access type for interface method if_a::err() must be omitted in %s on line %d
diff --git a/tests/classes/interfaces_003.phpt b/tests/classes/interfaces_003.phpt
new file mode 100755
index 000000000..46ae8290a
--- /dev/null
+++ b/tests/classes/interfaces_003.phpt
@@ -0,0 +1,33 @@
+--TEST--
+ZE2 interface and __construct
+--FILE--
+<?php
+
+class MyObject {}
+
+interface MyInterface
+{
+ public function __construct(Object $o);
+}
+
+class MyTestClass implements MyInterface
+{
+ public function __construct(Object $o)
+ {
+ }
+}
+
+$obj = new MyTestClass;
+
+class MyTestFail
+{
+ public function __construct()
+ {
+ }
+}
+
+?>
+===DONE===
+--EXPECTF--
+
+Fatal error: Argument 1 passed to MyTestClass::__construct() must be an object of class Object, called in %sinterfaces_003.php on line %d
diff --git a/tests/classes/iterators_001.phpt b/tests/classes/iterators_001.phpt
index b032cb8e9..02e361078 100755
--- a/tests/classes/iterators_001.phpt
+++ b/tests/classes/iterators_001.phpt
@@ -2,7 +2,6 @@
ZE2 iterators and foreach
--SKIPIF--
<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
-<?php if (!class_exists('Iterator')) print "skip interface iterator doesn't exist"; ?>
--FILE--
<?php
class c_iter implements Iterator {
@@ -110,17 +109,14 @@ c::getIterator
c_iter::__construct
c_iter::valid = true
c_iter::current
-c_iter::key
object:0
c_iter::next
c_iter::valid = true
c_iter::current
-c_iter::key
object:1
c_iter::next
c_iter::valid = true
c_iter::current
-c_iter::key
object:2
c_iter::next
c_iter::valid = false
@@ -129,66 +125,54 @@ c::getIterator
c_iter::__construct
c_iter::valid = true
c_iter::current
-c_iter::key
c::getIterator
c_iter::__construct
c_iter::valid = true
c_iter::current
-c_iter::key
double:0:0
c_iter::next
c_iter::valid = true
c_iter::current
-c_iter::key
double:0:1
c_iter::next
c_iter::valid = true
c_iter::current
-c_iter::key
double:0:2
c_iter::next
c_iter::valid = false
c_iter::next
c_iter::valid = true
c_iter::current
-c_iter::key
c::getIterator
c_iter::__construct
c_iter::valid = true
c_iter::current
-c_iter::key
double:1:0
c_iter::next
c_iter::valid = true
c_iter::current
-c_iter::key
double:1:1
c_iter::next
c_iter::valid = true
c_iter::current
-c_iter::key
double:1:2
c_iter::next
c_iter::valid = false
c_iter::next
c_iter::valid = true
c_iter::current
-c_iter::key
c::getIterator
c_iter::__construct
c_iter::valid = true
c_iter::current
-c_iter::key
double:2:0
c_iter::next
c_iter::valid = true
c_iter::current
-c_iter::key
double:2:1
c_iter::next
c_iter::valid = true
c_iter::current
-c_iter::key
double:2:2
c_iter::next
c_iter::valid = false
diff --git a/tests/classes/iterators_002.phpt b/tests/classes/iterators_002.phpt
index a8e564e84..4a58be032 100755
--- a/tests/classes/iterators_002.phpt
+++ b/tests/classes/iterators_002.phpt
@@ -2,7 +2,6 @@
ZE2 iterators and break
--SKIPIF--
<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
-<?php if (!class_exists('Iterator')) print "skip interface iterator doesn't exist"; ?>
--FILE--
<?php
class c_iter implements Iterator {
@@ -60,7 +59,7 @@ class c implements IteratorAggregate {
$t = new c();
-foreach($t as $v) {
+foreach($t as $k => $v) {
foreach($t as $w) {
echo "double:$v:$w\n";
break;
@@ -83,7 +82,6 @@ c_iter::__construct
c_iter::rewind
c_iter::valid = true
c_iter::current
-c_iter::key
double:0:0
c_iter::__destruct
c_iter::next
@@ -95,7 +93,6 @@ c_iter::__construct
c_iter::rewind
c_iter::valid = true
c_iter::current
-c_iter::key
double:1:0
c_iter::__destruct
c_iter::next
@@ -107,7 +104,6 @@ c_iter::__construct
c_iter::rewind
c_iter::valid = true
c_iter::current
-c_iter::key
double:2:0
c_iter::__destruct
c_iter::next
diff --git a/tests/classes/iterators_003.phpt b/tests/classes/iterators_003.phpt
index d79478263..42695db6b 100755
--- a/tests/classes/iterators_003.phpt
+++ b/tests/classes/iterators_003.phpt
@@ -2,7 +2,6 @@
ZE2 iterators and break
--SKIPIF--
<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
-<?php if (!class_exists('Iterator')) print "skip interface iterator doesn't exist"; ?>
--FILE--
<?php
class c_iter implements Iterator {
diff --git a/tests/classes/iterators_004.phpt b/tests/classes/iterators_004.phpt
index 6555a656a..3fe05276c 100755
--- a/tests/classes/iterators_004.phpt
+++ b/tests/classes/iterators_004.phpt
@@ -2,7 +2,6 @@
ZE2 iterators must be implemented
--SKIPIF--
<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
-<?php if (!class_exists('iterator')) print "skip interface iterator doesn't exist"; ?>
--FILE--
<?php
diff --git a/tests/classes/iterators_005.phpt b/tests/classes/iterators_005.phpt
index 6c1dadcc1..005deb92a 100755
--- a/tests/classes/iterators_005.phpt
+++ b/tests/classes/iterators_005.phpt
@@ -2,7 +2,6 @@
ZE2 iterators cannot implement Traversable alone
--SKIPIF--
<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
-<?php if (!class_exists('iterator')) print "skip interface iterator doesn't exist"; ?>
--FILE--
<?php
diff --git a/tests/classes/iterators_007.phpt b/tests/classes/iterators_007.phpt
new file mode 100755
index 000000000..f2638b31d
--- /dev/null
+++ b/tests/classes/iterators_007.phpt
@@ -0,0 +1,43 @@
+--TEST--
+ZE2 iterators and exceptions
+--FILE--
+<?php
+class Test implements Iterator
+{
+ public $arr = array(1, 2, 3);
+ public $x = 0;
+
+ public function rewind() { if ($this->x == 0) throw new Exception(__METHOD__); reset($this->arr); }
+ public function current() { if ($this->x == 1) throw new Exception(__METHOD__); return current($this->arr); }
+ public function key() { if ($this->x == 2) throw new Exception(__METHOD__); return key($this->arr); }
+ public function next() { if ($this->x == 3) throw new Exception(__METHOD__); next($this->arr); }
+ public function valid() { if ($this->x == 4) throw new Exception(__METHOD__); return (key($this->arr) !== NULL); }
+}
+
+$t = new Test();
+
+while($t->x < 5)
+{
+ try
+ {
+ foreach($t as $k => $v)
+ {
+ echo "Current\n";
+ }
+ }
+ catch(Exception $e)
+ {
+ echo "Caught in " . $e->getMessage() . "()\n";
+ }
+ $t->x++;
+}
+?>
+===DONE===
+--EXPECT--
+Caught in Test::rewind()
+Caught in Test::current()
+Caught in Test::key()
+Current
+Caught in Test::next()
+Caught in Test::valid()
+===DONE===
diff --git a/tests/classes/property_exists.phpt b/tests/classes/property_exists.phpt
new file mode 100755
index 000000000..fa712dfdb
--- /dev/null
+++ b/tests/classes/property_exists.phpt
@@ -0,0 +1,222 @@
+--TEST--
+ZE2 property_exists()
+--FILE--
+<?php
+
+class A
+{
+ public $a = 1;
+ protected $b = 2;
+ private $c = 3;
+
+ public $empty;
+ public $init = 1;
+
+ function __toString()
+ {
+ return 'obj(' . get_class($this) . ')';
+ }
+
+ static function test($oc, $props)
+ {
+ echo '===' . __CLASS__ . "===\n";
+ foreach($props as $p2) {
+ echo $oc, '::$' , $p2, "\n";
+ var_dump(property_exists($oc, $p2));
+ }
+ }
+}
+
+class B extends A
+{
+ private $c = 4;
+
+ static function test($oc, $props)
+ {
+ echo '===' . __CLASS__ . "===\n";
+ foreach($props as $p2) {
+ echo $oc, '::$' , $p2, "\n";
+ var_dump(property_exists($oc, $p2));
+ }
+ }
+}
+
+class C extends B
+{
+ private $d = 5;
+
+ static function test($oc, $props)
+ {
+ echo '===' . __CLASS__ . "===\n";
+ foreach($props as $p2) {
+ echo $oc, '::$' , $p2, "\n";
+ var_dump(property_exists($oc, $p2));
+ }
+ }
+}
+
+$oA = new A;
+$oA->e = 6;
+
+$oC = new C;
+
+$pc = array($oA, 'A', 'B', 'C', $oC);
+$pr = array('a', 'b', 'c', 'd', 'e');
+
+foreach($pc as $p1) {
+ if (is_object($p1)) {
+ $p1->test($p1, $pr);
+ } else {
+ $r = new ReflectionMethod($p1, 'test');
+ $r->invoke(NULL, $p1, $pr);
+ }
+ echo "===GLOBAL===\n";
+ foreach($pr as $p2) {
+ echo $p1, '::$' , $p2, "\n";
+ var_dump(property_exists($p1, $p2));
+ }
+}
+
+echo "===PROBLEMS===\n";
+var_dump(property_exists(NULL, 'empty'));
+var_dump(property_exists(25,'empty'));
+var_dump(property_exists('',''));
+var_dump(property_exists('A',''));
+var_dump(property_exists('A','123'));
+var_dump(property_exists('A','init'));
+var_dump(property_exists('A','empty'));
+var_dump(property_exists(new A, ''));
+var_dump(property_exists(new A, '123'));
+var_dump(property_exists(new A, 'init'));
+var_dump(property_exists(new A, 'empty'));
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+===A===
+obj(A)::$a
+bool(true)
+obj(A)::$b
+bool(true)
+obj(A)::$c
+bool(true)
+obj(A)::$d
+bool(false)
+obj(A)::$e
+bool(true)
+===GLOBAL===
+obj(A)::$a
+bool(true)
+obj(A)::$b
+bool(false)
+obj(A)::$c
+bool(false)
+obj(A)::$d
+bool(false)
+obj(A)::$e
+bool(true)
+===A===
+A::$a
+bool(true)
+A::$b
+bool(true)
+A::$c
+bool(true)
+A::$d
+bool(false)
+A::$e
+bool(false)
+===GLOBAL===
+A::$a
+bool(true)
+A::$b
+bool(false)
+A::$c
+bool(false)
+A::$d
+bool(false)
+A::$e
+bool(false)
+===B===
+B::$a
+bool(true)
+B::$b
+bool(true)
+B::$c
+bool(true)
+B::$d
+bool(false)
+B::$e
+bool(false)
+===GLOBAL===
+B::$a
+bool(true)
+B::$b
+bool(false)
+B::$c
+bool(false)
+B::$d
+bool(false)
+B::$e
+bool(false)
+===C===
+C::$a
+bool(true)
+C::$b
+bool(true)
+C::$c
+bool(false)
+C::$d
+bool(true)
+C::$e
+bool(false)
+===GLOBAL===
+C::$a
+bool(true)
+C::$b
+bool(false)
+C::$c
+bool(false)
+C::$d
+bool(false)
+C::$e
+bool(false)
+===C===
+obj(C)::$a
+bool(true)
+obj(C)::$b
+bool(true)
+obj(C)::$c
+bool(false)
+obj(C)::$d
+bool(true)
+obj(C)::$e
+bool(false)
+===GLOBAL===
+obj(C)::$a
+bool(true)
+obj(C)::$b
+bool(false)
+obj(C)::$c
+bool(false)
+obj(C)::$d
+bool(false)
+obj(C)::$e
+bool(false)
+===PROBLEMS===
+
+Warning: First parameter must either be an object or the name of an existing class in %sproperty_exists.php on line %d
+NULL
+
+Warning: First parameter must either be an object or the name of an existing class in %sproperty_exists.php on line %d
+NULL
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+bool(true)
+bool(true)
+===DONE===
diff --git a/tests/classes/serialize_001.phpt b/tests/classes/serialize_001.phpt
new file mode 100755
index 000000000..b7182aca6
--- /dev/null
+++ b/tests/classes/serialize_001.phpt
@@ -0,0 +1,79 @@
+--TEST--
+ZE2 Serializable
+--FILE--
+<?php
+
+class Test implements Serializable
+{
+ public $data;
+
+ function __construct($data)
+ {
+ echo __METHOD__ . "($data)\n";
+ $this->data = $data;
+ }
+
+ function serialize()
+ {
+ echo __METHOD__ . "({$this->data})\n";
+ return $this->data;
+ }
+
+ function unserialize($serialized)
+ {
+ echo __METHOD__ . "($serialized)\n";
+ $this->data = $serialized;
+ var_dump($this);
+ }
+}
+
+$tests = array('String', NULL, 42, false);
+
+foreach($tests as $data)
+{
+ try
+ {
+ echo "==========\n";
+ var_dump($data);
+ $ser = serialize(new Test($data));
+ var_dump(unserialize($ser));
+ }
+ catch(Exception $e)
+ {
+ echo 'Exception: ' . $e->getMessage() . "\n";
+ }
+}
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+==========
+string(6) "String"
+Test::__construct(String)
+Test::serialize(String)
+Test::unserialize(String)
+object(Test)#1 (1) {
+ ["data"]=>
+ string(6) "String"
+}
+object(Test)#1 (1) {
+ ["data"]=>
+ string(6) "String"
+}
+==========
+NULL
+Test::__construct()
+Test::serialize()
+NULL
+==========
+int(42)
+Test::__construct(42)
+Test::serialize(42)
+Exception: Test::serialize() must return a string or NULL
+==========
+bool(false)
+Test::__construct()
+Test::serialize()
+Exception: Test::serialize() must return a string or NULL
+===DONE===
diff --git a/tests/classes/type_hinting_001.phpt b/tests/classes/type_hinting_001.phpt
index d4042a496..82241298d 100644
--- a/tests/classes/type_hinting_001.phpt
+++ b/tests/classes/type_hinting_001.phpt
@@ -35,4 +35,4 @@ $a->b($b);
?>
--EXPECTF--
-Fatal error: Argument 1 must implement interface Foo in %s on line %d
+Fatal error: Argument 1 passed to FooBar::a() must implement interface Foo, called in %s on line 27 and defined in %s on line 12
diff --git a/tests/classes/type_hinting_003.phpt b/tests/classes/type_hinting_003.phpt
new file mode 100755
index 000000000..4a83dd419
--- /dev/null
+++ b/tests/classes/type_hinting_003.phpt
@@ -0,0 +1,60 @@
+--TEST--
+ZE2 class type hinting with arrays
+--FILE--
+<?php
+
+class Test
+{
+ static function f1(array $ar)
+ {
+ echo __METHOD__ . "()\n";
+ var_dump($ar);
+ }
+
+ static function f2(array $ar = NULL)
+ {
+ echo __METHOD__ . "()\n";
+ var_dump($ar);
+ }
+
+ static function f3(array $ar = array())
+ {
+ echo __METHOD__ . "()\n";
+ var_dump($ar);
+ }
+
+ static function f4(array $ar = array(25))
+ {
+ echo __METHOD__ . "()\n";
+ var_dump($ar);
+ }
+}
+
+Test::f1(array(42));
+Test::f2(NULL);
+Test::f2();
+Test::f3();
+Test::f4();
+Test::f1(1);
+
+?>
+--EXPECTF--
+Test::f1()
+array(1) {
+ [0]=>
+ int(42)
+}
+Test::f2()
+NULL
+Test::f2()
+NULL
+Test::f3()
+array(0) {
+}
+Test::f4()
+array(1) {
+ [0]=>
+ int(25)
+}
+
+Fatal error: Argument 1 passed to Test::f1() must be an array, called in %stype_hinting_003.php on line %d and defined in %stype_hinting_003.php on line %d
diff --git a/tests/lang/023.phpt b/tests/lang/023.phpt
index af9874410..331308d01 100644
--- a/tests/lang/023.phpt
+++ b/tests/lang/023.phpt
@@ -1,5 +1,7 @@
--TEST--
Regression test
+--INI--
+date.timezone=UTC
--FILE--
PHP Regression Test
diff --git a/tests/lang/040.phpt b/tests/lang/040.phpt
new file mode 100755
index 000000000..7f6eafdfc
--- /dev/null
+++ b/tests/lang/040.phpt
@@ -0,0 +1,15 @@
+--TEST--
+foreach into array
+--FILE--
+<?php
+$a = array(0,1);
+$b[0]=2;
+foreach($a as $b[0]) {
+ echo $b[0]."\n";
+}
+?>
+===DONE===
+--EXPECT--
+0
+1
+===DONE===
diff --git a/tests/lang/bug19943.phpt b/tests/lang/bug19943.phpt
index 3be703fb1..294a320bf 100644
--- a/tests/lang/bug19943.phpt
+++ b/tests/lang/bug19943.phpt
@@ -12,7 +12,7 @@ Bug #19943 (memleaks)
echo $ar[$count]." -- ".$ar[$count]['idx']."\n";
}
$a = "0123456789";
- $a[9] = $a{0};
+ $a[9] = $a[0];
var_dump($a);
?>
--EXPECT--
diff --git a/tests/lang/bug21800.phpt b/tests/lang/bug21800.phpt
deleted file mode 100644
index 72755e29a..000000000
--- a/tests/lang/bug21800.phpt
+++ /dev/null
@@ -1,19 +0,0 @@
---TEST--
-Bug #21800 (Segfault under interactive mode)
---SKIPIF--
-<?php (PHP_SAPI != 'cli') and print "SKIP PHP binary is not cli"; ?>
---FILE--
-<?php
-$exe = getenv('TEST_PHP_EXECUTABLE');
-$fh = popen("$exe -a", 'w');
-if ($fh !== false) {
- fwrite($fh, "<?php echo ':test:'; ?>\n\n");
- fclose($fh);
-} else {
- echo "failure\n";
-}
-?>
---EXPECT--
-Interactive mode enabled
-
-:test:
diff --git a/tests/lang/bug22231.phpt b/tests/lang/bug22231.phpt
index e0297adac..b6842c7cf 100644
--- a/tests/lang/bug22231.phpt
+++ b/tests/lang/bug22231.phpt
@@ -1,5 +1,7 @@
--TEST--
Bug #22231 (segfault when returning a global variable by reference)
+--INI--
+error_reporting=4095
--FILE--
<?php
class foo {
diff --git a/tests/lang/bug22367.phpt b/tests/lang/bug22367.phpt
index 7387043f3..364472b46 100644
--- a/tests/lang/bug22367.phpt
+++ b/tests/lang/bug22367.phpt
@@ -1,6 +1,7 @@
--TEST--
Bug #22367 (weird zval allocation problem)
--INI--
+error_reporting=4095
zend.ze1_compatibility_mode=1
--FILE--
<?php
@@ -73,7 +74,7 @@ bool(false)
Notice: Undefined offset: 5 in %sbug22367.php on line %d
-Strict Standards: Only variable references should be returned by reference in %sbug22367.php on line %d
+Notice: Only variable references should be returned by reference in %sbug22367.php on line %d
bool(false)
array(5) {
[0]=>
diff --git a/tests/lang/bug22510.phpt b/tests/lang/bug22510.phpt
index ab133b878..450bbb577 100644
--- a/tests/lang/bug22510.phpt
+++ b/tests/lang/bug22510.phpt
@@ -1,5 +1,7 @@
--TEST--
Bug #22510 (segfault among complex references)
+--INI--
+error_reporting=4095
--FILE--
<?php
class foo
@@ -94,10 +96,10 @@ ok1
bar::run1
foo::method1
-Strict Standards: Only variable references should be returned by reference in %s on line %d
+Notice: Only variable references should be returned by reference in %s on line %d
foo::method1
-Strict Standards: Only variable references should be returned by reference in %s on line %d
+Notice: Only variable references should be returned by reference in %s on line %d
foo::finalize
done!
ok2
@@ -116,9 +118,9 @@ ouch
bar::run1
foo::method1
-Strict Standards: Only variable references should be returned by reference in %s on line %d
+Notice: Only variable references should be returned by reference in %s on line %d
foo::method1
-Strict Standards: Only variable references should be returned by reference in %s on line %d
+Notice: Only variable references should be returned by reference in %s on line %d
foo::finalize
I'm alive!
diff --git a/tests/lang/bug22592.phpt b/tests/lang/bug22592.phpt
index e4e68b118..351ea08b9 100644
--- a/tests/lang/bug22592.phpt
+++ b/tests/lang/bug22592.phpt
@@ -13,26 +13,26 @@ $s = "string";
$result = "* *-*";
var_dump($result);
-$result{6} = '*';
+$result[6] = '*';
var_dump($result);
-$result{1} = $i;
+$result[1] = $i;
var_dump($result);
-$result{3} = $s;
+$result[3] = $s;
var_dump($result);
-$result{7} = 0;
+$result[7] = 0;
var_dump($result);
-$a = $result{1} = $result{3} = '-';
+$a = $result[1] = $result[3] = '-';
var_dump($result);
-$b = $result{3} = $result{5} = $s;
+$b = $result[3] = $result[5] = $s;
var_dump($result);
-$c = $result{0} = $result{2} = $result{4} = $i;
+$c = $result[0] = $result[2] = $result[4] = $i;
var_dump($result);
-$d = $result{6} = $result{8} = 5;
+$d = $result[6] = $result[8] = 5;
var_dump($result);
-$e = $result{1} = $result{6};
+$e = $result[1] = $result[6];
var_dump($result);
var_dump($a, $b, $c, $d, $e);
-$result{-1} = 'a';
+$result[-1] = 'a';
?>
--EXPECT--
string(5) "* *-*"
diff --git a/tests/lang/bug24658.phpt b/tests/lang/bug24658.phpt
index 399fd32ca..d9bf0f566 100644
--- a/tests/lang/bug24658.phpt
+++ b/tests/lang/bug24658.phpt
@@ -53,4 +53,4 @@ int(2)
object(foo)#%d (0) {
}
-Fatal error: Argument 1 must be an object of class foo in %s on line %d
+Fatal error: Argument 1 passed to typehint() must be an object of class foo in %s on line %d
diff --git a/tests/lang/bug26696.phpt b/tests/lang/bug26696.phpt
index e51978b3d..dae182d30 100644
--- a/tests/lang/bug26696.phpt
+++ b/tests/lang/bug26696.phpt
@@ -6,7 +6,7 @@ Bug #26696 (string index in a switch() crashes with multiple matches)
$str = 'asdd/?';
$len = strlen($str);
for ($i = 0; $i < $len; $i++) {
- switch ($str{$i}) {
+ switch ($str[$i]) {
case '?':
echo "OK\n";
break;
@@ -14,7 +14,7 @@ for ($i = 0; $i < $len; $i++) {
}
$str = '*';
-switch ($str{0}) {
+switch ($str[0]) {
case '*';
echo "OK\n";
break;
diff --git a/tests/lang/bug30085.phpt b/tests/lang/bug30085.phpt
deleted file mode 100644
index ad69c26fc..000000000
--- a/tests/lang/bug30085.phpt
+++ /dev/null
@@ -1,24 +0,0 @@
---TEST--
-Bug #30085 (When destructor terminates script)
---FILE--
-<?php
-class test { }
-
-class test2 {
-
- public $test;
-
- public function __construct() {
- $this->test = new test;
- }
-
- public function __destruct() {
- exit("Bye");
- }
-
-}
-
-$test = new test2;
-?>
---EXPECT--
-Bye \ No newline at end of file
diff --git a/tests/lang/bug30578.phpt b/tests/lang/bug30578.phpt
new file mode 100644
index 000000000..d8a8d2e54
--- /dev/null
+++ b/tests/lang/bug30578.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Bug #30578 (Output buffers flushed before calling __desctruct functions)
+--FILE--
+<?php
+
+error_reporting(E_ALL);
+
+class Example
+{
+ function __construct()
+ {
+ ob_start();
+ echo "This should be displayed last.\n";
+ }
+
+ function __destruct()
+ {
+ $buffered_data = ob_get_contents();
+ ob_end_clean();
+
+ echo "This should be displayed first.\n";
+ echo "Buffered data: $buffered_data";
+ }
+}
+
+$obj = new Example;
+
+?>
+--EXPECT--
+This should be displayed first.
+Buffered data: This should be displayed last.
diff --git a/tests/lang/bug32924.phpt b/tests/lang/bug32924.phpt
new file mode 100644
index 000000000..ddb8301e3
--- /dev/null
+++ b/tests/lang/bug32924.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Bug #32924 (prepend does not add file to included files)
+--INI--
+include_path=.
+auto_prepend_file=tests/lang/inc.inc
+--FILE--
+<?php
+include_once('tests/lang/inc.inc');
+require_once('tests/lang/inc.inc');
+?>
+END
+--EXPECT--
+Included!
+END
diff --git a/tests/lang/bug35176.phpt b/tests/lang/bug35176.phpt
new file mode 100755
index 000000000..1d1e80d96
--- /dev/null
+++ b/tests/lang/bug35176.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Bug #35176 (include()/require()/*_once() produce wrong error messages about main())
+--INI--
+html_errors=1
+error_reporting=4095
+--FILE--
+<?php
+require_once('nonexisiting.php');
+?>
+--EXPECTF--
+<br />
+<b>Warning</b>: require_once(nonexisiting.php) [<a href='function.require-once.html'>function.require-once.html</a>]: failed to open stream: No such file or directory in <b>%sbug35176.php</b> on line <b>2</b><br />
+<br />
+<b>Fatal error</b>: require_once() [<a href='function.require.html'>function.require.html</a>]: Failed opening required 'nonexisiting.php' (%s) in <b>%sbug35176.php</b> on line <b>2</b><br />
diff --git a/tests/lang/bug35382.phpt b/tests/lang/bug35382.phpt
new file mode 100755
index 000000000..1bd525ffb
--- /dev/null
+++ b/tests/lang/bug35382.phpt
@@ -0,0 +1,9 @@
+--TEST--
+Bug #35382 (Comment in end of file produces fatal error)
+--FILE--
+<?php
+eval("echo 'Hello'; // comment");
+echo " World";
+//last line comment
+--EXPECTF--
+Hello World
diff --git a/tests/lang/inc.inc b/tests/lang/inc.inc
new file mode 100644
index 000000000..64b30afe4
--- /dev/null
+++ b/tests/lang/inc.inc
@@ -0,0 +1,3 @@
+<?php
+echo "Included!\n";
+?>
diff --git a/tests/lang/type_hints_001.phpt b/tests/lang/type_hints_001.phpt
index 99b7fac0e..2b5f6c828 100644
--- a/tests/lang/type_hints_001.phpt
+++ b/tests/lang/type_hints_001.phpt
@@ -23,4 +23,4 @@ type_hint_foo($bar);
?>
--EXPECTF--
-Fatal error: Argument 1 must be an instance of Foo in %s on line %d
+Fatal error: Argument 1 passed to type_hint_foo() must be an instance of Foo, called in %s on line 16 and defined in %s on line 9
diff --git a/tests/reflection/006.phpt b/tests/reflection/006.phpt
new file mode 100755
index 000000000..89c438765
--- /dev/null
+++ b/tests/reflection/006.phpt
@@ -0,0 +1,103 @@
+--TEST--
+ReflectionClass::[gs]etStaticPropertyValue
+--FILE--
+<?php
+
+/* ReflectionClass cannot touch protected or private static properties */
+
+/* ReflectionClass cannot create or delete static properties */
+
+Class Test
+{
+ static public $pub = 'pub';
+ static protected $pro = 'pro';
+ static private $pri = 'pri';
+
+ static function testing()
+ {
+ $ref = new ReflectionClass('Test');
+
+ foreach(array('pub', 'pro', 'pri') as $name)
+ {
+ try
+ {
+ var_dump($ref->getStaticPropertyValue($name));
+ var_dump($ref->getStaticPropertyValue($name));
+ $ref->setStaticPropertyValue($name, 'updated');
+ var_dump($ref->getStaticPropertyValue($name));
+ }
+ catch(Exception $e)
+ {
+ echo "EXCEPTION\n";
+ }
+ }
+ }
+}
+
+Class TestDerived extends Test
+{
+// static public $pub = 'pub';
+// static protected $pro = 'pro';
+ static private $pri = 'pri';
+
+ static function testing()
+ {
+ $ref = new ReflectionClass('Test');
+
+ foreach(array('pub', 'pro', 'pri') as $name)
+ {
+ try
+ {
+ var_dump($ref->getStaticPropertyValue($name));
+ var_dump($ref->getStaticPropertyValue($name));
+ $ref->setStaticPropertyValue($name, 'updated');
+ var_dump($ref->getStaticPropertyValue($name));
+ }
+ catch(Exception $e)
+ {
+ echo "EXCEPTION\n";
+ }
+ }
+ }
+}
+
+$ref = new ReflectionClass('Test');
+
+foreach(array('pub', 'pro', 'pri') as $name)
+{
+ try
+ {
+ var_dump($ref->getStaticPropertyValue($name));
+ var_dump($ref->getStaticPropertyValue($name));
+ $ref->setStaticPropertyValue($name, 'updated');
+ var_dump($ref->getStaticPropertyValue($name));
+ }
+ catch(Exception $e)
+ {
+ echo "EXCEPTION\n";
+ }
+}
+
+Test::testing();
+TestDerived::testing();
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+string(3) "pub"
+string(3) "pub"
+string(7) "updated"
+EXCEPTION
+EXCEPTION
+string(7) "updated"
+string(7) "updated"
+string(7) "updated"
+EXCEPTION
+EXCEPTION
+string(7) "updated"
+string(7) "updated"
+string(7) "updated"
+EXCEPTION
+EXCEPTION
+===DONE===
diff --git a/tests/reflection/bug33389.phpt b/tests/reflection/bug33389.phpt
new file mode 100755
index 000000000..36f7079e2
--- /dev/null
+++ b/tests/reflection/bug33389.phpt
@@ -0,0 +1,97 @@
+--TEST--
+Bug #33389 (double free() when exporting a ReflectionClass)
+--FILE--
+<?php
+define ('foobar', 1);
+class Test {
+ function foo1($arg=foobar) {
+ }
+ function foo2($arg=null) {
+ }
+ function foo3($arg=false) {
+ }
+ function foo4($arg='foo') {
+ }
+ function foo5($arg=1) {
+ }
+ function bar($arg) {
+ }
+ function foo() {
+ }
+}
+Reflection::export(new ReflectionClass('Test'));
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Class [ <user> class Test ] {
+ @@ %sbug33389.php 3-18
+
+ - Constants [0] {
+ }
+
+ - Static properties [0] {
+ }
+
+ - Static methods [0] {
+ }
+
+ - Properties [0] {
+ }
+
+ - Methods [7] {
+ Method [ <user> public method foo1 ] {
+ @@ %sbug33389.php 4 - 5
+
+ - Parameters [1] {
+ Parameter #0 [ <optional> $arg = 1 ]
+ }
+ }
+
+ Method [ <user> public method foo2 ] {
+ @@ %sbug33389.php 6 - 7
+
+ - Parameters [1] {
+ Parameter #0 [ <optional> $arg = NULL ]
+ }
+ }
+
+ Method [ <user> public method foo3 ] {
+ @@ %sbug33389.php 8 - 9
+
+ - Parameters [1] {
+ Parameter #0 [ <optional> $arg = false ]
+ }
+ }
+
+ Method [ <user> public method foo4 ] {
+ @@ %sbug33389.php 10 - 11
+
+ - Parameters [1] {
+ Parameter #0 [ <optional> $arg = 'foo' ]
+ }
+ }
+
+ Method [ <user> public method foo5 ] {
+ @@ %sbug33389.php 12 - 13
+
+ - Parameters [1] {
+ Parameter #0 [ <optional> $arg = 1 ]
+ }
+ }
+
+ Method [ <user> public method bar ] {
+ @@ %sbug33389.php 14 - 15
+
+ - Parameters [1] {
+ Parameter #0 [ <required> $arg ]
+ }
+ }
+
+ Method [ <user> public method foo ] {
+ @@ %sbug33389.php 16 - 17
+ }
+ }
+}
+
+===DONE===
diff --git a/tests/reflection/exception.inc b/tests/reflection/exception.inc
index 8570b6b36..e40333996 100644
--- a/tests/reflection/exception.inc
+++ b/tests/reflection/exception.inc
@@ -1,5 +1,5 @@
<?php
-class reflectionException extends reflection_exception {
+class ReflectionExceptionEx extends ReflectionException {
function MyException($_errno, $_errmsg) {
$this->errno = $_errno;
$this->errmsg = $_errmsg;
diff --git a/tests/reflection/parameters_001.phpt b/tests/reflection/parameters_001.phpt
index a4c4126be..0879756ea 100755
--- a/tests/reflection/parameters_001.phpt
+++ b/tests/reflection/parameters_001.phpt
@@ -1,13 +1,5 @@
--TEST--
Check for parameter being optional
---SKIPIF--
-<?php
- class a { function b() {} }
- $a = new ReflectionMethod('a','b');
- if (!method_exists($a, 'getNumberOfRequiredParameters')) {
- exit("skip getNumberOfRequiredParameters is only in PHP 5.1+");
- }
-?>
--FILE--
<?php
diff --git a/tests/strings/001.phpt b/tests/strings/001.phpt
index ceca4351b..d5e2f6477 100644
--- a/tests/strings/001.phpt
+++ b/tests/strings/001.phpt
@@ -181,7 +181,10 @@ echo "Testing uniqid: ";
$str = "prefix";
$ui1 = uniqid($str);
$ui2 = uniqid($str);
-if (strlen($ui1) == strlen($ui2) && strlen($ui1) == 19 && $ui1 != $ui2) {
+
+$len = strncasecmp(PHP_OS, 'CYGWIN', 6) ? 19 : 29;
+
+if (strlen($ui1) == strlen($ui2) && strlen($ui1) == $len && $ui1 != $ui2) {
echo("passed\n");
} else {
echo("failed!\n");
diff --git a/tests/strings/bug22592.phpt b/tests/strings/bug22592.phpt
index cc5d030ca..6c8edee03 100755
--- a/tests/strings/bug22592.phpt
+++ b/tests/strings/bug22592.phpt
@@ -9,12 +9,12 @@ $t = $x[] = 'x';
var_dump($correct);
var_dump($wrong);
-$correct{1} = '*';
-$correct{3} = '*';
-$correct{5} = '*';
+$correct[1] = '*';
+$correct[3] = '*';
+$correct[5] = '*';
// This produces the
-$wrong{1} = $wrong{3} = $wrong{5} = '*';
+$wrong[1] = $wrong[3] = $wrong[5] = '*';
var_dump($correct);
var_dump($wrong);