diff options
author | Marcus Boerger <helly@php.net> | 2005-04-23 15:21:07 +0000 |
---|---|---|
committer | Marcus Boerger <helly@php.net> | 2005-04-23 15:21:07 +0000 |
commit | 3080d49ed41b39e5bee2c3503ed3176c44f02346 (patch) | |
tree | fc665e646ba0054311fed877cc835865c9b5d0a9 | |
parent | 965b70c0bd6379aaeae395a99e3d3e1d16b875fb (diff) | |
download | php-git-3080d49ed41b39e5bee2c3503ed3176c44f02346.tar.gz |
- Add new tests
-rwxr-xr-x | Zend/tests/bug29674.phpt | 41 | ||||
-rwxr-xr-x | Zend/tests/bug30161.phpt | 33 | ||||
-rwxr-xr-x | Zend/tests/bug30346.phpt | 24 | ||||
-rwxr-xr-x | ext/sqlite/tests/pdo/pdo_024.phpt | 21 | ||||
-rwxr-xr-x | tests/classes/__set__get_004.phpt | 39 |
5 files changed, 158 insertions, 0 deletions
diff --git a/Zend/tests/bug29674.phpt b/Zend/tests/bug29674.phpt new file mode 100755 index 0000000000..aef91f4061 --- /dev/null +++ b/Zend/tests/bug29674.phpt @@ -0,0 +1,41 @@ +--TEST-- +Bug #29674 (inherited method doesn't have access to private variables of the derived class) +--FILE-- +<?php + +class BaseClass +{ + private $private_base = "Base"; + + function printVars () + { + var_dump($this->private_base); + var_dump($this->private_child); + } +} + +class ChildClass extends BaseClass +{ + private $private_child = "Child"; +} + +echo "===BASE===\n"; +$obj = new BaseClass; +$obj->printVars(); + +echo "===CHILD===\n"; +$obj = new ChildClass; +$obj->printVars(); + +?> +===DONE=== +--EXPECTF-- +===BASE=== +string(4) "Base" + +Notice: Undefined property: BaseClass::$private_child in %sbug29674.php on line %d +NULL +===CHILD=== +string(4) "Base" + +Fatal error: Cannot access private property ChildClass::$private_child in %sbug29674.php on line %d diff --git a/Zend/tests/bug30161.phpt b/Zend/tests/bug30161.phpt new file mode 100755 index 0000000000..038a151e0e --- /dev/null +++ b/Zend/tests/bug30161.phpt @@ -0,0 +1,33 @@ +--TEST-- +Bug #30161 (Segmentation fault with exceptions) +--FILE-- +<?php +class FIIFO { + + public function __construct() { + throw new Exception; + } + +} + +class hariCow extends FIIFO { + + public function __construct() { + try { + parent::__construct(); + } catch(Exception $e) { + } + } + + public function __toString() { + return "Rusticus in asino sedet."; + } + +} + + +$db = new hariCow; + +echo $db; +?> +--EXPECT-- diff --git a/Zend/tests/bug30346.phpt b/Zend/tests/bug30346.phpt new file mode 100755 index 0000000000..a158d0c40b --- /dev/null +++ b/Zend/tests/bug30346.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug 30346 (arrayAcces & using $this) +--FILE-- +<?php + +class Test implements ArrayAccess +{ + public function __construct() { } + public function offsetExists( $offset ) { return false; } + public function offsetGet( $offset ) { return $offset; } + public function offsetSet( $offset, $data ) { } + public function offsetUnset( $offset ) { } +} + +$post = new Test; +$id = 'page'; +echo $post[$id.'_show']; +echo "\n"; + +?> +===DONE=== +--EXPECT-- +page_show +===DONE===
\ No newline at end of file diff --git a/ext/sqlite/tests/pdo/pdo_024.phpt b/ext/sqlite/tests/pdo/pdo_024.phpt new file mode 100755 index 0000000000..52a1686250 --- /dev/null +++ b/ext/sqlite/tests/pdo/pdo_024.phpt @@ -0,0 +1,21 @@ +--TEST-- +PDO_SQLite2: Bind does not convert NULL +--SKIPIF-- +<?php # vim:ft=php +require_once('skipif.inc'); ?> +--FILE-- +<?php + +require_once('connection.inc'); +require_once('prepare.inc'); + +require_once($PDO_TESTS . 'pdo_024.inc'); + +?> +===DONE=== +<?php exit(0); ?> +--EXPECTF-- +bind: success +bool(true) +NULL +===DONE=== diff --git a/tests/classes/__set__get_004.phpt b/tests/classes/__set__get_004.phpt new file mode 100755 index 0000000000..e3061da4f0 --- /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=== |