From c3dd93fb4acd6ec42ae850228ddd7dc7e47535cc Mon Sep 17 00:00:00 2001 From: Marcus Boerger Date: Sun, 1 Jun 2003 18:35:29 +0000 Subject: [PATCH] Add some ZE2 bug tests --- Zend/tests/bug20240.phpt | 38 ++++++++++++++++++++++++++++++++++++++ Zend/tests/bug20242.phpt | 26 ++++++++++++++++++++++++++ Zend/tests/bug21478.phpt | 36 ++++++++++++++++++++++++++++++++++++ Zend/tests/bug21888.phpt | 39 +++++++++++++++++++++++++++++++++++++++ Zend/tests/bug22725.phpt | 31 +++++++++++++++++++++++++++++++ 5 files changed, 170 insertions(+) create mode 100755 Zend/tests/bug20240.phpt create mode 100755 Zend/tests/bug20242.phpt create mode 100755 Zend/tests/bug21478.phpt create mode 100755 Zend/tests/bug21888.phpt create mode 100755 Zend/tests/bug22725.phpt diff --git a/Zend/tests/bug20240.phpt b/Zend/tests/bug20240.phpt new file mode 100755 index 0000000000..ccc0e078d4 --- /dev/null +++ b/Zend/tests/bug20240.phpt @@ -0,0 +1,38 @@ +--TEST-- +Bug #20240 order of destructor calls +--SKIPIF-- + +--FILE-- +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 index 0000000000..5ca17a2f55 --- /dev/null +++ b/Zend/tests/bug20242.phpt @@ -0,0 +1,26 @@ +--TEST-- +Bug #20242 Method call in front of class definition) +--SKIPIF-- +=')) die('skip ZendEngine 2 does not support this'); ?> +--FILE-- +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 index 0000000000..e7918ed2e4 --- /dev/null +++ b/Zend/tests/bug21478.phpt @@ -0,0 +1,36 @@ +--TEST-- +Bug #21478 Zend/zend_alloc.c :: shutdown_memory_manager produces segfault +--SKIPIF-- + +--FILE-- +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 index 0000000000..8485cbef18 --- /dev/null +++ b/Zend/tests/bug21888.phpt @@ -0,0 +1,39 @@ +--TEST-- +Bug #21888 protected property and protected method of the same name +--SKIPIF-- + +--FILE-- +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 index 0000000000..aecb0ce486 --- /dev/null +++ b/Zend/tests/bug22725.phpt @@ -0,0 +1,31 @@ +--TEST-- +A derived class can call a parent's protected method that calls a private method +--SKIPIF-- + +--FILE-- +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. -- 2.40.0