]> granicus.if.org Git - php/commitdiff
Add some ZE2 bug tests
authorMarcus Boerger <helly@php.net>
Sun, 1 Jun 2003 18:35:29 +0000 (18:35 +0000)
committerMarcus Boerger <helly@php.net>
Sun, 1 Jun 2003 18:35:29 +0000 (18:35 +0000)
Zend/tests/bug20240.phpt [new file with mode: 0755]
Zend/tests/bug20242.phpt [new file with mode: 0755]
Zend/tests/bug21478.phpt [new file with mode: 0755]
Zend/tests/bug21888.phpt [new file with mode: 0755]
Zend/tests/bug22725.phpt [new file with mode: 0755]

diff --git a/Zend/tests/bug20240.phpt b/Zend/tests/bug20240.phpt
new file mode 100755 (executable)
index 0000000..ccc0e07
--- /dev/null
@@ -0,0 +1,38 @@
+--TEST--
+Bug #20240 order of destructor calls
+--SKIPIF--
+<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 is needed'); ?>
+--FILE--
+<?php
+
+class test
+{
+    var $member;
+
+    function test() {
+        $this->member = 1;
+        register_shutdown_function(array($this, 'destructor'));
+    }
+
+    function destructor() {
+        print $this->member;
+    }
+
+    function add() {
+        $this->member += 1;
+        print $this->member."\n";
+    }
+}
+
+$t = new test();
+
+$t->add();
+$t->add();
+
+echo "Done\n";
+?>
+--EXPECT--
+2
+3
+Done
+3
diff --git a/Zend/tests/bug20242.phpt b/Zend/tests/bug20242.phpt
new file mode 100755 (executable)
index 0000000..5ca17a2
--- /dev/null
@@ -0,0 +1,26 @@
+--TEST--
+Bug #20242 Method call in front of class definition)
+--SKIPIF--
+<?php if (version_compare(zend_version(), '2.0.0-dev', '>=')) die('skip ZendEngine 2 does not support this'); ?>
+--FILE--
+<?php
+
+// THIS IS A WON'T FIX FOR ZE2
+
+test::show_static();
+
+$t = new test;
+$t->show_method();
+
+class test {
+       static function show_static() {
+               echo "static\n";
+       }
+       function show_method() {
+               echo "method\n";
+       }
+}
+?>
+--EXPECT--
+static
+method
diff --git a/Zend/tests/bug21478.phpt b/Zend/tests/bug21478.phpt
new file mode 100755 (executable)
index 0000000..e7918ed
--- /dev/null
@@ -0,0 +1,36 @@
+--TEST--
+Bug #21478 Zend/zend_alloc.c :: shutdown_memory_manager produces segfault 
+--SKIPIF--
+<?php 
+       if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 is needed'); 
+       if (!function_exists('stream_filter_register') die('skip stream_filter_register() not available');
+?>
+--FILE--
+<?php
+class debugfilter extends php_user_filter {
+  function filter($in, $out, &$consumed, $closing) {
+    while ($bucket = stream_bucket_make_writeable($in)) {
+      $bucket->data = strtoupper($bucket->data);
+      stream_bucket_append($out, $bucket);
+      $consumed += strlen($bucket->data);
+    }
+    return PSFS_PASS_ON;
+  }
+}
+
+stream_filter_register("myfilter","debugfilter");
+
+$fp = fopen(dirname(__FILE__)."test.txt","w");
+stream_filter_append($fp, "myfilter");
+stream_filter_append($fp, "myfilter");
+stream_filter_append($fp, "myfilter");
+fwrite($fp, "This is a test.\n");
+print "Done.\n";
+fclose($fp);
+// Uncommenting the following 'print' line causes the segfault to stop occuring
+// print "2\n";  
+readfile(dirname(__FILE__)."test.txt");
+?>
+--EXPECT--
+Done.
+THIS IS A TEST.
diff --git a/Zend/tests/bug21888.phpt b/Zend/tests/bug21888.phpt
new file mode 100755 (executable)
index 0000000..8485cbe
--- /dev/null
@@ -0,0 +1,39 @@
+--TEST--
+Bug #21888 protected property and protected method of the same name 
+--SKIPIF--
+<?php 
+       if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 is needed'); 
+?>
+--FILE--
+<?php
+class mom {
+
+  protected $prot = "protected property\n";
+
+  protected function prot() {
+    print "protected method\n";
+  } 
+}
+
+class child extends mom {
+  
+  public function callMom() {
+    $this->prot();
+  }
+  
+  public function viewMom() {
+    print $this->prot;
+  }
+  
+}
+
+$c = new child();
+$c->callMom();
+$c->viewMom();
+?>
+--EXPECT--
+protected method
+protected property
+--EXPECT--
+protected method
+protected property
diff --git a/Zend/tests/bug22725.phpt b/Zend/tests/bug22725.phpt
new file mode 100755 (executable)
index 0000000..aecb0ce
--- /dev/null
@@ -0,0 +1,31 @@
+--TEST--
+A derived class can call a parent's protected method that calls a private method
+--SKIPIF--
+<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
+--FILE--
+<?php
+class Foo {
+    private function aPrivateMethod() {
+        echo "Foo::aPrivateMethod() called.\n";
+    }
+
+    protected function aProtectedMethod() {
+        echo "Foo::aProtectedMethod() called.\n";
+        $this->aPrivateMethod();
+    }
+}
+
+class Bar extends Foo {
+    public function aPublicMethod() {
+        echo "Bar::aPublicMethod() called.\n";
+        $this->aProtectedMethod();
+    }
+}
+
+$o = new Bar;
+$o->aPublicMethod();
+?>
+--EXPECT--
+Bar::aPublicMethod() called.
+Foo::aProtectedMethod() called.
+Foo::aPrivateMethod() called.