diff options
Diffstat (limited to 'Zend/tests')
74 files changed, 249 insertions, 331 deletions
diff --git a/Zend/tests/019.phpt b/Zend/tests/019.phpt index 0548a38f88..a14a3aead6 100644 --- a/Zend/tests/019.phpt +++ b/Zend/tests/019.phpt @@ -149,7 +149,7 @@ foreach ($array_variables as $array_var) { var_dump( empty($array_var) ); // expected: bool(true) } -echo "\n*** Testing unset(), emtpy() & isset() with resource variables ***\n"; +echo "\n*** Testing unset(), empty() & isset() with resource variables ***\n"; $fp = fopen(__FILE__, "r"); $dfp = opendir( dirname(__FILE__) ); $resources = array ( @@ -1184,7 +1184,7 @@ bool(false) bool(false) bool(true) -*** Testing unset(), emtpy() & isset() with resource variables *** +*** Testing unset(), empty() & isset() with resource variables *** -- Iteration 1 -- resource(%d) of type (stream) bool(true) diff --git a/Zend/tests/67468.phpt b/Zend/tests/67468.phpt index 767217644a..691acd90db 100644 --- a/Zend/tests/67468.phpt +++ b/Zend/tests/67468.phpt @@ -1,7 +1,5 @@ --TEST-- Bug #67468 (Segfault in highlight_file()/highlight_string()) ---SKIPIF-- -<?php if(!function_exists("leak")) print "skip only for debug builds"; ?> --FILE-- <?php highlight_string("<?php __CLASS__;", true); diff --git a/Zend/tests/assign_ref_error_var_handling.phpt b/Zend/tests/assign_ref_error_var_handling.phpt index ad01663131..5ecb577ba7 100644 --- a/Zend/tests/assign_ref_error_var_handling.phpt +++ b/Zend/tests/assign_ref_error_var_handling.phpt @@ -1,5 +1,5 @@ --TEST-- -If the LHS of ref-assign ERRORs, that takes precendence over the "only variables" notice +If the LHS of ref-assign ERRORs, that takes precedence over the "only variables" notice --FILE-- <?php diff --git a/Zend/tests/assign_to_obj_001.phpt b/Zend/tests/assign_to_obj_001.phpt index 4b3cd31b92..37b6c594d0 100644 --- a/Zend/tests/assign_to_obj_001.phpt +++ b/Zend/tests/assign_to_obj_001.phpt @@ -1,5 +1,5 @@ --TEST-- -assgin to object leaks with ref +assign to object leaks with ref --FILE-- <?php function &a($i) { diff --git a/Zend/tests/bug26698.phpt b/Zend/tests/bug26698.phpt index a4d6ad13f8..8fbf551b6b 100644 --- a/Zend/tests/bug26698.phpt +++ b/Zend/tests/bug26698.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #26698 (Thrown exceptions while evaluting argument to pass as parameter crash PHP) +Bug #26698 (Thrown exceptions while evaluating argument to pass as parameter crash PHP) --FILE-- <?php diff --git a/Zend/tests/bug32674.phpt b/Zend/tests/bug32674.phpt index 771270f93b..0e08fa72dd 100644 --- a/Zend/tests/bug32674.phpt +++ b/Zend/tests/bug32674.phpt @@ -34,7 +34,7 @@ class collection implements Iterator { } public function valid() { - throw new Exception('shit happend'); + throw new Exception('shit happened'); return ($this->current() !== false); } diff --git a/Zend/tests/bug35017.phpt b/Zend/tests/bug35017.phpt index 0a89d23aa1..3cd28a3755 100644 --- a/Zend/tests/bug35017.phpt +++ b/Zend/tests/bug35017.phpt @@ -11,11 +11,11 @@ try { } echo "?\n"; } catch(Exception $e) { - echo "This Exception should be catched\n"; + echo "This Exception should be caught\n"; } function errorHandler($errno, $errstr, $errfile, $errline, $vars) { throw new Exception('Some Exception'); } ?> --EXPECT-- -This Exception should be catched +This Exception should be caught diff --git a/Zend/tests/bug35437.phpt b/Zend/tests/bug35437.phpt index 73222a9f23..4f61e4fbfd 100644 --- a/Zend/tests/bug35437.phpt +++ b/Zend/tests/bug35437.phpt @@ -20,8 +20,8 @@ class TestClass try { TestClass::testMethod(); } catch (Exception $e) { - echo "Catched: ".$e->getMessage()."\n"; + echo "Caught: ".$e->getMessage()."\n"; } ?> --EXPECT-- -Catched: Error occuried: Non-static method TestClass::testMethod() should not be called statically +Caught: Error occuried: Non-static method TestClass::testMethod() should not be called statically diff --git a/Zend/tests/bug38461.phpt b/Zend/tests/bug38461.phpt index 281d999019..3dfa89c055 100644 --- a/Zend/tests/bug38461.phpt +++ b/Zend/tests/bug38461.phpt @@ -21,5 +21,9 @@ $op->x = 'test'; echo "Done\n"; ?> ---EXPECT-- -Done +--EXPECTF-- +Fatal error: Uncaught Error: Cannot access private property ExtOperation::$x in %s:%d +Stack trace: +#0 %s(%d): Operation->__set('x', 'test') +#1 {main} + thrown in %s on line %d diff --git a/Zend/tests/bug39542.phpt b/Zend/tests/bug39542.phpt index 2008fe140a..1409c4181c 100644 --- a/Zend/tests/bug39542.phpt +++ b/Zend/tests/bug39542.phpt @@ -11,7 +11,7 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { } spl_autoload_register(function ($class) { - if (!require_once($class.'.php')) { + if (!require_once($class.'.inc')) { error_log('Error: Autoload class: '.$class.' not found!'); } }); diff --git a/Zend/tests/bug39542/bug39542.php b/Zend/tests/bug39542/bug39542.inc index 13b3b3eaf4..13b3b3eaf4 100755..100644 --- a/Zend/tests/bug39542/bug39542.php +++ b/Zend/tests/bug39542/bug39542.inc diff --git a/Zend/tests/bug44660.phpt b/Zend/tests/bug44660.phpt index 002744ce64..980c2274cd 100644 --- a/Zend/tests/bug44660.phpt +++ b/Zend/tests/bug44660.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #44660 (Indexed and reference assignment to propery of non-object don't trigger warning) +Bug #44660 (Indexed and reference assignment to property of non-object don't trigger warning) --FILE-- <?php $s = "hello"; diff --git a/Zend/tests/bug46665.phpt b/Zend/tests/bug46665.phpt index 29491dc26c..d8de8159a5 100644 --- a/Zend/tests/bug46665.phpt +++ b/Zend/tests/bug46665.phpt @@ -12,5 +12,5 @@ $baz = '\\Foo\\Bar\\Baz'; new $baz(); ?> ---EXPECTF-- +--EXPECT-- string(11) "Foo\Bar\Baz" diff --git a/Zend/tests/bug48248.phpt b/Zend/tests/bug48248.phpt index 9cdb7c1a00..16fb3273f2 100644 --- a/Zend/tests/bug48248.phpt +++ b/Zend/tests/bug48248.phpt @@ -21,7 +21,8 @@ var_dump($b->test); ?> --EXPECTF-- -Notice: Undefined property: B::$test in %s on line %d - -Notice: Only variable references should be returned by reference in %s on line %d -NULL +Fatal error: Uncaught Error: Cannot access private property B::$test in %s:%d +Stack trace: +#0 %s(%d): A->__get('test') +#1 {main} + thrown in %s on line %d diff --git a/Zend/tests/bug51791.phpt b/Zend/tests/bug51791.phpt index b6ced4bccd..0b92fa8c62 100644 --- a/Zend/tests/bug51791.phpt +++ b/Zend/tests/bug51791.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #51791 (constant() failed to check undefined constant and php interpreter stoped) +Bug #51791 (constant() failed to check undefined constant and php interpreter stopped) --FILE-- <?php diff --git a/Zend/tests/bug61165.phpt b/Zend/tests/bug61165.phpt index 478fa00a0f..900a7a8d2b 100644 --- a/Zend/tests/bug61165.phpt +++ b/Zend/tests/bug61165.phpt @@ -10,7 +10,7 @@ class T { public function __toString() { global $handler; $handler = $this; - $this->_this = $this; // <-- uncoment this + $this->_this = $this; // <-- uncomment this return 'A'; } } diff --git a/Zend/tests/bug63635.phpt b/Zend/tests/bug63635.phpt index 6f6fc6a44f..a72d3dd31d 100644 --- a/Zend/tests/bug63635.phpt +++ b/Zend/tests/bug63635.phpt @@ -4,17 +4,17 @@ Bug #63635 (Segfault in gc_collect_cycles) <?php class Node { public $parent = NULL; - public $childs = array(); + public $children = array(); function __construct(Node $parent=NULL) { if ($parent) { - $parent->childs[] = $this; + $parent->children[] = $this; } - $this->childs[] = $this; + $this->children[] = $this; } function __destruct() { - $this->childs = NULL; + $this->children = NULL; } } diff --git a/Zend/tests/bug65784.phpt b/Zend/tests/bug65784.phpt index 663ea95761..43369e2d60 100644 --- a/Zend/tests/bug65784.phpt +++ b/Zend/tests/bug65784.phpt @@ -8,7 +8,7 @@ function foo1() { return true; } finally { try { - throw new Exception("catched"); + throw new Exception("caught"); } catch (Exception $e) { } } @@ -25,11 +25,11 @@ try { function foo2() { try { try { - throw new Exception("catched"); + throw new Exception("caught"); return true; } finally { try { - throw new Exception("catched"); + throw new Exception("caught"); } catch (Exception $e) { } } @@ -42,7 +42,7 @@ var_dump($foo); function foo3() { try { - throw new Exception("not catched"); + throw new Exception("not caught"); return true; } finally { try { @@ -57,7 +57,7 @@ $bar = foo3(); string(9) "not catch" NULL -Fatal error: Uncaught Exception: not catched in %sbug65784.php:42 +Fatal error: Uncaught Exception: not caught in %sbug65784.php:42 Stack trace: #0 %sbug65784.php(52): foo3() #1 {main} diff --git a/Zend/tests/bug67436/a.php b/Zend/tests/bug67436/a.inc index c560c2db7d..c560c2db7d 100644 --- a/Zend/tests/bug67436/a.php +++ b/Zend/tests/bug67436/a.inc diff --git a/Zend/tests/bug67436/b.php b/Zend/tests/bug67436/b.inc index 793a1394d6..793a1394d6 100644 --- a/Zend/tests/bug67436/b.php +++ b/Zend/tests/bug67436/b.inc diff --git a/Zend/tests/bug67436/bug67436.phpt b/Zend/tests/bug67436/bug67436.phpt index 8a6b3f8027..2bd06a0745 100644 --- a/Zend/tests/bug67436/bug67436.phpt +++ b/Zend/tests/bug67436/bug67436.phpt @@ -9,7 +9,7 @@ error_reporting=-1 spl_autoload_register(function($classname) { if (in_array($classname, array('a','b','c'))) { - require_once __DIR__ . "/{$classname}.php"; + require_once __DIR__ . "/{$classname}.inc"; } }); diff --git a/Zend/tests/bug67436/bug67436_nohandler.phpt b/Zend/tests/bug67436/bug67436_nohandler.phpt index 232110797a..088761e00b 100644 --- a/Zend/tests/bug67436/bug67436_nohandler.phpt +++ b/Zend/tests/bug67436/bug67436_nohandler.phpt @@ -5,7 +5,7 @@ bug67436: E_STRICT instead of custom error handler spl_autoload_register(function($classname) { if (in_array($classname, array('a','b','c'))) { - require_once __DIR__ . "/{$classname}.php"; + require_once __DIR__ . "/{$classname}.inc"; } }); @@ -15,6 +15,6 @@ $b = new b(); $b->test(); --EXPECTF-- -Warning: Declaration of b::test() should be compatible with a::test($arg = c::TESTCONSTANT) in %s%ebug67436%eb.php on line %d +Warning: Declaration of b::test() should be compatible with a::test($arg = c::TESTCONSTANT) in %s%ebug67436%eb.inc on line %d b::test() a::test(c::TESTCONSTANT) diff --git a/Zend/tests/bug67436/c.php b/Zend/tests/bug67436/c.inc index 47c848bfa0..47c848bfa0 100644 --- a/Zend/tests/bug67436/c.php +++ b/Zend/tests/bug67436/c.inc diff --git a/Zend/tests/bug69892.phpt b/Zend/tests/bug69892.phpt index d14f85fa52..f638044935 100644 --- a/Zend/tests/bug69892.phpt +++ b/Zend/tests/bug69892.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #69892: Different arrays compare indentical due to integer key truncation +Bug #69892: Different arrays compare identical due to integer key truncation --SKIPIF-- <?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platforms only"); ?> --FILE-- diff --git a/Zend/tests/bug70012.phpt b/Zend/tests/bug70012.phpt index 5337649d2d..9e532218a9 100644 --- a/Zend/tests/bug70012.phpt +++ b/Zend/tests/bug70012.phpt @@ -15,7 +15,7 @@ try { echo " Inner finally\n"; } } - echo "Outer shouldnt get here\n"; + echo "Outer shouldn't get here\n"; } catch (Exception $e) { echo "Outer catch\n"; } finally { diff --git a/Zend/tests/bug70873.phpt b/Zend/tests/bug70873.phpt index 3edb7eac43..aecc0e879b 100644 --- a/Zend/tests/bug70873.phpt +++ b/Zend/tests/bug70873.phpt @@ -27,7 +27,7 @@ $b = new C; $b->bar(); ?> --EXPECTF-- -Fatal error: Uncaught Error: Cannot access property B::$x in %sbug70873.php:%d +Fatal error: Uncaught Error: Cannot access private property B::$x in %sbug70873.php:%d Stack trace: #0 %sbug70873.php(%d): B->bar() #1 {main} diff --git a/Zend/tests/bug75420.phpt b/Zend/tests/bug75420.phpt index 5528ad301b..05ef892879 100644 --- a/Zend/tests/bug75420.phpt +++ b/Zend/tests/bug75420.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #75420 (Crash when modifing property name in __isset for BP_VAR_IS) +Bug #75420 (Crash when modifying property name in __isset for BP_VAR_IS) --FILE-- <?php diff --git a/Zend/tests/bug76860.phpt b/Zend/tests/bug76860.phpt new file mode 100644 index 0000000000..046edba7f2 --- /dev/null +++ b/Zend/tests/bug76860.phpt @@ -0,0 +1,31 @@ +--TEST-- +Bug #76860 (Missed "Accessing static property as non static" warning) +--FILE-- +<?php +class A { + private static $a = "a"; + protected static $b = "b"; + public static $c = "c"; + public function __construct() { + var_dump($this->a, $this->b, $this->c); + } +} +class B extends A { +} +new B; +?> +--EXPECTF-- +Notice: Accessing static property B::$a as non static in %sbug76860.php on line 7 + +Notice: Undefined property: B::$a in %sbug76860.php on line 7 + +Notice: Accessing static property B::$b as non static in %sbug76860.php on line 7 + +Notice: Undefined property: B::$b in %sbug76860.php on line 7 + +Notice: Accessing static property B::$c as non static in %sbug76860.php on line 7 + +Notice: Undefined property: B::$c in %sbug76860.php on line 7 +NULL +NULL +NULL diff --git a/Zend/tests/bug76860_2.phpt b/Zend/tests/bug76860_2.phpt new file mode 100644 index 0000000000..bc92702fc1 --- /dev/null +++ b/Zend/tests/bug76860_2.phpt @@ -0,0 +1,34 @@ +--TEST-- +Bug #76860 (Missed "Accessing static property as non static" warning) +--FILE-- +<?php +class A { + private static $a = "a"; + private static $b = "b"; + private static $c = "c"; + public function __construct() { + var_dump($this->a, $this->b, $this->c); + } +} +class B extends A { + private static $a = "a1"; + protected static $b = "b1"; + public static $c = "c1"; +} +new B; +?> +--EXPECTF-- +Notice: Accessing static property B::$a as non static in %sbug76860_2.php on line 7 + +Notice: Undefined property: B::$a in %sbug76860_2.php on line 7 + +Notice: Accessing static property B::$b as non static in %sbug76860_2.php on line 7 + +Notice: Undefined property: B::$b in %sbug76860_2.php on line 7 + +Notice: Accessing static property B::$c as non static in %sbug76860_2.php on line 7 + +Notice: Undefined property: B::$c in %sbug76860_2.php on line 7 +NULL +NULL +NULL diff --git a/Zend/tests/closure_061.phpt b/Zend/tests/closure_061.phpt index 1aa579a409..f01e393570 100644 --- a/Zend/tests/closure_061.phpt +++ b/Zend/tests/closure_061.phpt @@ -175,6 +175,8 @@ Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure ------------------- bindTo(null, Cls::class): +Unbinding $this of a method is deprecated + Success! bindTo(new Cls, Cls::class): diff --git a/Zend/tests/constants/fixtures/folder1/fixture.inc b/Zend/tests/constants/fixtures/folder1/fixture.inc index 3406c998ac..3406c998ac 100755..100644 --- a/Zend/tests/constants/fixtures/folder1/fixture.inc +++ b/Zend/tests/constants/fixtures/folder1/fixture.inc diff --git a/Zend/tests/constants/fixtures/folder1/subfolder1/fixture.inc b/Zend/tests/constants/fixtures/folder1/subfolder1/fixture.inc index 86e6859363..86e6859363 100755..100644 --- a/Zend/tests/constants/fixtures/folder1/subfolder1/fixture.inc +++ b/Zend/tests/constants/fixtures/folder1/subfolder1/fixture.inc diff --git a/Zend/tests/constants/fixtures/folder1/subfolder2/fixture.inc b/Zend/tests/constants/fixtures/folder1/subfolder2/fixture.inc index 86e6859363..86e6859363 100755..100644 --- a/Zend/tests/constants/fixtures/folder1/subfolder2/fixture.inc +++ b/Zend/tests/constants/fixtures/folder1/subfolder2/fixture.inc diff --git a/Zend/tests/constants/fixtures/folder1/subfolder3/fixture.inc b/Zend/tests/constants/fixtures/folder1/subfolder3/fixture.inc index 86e6859363..86e6859363 100755..100644 --- a/Zend/tests/constants/fixtures/folder1/subfolder3/fixture.inc +++ b/Zend/tests/constants/fixtures/folder1/subfolder3/fixture.inc diff --git a/Zend/tests/constants/fixtures/folder1/subfolder4/fixture.inc b/Zend/tests/constants/fixtures/folder1/subfolder4/fixture.inc index 86e6859363..86e6859363 100755..100644 --- a/Zend/tests/constants/fixtures/folder1/subfolder4/fixture.inc +++ b/Zend/tests/constants/fixtures/folder1/subfolder4/fixture.inc diff --git a/Zend/tests/constants/fixtures/folder2/fixture.inc b/Zend/tests/constants/fixtures/folder2/fixture.inc index 3406c998ac..3406c998ac 100755..100644 --- a/Zend/tests/constants/fixtures/folder2/fixture.inc +++ b/Zend/tests/constants/fixtures/folder2/fixture.inc diff --git a/Zend/tests/constants/fixtures/folder2/subfolder1/fixture.inc b/Zend/tests/constants/fixtures/folder2/subfolder1/fixture.inc index 86e6859363..86e6859363 100755..100644 --- a/Zend/tests/constants/fixtures/folder2/subfolder1/fixture.inc +++ b/Zend/tests/constants/fixtures/folder2/subfolder1/fixture.inc diff --git a/Zend/tests/constants/fixtures/folder2/subfolder2/fixture.inc b/Zend/tests/constants/fixtures/folder2/subfolder2/fixture.inc index 86e6859363..86e6859363 100755..100644 --- a/Zend/tests/constants/fixtures/folder2/subfolder2/fixture.inc +++ b/Zend/tests/constants/fixtures/folder2/subfolder2/fixture.inc diff --git a/Zend/tests/constants/fixtures/folder2/subfolder3/fixture.inc b/Zend/tests/constants/fixtures/folder2/subfolder3/fixture.inc index 86e6859363..86e6859363 100755..100644 --- a/Zend/tests/constants/fixtures/folder2/subfolder3/fixture.inc +++ b/Zend/tests/constants/fixtures/folder2/subfolder3/fixture.inc diff --git a/Zend/tests/constants/fixtures/folder2/subfolder4/fixture.inc b/Zend/tests/constants/fixtures/folder2/subfolder4/fixture.inc index 86e6859363..86e6859363 100755..100644 --- a/Zend/tests/constants/fixtures/folder2/subfolder4/fixture.inc +++ b/Zend/tests/constants/fixtures/folder2/subfolder4/fixture.inc diff --git a/Zend/tests/constants/fixtures/folder3/fixture.inc b/Zend/tests/constants/fixtures/folder3/fixture.inc index 3406c998ac..3406c998ac 100755..100644 --- a/Zend/tests/constants/fixtures/folder3/fixture.inc +++ b/Zend/tests/constants/fixtures/folder3/fixture.inc diff --git a/Zend/tests/constants/fixtures/folder3/subfolder1/fixture.inc b/Zend/tests/constants/fixtures/folder3/subfolder1/fixture.inc index 86e6859363..86e6859363 100755..100644 --- a/Zend/tests/constants/fixtures/folder3/subfolder1/fixture.inc +++ b/Zend/tests/constants/fixtures/folder3/subfolder1/fixture.inc diff --git a/Zend/tests/constants/fixtures/folder3/subfolder2/fixture.inc b/Zend/tests/constants/fixtures/folder3/subfolder2/fixture.inc index 86e6859363..86e6859363 100755..100644 --- a/Zend/tests/constants/fixtures/folder3/subfolder2/fixture.inc +++ b/Zend/tests/constants/fixtures/folder3/subfolder2/fixture.inc diff --git a/Zend/tests/constants/fixtures/folder3/subfolder3/fixture.inc b/Zend/tests/constants/fixtures/folder3/subfolder3/fixture.inc index 86e6859363..86e6859363 100755..100644 --- a/Zend/tests/constants/fixtures/folder3/subfolder3/fixture.inc +++ b/Zend/tests/constants/fixtures/folder3/subfolder3/fixture.inc diff --git a/Zend/tests/constants/fixtures/folder3/subfolder4/fixture.inc b/Zend/tests/constants/fixtures/folder3/subfolder4/fixture.inc index 86e6859363..86e6859363 100755..100644 --- a/Zend/tests/constants/fixtures/folder3/subfolder4/fixture.inc +++ b/Zend/tests/constants/fixtures/folder3/subfolder4/fixture.inc diff --git a/Zend/tests/constants/fixtures/folder4/fixture.inc b/Zend/tests/constants/fixtures/folder4/fixture.inc index 3406c998ac..3406c998ac 100755..100644 --- a/Zend/tests/constants/fixtures/folder4/fixture.inc +++ b/Zend/tests/constants/fixtures/folder4/fixture.inc diff --git a/Zend/tests/constants/fixtures/folder4/subfolder1/fixture.inc b/Zend/tests/constants/fixtures/folder4/subfolder1/fixture.inc index 86e6859363..86e6859363 100755..100644 --- a/Zend/tests/constants/fixtures/folder4/subfolder1/fixture.inc +++ b/Zend/tests/constants/fixtures/folder4/subfolder1/fixture.inc diff --git a/Zend/tests/constants/fixtures/folder4/subfolder2/fixture.inc b/Zend/tests/constants/fixtures/folder4/subfolder2/fixture.inc index 86e6859363..86e6859363 100755..100644 --- a/Zend/tests/constants/fixtures/folder4/subfolder2/fixture.inc +++ b/Zend/tests/constants/fixtures/folder4/subfolder2/fixture.inc diff --git a/Zend/tests/constants/fixtures/folder4/subfolder3/fixture.inc b/Zend/tests/constants/fixtures/folder4/subfolder3/fixture.inc index 86e6859363..86e6859363 100755..100644 --- a/Zend/tests/constants/fixtures/folder4/subfolder3/fixture.inc +++ b/Zend/tests/constants/fixtures/folder4/subfolder3/fixture.inc diff --git a/Zend/tests/constants/fixtures/folder4/subfolder4/fixture.inc b/Zend/tests/constants/fixtures/folder4/subfolder4/fixture.inc index 86e6859363..86e6859363 100755..100644 --- a/Zend/tests/constants/fixtures/folder4/subfolder4/fixture.inc +++ b/Zend/tests/constants/fixtures/folder4/subfolder4/fixture.inc diff --git a/Zend/tests/empty_str_offset.phpt b/Zend/tests/empty_str_offset.phpt index 044719a382..f89987109d 100644 --- a/Zend/tests/empty_str_offset.phpt +++ b/Zend/tests/empty_str_offset.phpt @@ -62,7 +62,7 @@ var_dump(empty($str[$f])); print "done\n"; ?> ---EXPECTF-- +--EXPECT-- - empty --- bool(false) bool(true) diff --git a/Zend/tests/foreach_shadowed_property.phpt b/Zend/tests/foreach_shadowed_property.phpt new file mode 100644 index 0000000000..7fb20141f4 --- /dev/null +++ b/Zend/tests/foreach_shadowed_property.phpt @@ -0,0 +1,28 @@ +--TEST-- +Foreach over object with shadowed private property +--FILE-- +<?php + +class Test { + private $prop = "Test"; + + function run() { + foreach ($this as $k => $v) { + echo "$k => $v\n"; + } + var_dump(get_object_vars($this)); + } +} +class Test2 extends Test { + public $prop = "Test2"; +} + +(new Test2)->run(); + +?> +--EXPECT-- +prop => Test +array(1) { + ["prop"]=> + string(4) "Test" +} diff --git a/Zend/tests/isset_str_offset.phpt b/Zend/tests/isset_str_offset.phpt index 6be0f227a4..5f7b72771f 100644 --- a/Zend/tests/isset_str_offset.phpt +++ b/Zend/tests/isset_str_offset.phpt @@ -60,7 +60,7 @@ var_dump(isset($str[$f])); print "done\n"; ?> ---EXPECTF-- +--EXPECT-- - isset --- bool(true) bool(false) diff --git a/Zend/tests/methods-on-non-objects-nested.inc b/Zend/tests/methods-on-non-objects-nested.inc deleted file mode 100755 index 63d1c0d0da..0000000000 --- a/Zend/tests/methods-on-non-objects-nested.inc +++ /dev/null @@ -1,4 +0,0 @@ -<?php -function nested() { - throw new LogicException('Should not be called'); -} diff --git a/Zend/tests/ns_010.phpt b/Zend/tests/ns_010.phpt index 28ef61bcdd..537757a66c 100644 --- a/Zend/tests/ns_010.phpt +++ b/Zend/tests/ns_010.phpt @@ -1,5 +1,5 @@ --TEST-- -010: Accesing internal namespace class +010: Accessing internal namespace class --FILE-- <?php namespace X; diff --git a/Zend/tests/ns_020.phpt b/Zend/tests/ns_020.phpt index ec4fda0298..5a391771e9 100644 --- a/Zend/tests/ns_020.phpt +++ b/Zend/tests/ns_020.phpt @@ -1,5 +1,5 @@ --TEST-- -020: Accesing internal namespace function +020: Accessing internal namespace function --FILE-- <?php namespace X; diff --git a/Zend/tests/ns_064.phpt b/Zend/tests/ns_064.phpt index 0a7c4bc82d..e287a1e9b2 100644 --- a/Zend/tests/ns_064.phpt +++ b/Zend/tests/ns_064.phpt @@ -1,5 +1,5 @@ --TEST-- -Magic methods in overrided stdClass inside namespace +Magic methods in overridden stdClass inside namespace --FILE-- <?php diff --git a/Zend/tests/property_access_errors_for_guarded_properties.phpt b/Zend/tests/property_access_errors_for_guarded_properties.phpt new file mode 100644 index 0000000000..0a360a9447 --- /dev/null +++ b/Zend/tests/property_access_errors_for_guarded_properties.phpt @@ -0,0 +1,55 @@ +--TEST-- +Property access errors should be thrown for overloaded properties protected by recursion guards +--FILE-- +<?php + +function setProp($obj) { + $obj->prop = 42; +} + +function getProp($obj) { + var_dump($obj->prop); +} + +function unsetProp($obj) { + unset($obj->prop); +} + +class Test { + private $prop; + + public function __get($k) { + getProp($this); + } + + public function __set($k, $v) { + setProp($this); + } + + public function __unset($k) { + unsetProp($this); + } +} + +$test = new Test; +try { + $test->prop = "bar"; +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump($test->prop); +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} +try { + unset($test->prop); +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} + +?> +--EXPECT-- +Cannot access private property Test::$prop +Cannot access private property Test::$prop +Cannot access private property Test::$prop diff --git a/Zend/tests/throwing_overloaded_compound_assign_op.phpt b/Zend/tests/throwing_overloaded_compound_assign_op.phpt new file mode 100644 index 0000000000..e6e79baf5d --- /dev/null +++ b/Zend/tests/throwing_overloaded_compound_assign_op.phpt @@ -0,0 +1,44 @@ +--TEST-- +Exception in compound assign op should prevent call to overloaded object handlers +--FILE-- +<?php + +class Test { + public function __get($k) { + $this->$k = 42; + return 0; + } +} + +$test = new ArrayObject; +$test[0] = 42; +try { + $test[0] %= 0; +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} +var_dump($test); + +$test2 = new Test; +try { + $test2->prop %= 0; +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} +var_dump($test2); + +?> +--EXPECT-- +Modulo by zero +object(ArrayObject)#1 (1) { + ["storage":"ArrayObject":private]=> + array(1) { + [0]=> + int(42) + } +} +Modulo by zero +object(Test)#3 (1) { + ["prop"]=> + int(42) +} diff --git a/Zend/tests/use_const/includes/foo_bar.php b/Zend/tests/use_const/includes/foo_bar.inc index 90ed451f36..90ed451f36 100644 --- a/Zend/tests/use_const/includes/foo_bar.php +++ b/Zend/tests/use_const/includes/foo_bar.inc diff --git a/Zend/tests/use_const/includes/foo_php_version.php b/Zend/tests/use_const/includes/foo_php_version.inc index 08f9fd150e..08f9fd150e 100644 --- a/Zend/tests/use_const/includes/foo_php_version.php +++ b/Zend/tests/use_const/includes/foo_php_version.inc diff --git a/Zend/tests/use_const/includes/global_bar.php b/Zend/tests/use_const/includes/global_bar.inc index 609d17b7b5..609d17b7b5 100644 --- a/Zend/tests/use_const/includes/global_bar.php +++ b/Zend/tests/use_const/includes/global_bar.inc diff --git a/Zend/tests/use_const/includes/global_baz.php b/Zend/tests/use_const/includes/global_baz.inc index 8b6fba97b3..8b6fba97b3 100644 --- a/Zend/tests/use_const/includes/global_baz.php +++ b/Zend/tests/use_const/includes/global_baz.inc diff --git a/Zend/tests/use_const/no_global_fallback.phpt b/Zend/tests/use_const/no_global_fallback.phpt index 3adebd68f5..f9ee605515 100644 --- a/Zend/tests/use_const/no_global_fallback.phpt +++ b/Zend/tests/use_const/no_global_fallback.phpt @@ -3,7 +3,7 @@ non-existent imported constants should not be looked up in the global table --FILE-- <?php -require 'includes/global_baz.php'; +require 'includes/global_baz.inc'; use const foo\bar\baz; var_dump(baz); diff --git a/Zend/tests/use_const/shadow_core.phpt b/Zend/tests/use_const/shadow_core.phpt index 5dbf396e63..55dc03df40 100644 --- a/Zend/tests/use_const/shadow_core.phpt +++ b/Zend/tests/use_const/shadow_core.phpt @@ -3,7 +3,7 @@ shadowing a global core constant with a local version --FILE-- <?php -require 'includes/foo_php_version.php'; +require 'includes/foo_php_version.inc'; use const foo\PHP_VERSION; diff --git a/Zend/tests/use_const/shadow_global.phpt b/Zend/tests/use_const/shadow_global.phpt index 930cc9f0b8..522f972506 100644 --- a/Zend/tests/use_const/shadow_global.phpt +++ b/Zend/tests/use_const/shadow_global.phpt @@ -4,8 +4,8 @@ shadowing a global constant with a local version <?php namespace { - require 'includes/global_bar.php'; - require 'includes/foo_bar.php'; + require 'includes/global_bar.inc'; + require 'includes/foo_bar.inc'; } namespace { diff --git a/Zend/tests/use_function/includes/foo_bar.php b/Zend/tests/use_function/includes/foo_bar.inc index 6d2f8cab45..6d2f8cab45 100644 --- a/Zend/tests/use_function/includes/foo_bar.php +++ b/Zend/tests/use_function/includes/foo_bar.inc diff --git a/Zend/tests/use_function/includes/foo_strlen.php b/Zend/tests/use_function/includes/foo_strlen.inc index d2df2aa2b4..d2df2aa2b4 100644 --- a/Zend/tests/use_function/includes/foo_strlen.php +++ b/Zend/tests/use_function/includes/foo_strlen.inc diff --git a/Zend/tests/use_function/includes/global_bar.php b/Zend/tests/use_function/includes/global_bar.inc index 6d7d91f805..6d7d91f805 100644 --- a/Zend/tests/use_function/includes/global_bar.php +++ b/Zend/tests/use_function/includes/global_bar.inc diff --git a/Zend/tests/use_function/includes/global_baz.php b/Zend/tests/use_function/includes/global_baz.inc index 6383b9dd38..6383b9dd38 100644 --- a/Zend/tests/use_function/includes/global_baz.php +++ b/Zend/tests/use_function/includes/global_baz.inc diff --git a/Zend/tests/use_function/no_global_fallback.phpt b/Zend/tests/use_function/no_global_fallback.phpt index 1277d4e2c2..106fe4b2f8 100644 --- a/Zend/tests/use_function/no_global_fallback.phpt +++ b/Zend/tests/use_function/no_global_fallback.phpt @@ -3,7 +3,7 @@ non-existent imported functions should not be looked up in the global table --FILE-- <?php -require 'includes/global_baz.php'; +require 'includes/global_baz.inc'; use function foo\bar\baz; var_dump(baz()); diff --git a/Zend/tests/use_function/shadow_core.phpt b/Zend/tests/use_function/shadow_core.phpt index 8f92ff1e1b..8442d77b8c 100644 --- a/Zend/tests/use_function/shadow_core.phpt +++ b/Zend/tests/use_function/shadow_core.phpt @@ -3,7 +3,7 @@ shadowing a global core function with a local version --FILE-- <?php -require 'includes/foo_strlen.php'; +require 'includes/foo_strlen.inc'; use function foo\strlen; diff --git a/Zend/tests/use_function/shadow_global.phpt b/Zend/tests/use_function/shadow_global.phpt index 791bcdf4d5..7c222d3afa 100644 --- a/Zend/tests/use_function/shadow_global.phpt +++ b/Zend/tests/use_function/shadow_global.phpt @@ -4,8 +4,8 @@ shadowing a global function with a local version <?php namespace { - require 'includes/global_bar.php'; - require 'includes/foo_bar.php'; + require 'includes/global_bar.inc'; + require 'includes/foo_bar.inc'; } namespace { diff --git a/Zend/tests/zend2.php.txt b/Zend/tests/zend2.php.txt deleted file mode 100644 index afe422eaae..0000000000 --- a/Zend/tests/zend2.php.txt +++ /dev/null @@ -1,275 +0,0 @@ -Example 1: A singleton (static members) -======================================= - -<?php - - class Counter { - var $counter = 0; - - function increment_and_print() - { - print ++$this->counter; - print "\n"; - } - } - - - class SingletonCounter { - static $m_instance = NULL; - - function Instance() - { - if (self::$m_instance == NULL) { - self::$m_instance = new Counter(); - } - return self::$m_instance; - } - } - - SingletonCounter::Instance()->increment_and_print(); - SingletonCounter::Instance()->increment_and_print(); - SingletonCounter::Instance()->increment_and_print(); - -?> - -Example 2: Factory method (derefencing objects returned from functions) -======================================================================= - -<?php - - class Circle { - function draw() - { - print "Circle\n"; - } - } - - class Square { - function draw() - { - print "Square\n"; - } - } - - function ShapeFactoryMethod($shape) - { - switch ($shape) { - case "Circle": - return new Circle(); - case "Square": - return new Square(); - } - } - - ShapeFactoryMethod("Circle")->draw(); - ShapeFactoryMethod("Square")->draw(); - - -?> - -Example 3: Class constants and class scope -========================================== - -<?php - - class ErrorCodes { - const FATAL = "Fatal error\n"; - const WARNING = "Warning\n"; - const INFO = "Informational message\n"; - - function print_fatal_error_codes() - { - print "FATAL = " . FATAL; - print "self::FATAL = " . self::FATAL; - } - } - - /* Call the static function and move into the ErrorCodes scope */ - ErrorCodes::print_fatal_error_codes(); - -?> - -Example 4: Regular object method using both local and global functions -====================================================================== - -<?php - - class HelloWorld { - const HELLO_WORLD = "Hello, World!\n"; - - function get_hello_world() - { - return HELLO_WORLD; - } - - function length_of_hello_world() - { - $str = $this->get_hello_world(); - return strlen($str); - } - } - - $obj = new HelloWorld(); - print "length_of_hello_world() = " . $obj->length_of_hello_world(); - print "\n"; -?> - -Example 5: Multiple derefencing of objects returned from methods -================================================================ - -<?php - - - class Name { - function Name($_name) - { - $this->name = $_name; - } - - function display() - { - print $this->name; - print "\n"; - } - } - - class Person { - function Person($_name, $_address) - { - $this->name = new Name($_name); - } - - function getName() - { - return $this->name; - } - } - - $person = new Person("John", "New York"); - $person->getName()->display(); - -?> - -Example 6: Exception handling -============================= - -<? - class MyException { - function MyException($_error) { - $this->error = $_error; - } - - function getException() - { - return $this->error; - } - } - - function ThrowException() - { - throw new MyException("'This is an exception!'"); - } - - - try { - } catch (MyException $exception) { - print "There was an exception: " . $exception->getException(); - print "\n"; - } - - try { - ThrowException(); - } catch (MyException $exception) { - print "There was an exception: " . $exception->getException(); - print "\n"; - } - -?> - -Example 7: __clone() -=================== - -<? - class MyCloneable { - static $id = 0; - - function MyCloneable() - { - $this->id = self::$id++; - } - - function __clone() - { - $this->name = $that->name; - $this->address = "New York"; - $this->id = self::$id++; - } - } - - - - $obj = new MyCloneable(); - - $obj->name = "Hello"; - $obj->address = "Tel-Aviv"; - - print $obj->id; - print "\n"; - - $obj = $obj->__clone(); - - print $obj->id; - print "\n"; - print $obj->name; - print "\n"; - print $obj->address; - print "\n"; -?> - -Example 8: Unified constructors -=============================== - -<? - - class BaseClass { - function __construct() - { - print "In BaseClass constructor\n"; - } - } - - class SubClass extends BaseClass { - function __construct() - { - parent::__construct(); - print "In SubClass constructor\n"; - } - } - - $obj = new BaseClass(); - - $obj = new SubClass(); - -?> - -Example 9: Destructors -======================= - -<?php - -class MyDestructableClass { - function __construct() - { - print "In constructor\n"; - $this->name = "MyDestructableClass"; - } - - function __destruct() - { - print "Destroying " . $this->name . "\n"; - } -} - -$obj = new MyDestructableClass(); - -?> |