summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2003-12-19 15:08:56 +0000
committerDmitry Stogov <dmitry@php.net>2003-12-19 15:08:56 +0000
commitdf76eba657a870d3a603f3c631997c1cf66e3891 (patch)
treeba9d862b0979662fb31f07cb63321434823413e4
parent0c126e1233ee35c92d0f58f20fc4b40478f0b55f (diff)
downloadphp-git-df76eba657a870d3a603f3c631997c1cf66e3891.tar.gz
New tests for memory leaks
-rw-r--r--tests/classes/assign_op_property_001.phpt31
-rw-r--r--tests/classes/incdec_property_001.phpt31
-rw-r--r--tests/classes/incdec_property_002.phpt31
-rw-r--r--tests/classes/incdec_property_003.phpt31
-rw-r--r--tests/classes/incdec_property_004.phpt31
5 files changed, 155 insertions, 0 deletions
diff --git a/tests/classes/assign_op_property_001.phpt b/tests/classes/assign_op_property_001.phpt
new file mode 100644
index 0000000000..54e519e8f6
--- /dev/null
+++ b/tests/classes/assign_op_property_001.phpt
@@ -0,0 +1,31 @@
+--TEST--
+ZE2 assign_op property of overloaded object
+--FILE--
+<?php
+
+class Test {
+ private $real_a = 2;
+
+ function __set($property, $value) {
+ if ($property = "a") {
+ $this->real_a = $value;
+ }
+ }
+
+ function __get($property) {
+ if ($property = "a") {
+ return $this->real_a;
+ }
+ }
+}
+
+$obj = new Test;
+var_dump($obj->a);
+$obj->a += 2;
+var_dump($obj->a);
+echo "---Done---\n";
+?>
+--EXPECT--
+int(2)
+int(4)
+---Done---
diff --git a/tests/classes/incdec_property_001.phpt b/tests/classes/incdec_property_001.phpt
new file mode 100644
index 0000000000..39bf06f65f
--- /dev/null
+++ b/tests/classes/incdec_property_001.phpt
@@ -0,0 +1,31 @@
+--TEST--
+ZE2 post increment/decrement property of overloaded object
+--FILE--
+<?php
+
+class Test {
+ private $real_a = 2;
+
+ function __set($property, $value) {
+ if ($property = "a") {
+ $this->real_a = $value;
+ }
+ }
+
+ function __get($property) {
+ if ($property = "a") {
+ return $this->real_a;
+ }
+ }
+}
+
+$obj = new Test;
+var_dump($obj->a);
+$obj->a++;
+var_dump($obj->a);
+echo "---Done---\n";
+?>
+--EXPECT--
+int(2)
+int(3)
+---Done---
diff --git a/tests/classes/incdec_property_002.phpt b/tests/classes/incdec_property_002.phpt
new file mode 100644
index 0000000000..fe08625ea8
--- /dev/null
+++ b/tests/classes/incdec_property_002.phpt
@@ -0,0 +1,31 @@
+--TEST--
+ZE2 post increment/decrement property of overloaded object with assignment
+--FILE--
+<?php
+
+class Test {
+ private $real_a = 2;
+
+ function __set($property, $value) {
+ if ($property = "a") {
+ $this->real_a = $value;
+ }
+ }
+
+ function __get($property) {
+ if ($property = "a") {
+ return $this->real_a;
+ }
+ }
+}
+
+$obj = new Test;
+var_dump($obj->a);
+$t1 = $obj->a++;
+var_dump($obj->a);
+echo "---Done---\n";
+?>
+--EXPECT--
+int(2)
+int(3)
+---Done---
diff --git a/tests/classes/incdec_property_003.phpt b/tests/classes/incdec_property_003.phpt
new file mode 100644
index 0000000000..d26277ab8d
--- /dev/null
+++ b/tests/classes/incdec_property_003.phpt
@@ -0,0 +1,31 @@
+--TEST--
+ZE2 pre increment/decrement property of overloaded object
+--FILE--
+<?php
+
+class Test {
+ private $real_a = 2;
+
+ function __set($property, $value) {
+ if ($property = "a") {
+ $this->real_a = $value;
+ }
+ }
+
+ function __get($property) {
+ if ($property = "a") {
+ return $this->real_a;
+ }
+ }
+}
+
+$obj = new Test;
+var_dump($obj->a);
+++$obj->a;
+var_dump($obj->a);
+echo "---Done---\n";
+?>
+--EXPECT--
+int(2)
+int(3)
+---Done---
diff --git a/tests/classes/incdec_property_004.phpt b/tests/classes/incdec_property_004.phpt
new file mode 100644
index 0000000000..5ccad190b8
--- /dev/null
+++ b/tests/classes/incdec_property_004.phpt
@@ -0,0 +1,31 @@
+--TEST--
+ZE2 pre increment/decrement property of overloaded object with assignment
+--FILE--
+<?php
+
+class Test {
+ private $real_a = 2;
+
+ function __set($property, $value) {
+ if ($property = "a") {
+ $this->real_a = $value;
+ }
+ }
+
+ function __get($property) {
+ if ($property = "a") {
+ return $this->real_a;
+ }
+ }
+}
+
+$obj = new Test;
+var_dump($obj->a);
+$t1 = ++$obj->a;
+var_dump($obj->a);
+echo "---Done---\n";
+?>
+--EXPECT--
+int(2)
+int(3)
+---Done---