Add some ZE2 bug tests

This commit is contained in:
Marcus Boerger 2003-06-01 18:35:29 +00:00
parent 070803a482
commit c3dd93fb4a
5 changed files with 170 additions and 0 deletions

38
Zend/tests/bug20240.phpt Executable file
View file

@ -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

26
Zend/tests/bug20242.phpt Executable file
View file

@ -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

36
Zend/tests/bug21478.phpt Executable file
View file

@ -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.

39
Zend/tests/bug21888.phpt Executable file
View file

@ -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

31
Zend/tests/bug22725.phpt Executable file
View file

@ -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.