diff options
Diffstat (limited to 'Zend/tests')
| -rwxr-xr-x | Zend/tests/bug29674.phpt | 2 | ||||
| -rw-r--r-- | Zend/tests/bug29689.phpt | 2 | ||||
| -rw-r--r-- | Zend/tests/bug30922.phpt | 2 | ||||
| -rw-r--r-- | Zend/tests/bug38469.phpt | 28 | ||||
| -rw-r--r-- | Zend/tests/bug41919.phpt | 3 | ||||
| -rwxr-xr-x | Zend/tests/bug42937.phpt | 40 | ||||
| -rwxr-xr-x | Zend/tests/bug43128.phpt | 17 | ||||
| -rwxr-xr-x | Zend/tests/bug43175.phpt | 24 | ||||
| -rwxr-xr-x | Zend/tests/bug43201.phpt | 54 | ||||
| -rw-r--r-- | Zend/tests/bug43450.phpt | 35 | ||||
| -rw-r--r-- | Zend/tests/bug43483.phpt | 24 | ||||
| -rw-r--r-- | Zend/tests/bug43703.phpt | 23 | ||||
| -rw-r--r-- | Zend/tests/bug44069.phpt | 21 | ||||
| -rw-r--r-- | Zend/tests/bug44141.phpt | 25 | ||||
| -rw-r--r-- | Zend/tests/bug44184.phpt | 21 | ||||
| -rw-r--r-- | Zend/tests/clone_uncloneable.phpt | 20 | ||||
| -rw-r--r-- | Zend/tests/errmsg_038.phpt | 2 | ||||
| -rw-r--r-- | Zend/tests/indexing_001.phpt | 212 | ||||
| -rwxr-xr-x | Zend/tests/multibyte/multibyte_encoding_001.phpt | 23 | ||||
| -rwxr-xr-x | Zend/tests/multibyte/multibyte_encoding_002.phpt | 21 | ||||
| -rwxr-xr-x | Zend/tests/multibyte/multibyte_encoding_003.phpt | bin | 0 -> 469 bytes |
21 files changed, 593 insertions, 6 deletions
diff --git a/Zend/tests/bug29674.phpt b/Zend/tests/bug29674.phpt index aef91f406..30c23faa0 100755 --- a/Zend/tests/bug29674.phpt +++ b/Zend/tests/bug29674.phpt @@ -33,7 +33,7 @@ $obj->printVars(); ===BASE=== string(4) "Base" -Notice: Undefined property: BaseClass::$private_child in %sbug29674.php on line %d +Notice: Undefined property: BaseClass::$private_child in %sbug29674.php on line %d NULL ===CHILD=== string(4) "Base" diff --git a/Zend/tests/bug29689.phpt b/Zend/tests/bug29689.phpt index 74dabc159..12b343008 100644 --- a/Zend/tests/bug29689.phpt +++ b/Zend/tests/bug29689.phpt @@ -52,7 +52,7 @@ $baz->printFoo(); --EXPECTF-- foo: foo foo2 bar: bar -Notice: Undefined property: bar::$foo2 in %s on line %d +Notice: Undefined property: bar::$foo2 in %s on line %d ---baz-- foo: foo foo2 diff --git a/Zend/tests/bug30922.phpt b/Zend/tests/bug30922.phpt index c78dd3a37..f4e437e49 100644 --- a/Zend/tests/bug30922.phpt +++ b/Zend/tests/bug30922.phpt @@ -10,4 +10,4 @@ var_dump($a instanceOf A); echo "ok\n";
?>
--EXPECTF--
-Fatal error: Interface RecurisiveFooFar cannot not implement itself in %sbug30922.php on line %d
+Fatal error: Interface RecurisiveFooFar cannot implement itself in %sbug30922.php on line %d
diff --git a/Zend/tests/bug38469.phpt b/Zend/tests/bug38469.phpt new file mode 100644 index 000000000..8c3031ae0 --- /dev/null +++ b/Zend/tests/bug38469.phpt @@ -0,0 +1,28 @@ +--TEST--
+Bug #38469 Unexpected creation of cycle
+--FILE--
+<?php
+$a = array();
+$a[0] = $a;
+var_dump($a);
+$b = array(array());
+$b[0][0] = $b;
+var_dump($b);
+?>
+--EXPECT--
+array(1) {
+ [0]=>
+ array(0) {
+ }
+}
+array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(0) {
+ }
+ }
+ }
+}
diff --git a/Zend/tests/bug41919.phpt b/Zend/tests/bug41919.phpt index 127eb97bc..3ba9ae0ec 100644 --- a/Zend/tests/bug41919.phpt +++ b/Zend/tests/bug41919.phpt @@ -8,5 +8,4 @@ $foo[3]->bar[1] = "bang"; echo "ok\n"; ?> --EXPECTF-- -Warning: Cannot use string offset as an array in %s/bug41919.php on line %d -ok +Fatal error: Cannot use string offset as an object in %s/bug41919.php on line %d diff --git a/Zend/tests/bug42937.phpt b/Zend/tests/bug42937.phpt new file mode 100755 index 000000000..875f0d922 --- /dev/null +++ b/Zend/tests/bug42937.phpt @@ -0,0 +1,40 @@ +--TEST-- +Bug #42937 (__call() method not invoked when methods are called on parent from child class) +--FILE-- +<?php +class A { + function __call($strMethod, $arrArgs) { + echo "$strMethod\n"; + } +} + +class C { + function __call($strMethod, $arrArgs) { + echo "$strMethod\n"; + } +} + +class B extends A { + function test() { + self::test1(); + parent::test2(); + A::test3(); + B::test4(); + C::test5(); + } +} + +$a = new A(); +$a->test(); + +$b = new B(); +$b->test(); +?> +--EXPECTF-- +test +test1 +test2 +test3 +test4 + +Fatal error: Call to undefined method C::test5() in %sbug42937.php on line 20 diff --git a/Zend/tests/bug43128.phpt b/Zend/tests/bug43128.phpt new file mode 100755 index 000000000..4ee676a0a --- /dev/null +++ b/Zend/tests/bug43128.phpt @@ -0,0 +1,17 @@ +--TEST-- +Bug #43128 Very long class name causes segfault +--FILE-- +<?php + +$a = str_repeat("a", 10 * 1024 * 1024); + +eval("class $a {}"); + +# call_user_func($a); // Warning +# $a->$a(); // Fatal error + +if ($a instanceof $a); // Segmentation fault +new $a; // Segmentation fault +echo "ok\n"; +--EXPECT-- +ok diff --git a/Zend/tests/bug43175.phpt b/Zend/tests/bug43175.phpt new file mode 100755 index 000000000..3bf6befc1 --- /dev/null +++ b/Zend/tests/bug43175.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #43175 (__destruct() throwing an exception with __call() causes segfault) +--FILE-- +<?php + +class foobar { + public function __destruct() { + throw new Exception(); + } + public function __call($m, $a) { + return $this; + } +} +function foobar() { + return new foobar(); +} +try { + foobar()->unknown(); +} catch (Exception $e) { + echo "__call via traditional factory should be caught\n"; +} +?> +--EXPECT-- +__call via traditional factory should be caught diff --git a/Zend/tests/bug43201.phpt b/Zend/tests/bug43201.phpt new file mode 100755 index 000000000..89e1b6672 --- /dev/null +++ b/Zend/tests/bug43201.phpt @@ -0,0 +1,54 @@ +--TEST-- +Bug #43201 (Crash on using unitialized vals and __get/__set) +--FILE-- +<?php +class Foo { + function __get($k) { + return null; + } + function __set($k, $v) { + $this->$k = $v; + } +} + +$c = new Foo(); + +$c->arr[0]["k"] = 1; +$c->arr[0]["k2"] = $ref; +for($cnt=0;$cnt<6;$cnt++) { + $ref = chop($undef); + $c->arr[$cnt]["k2"] = $ref; +} +echo "ok\n"; +?> +--EXPECTF-- +Notice: Indirect modification of overloaded property Foo::$arr has no effect in %sbug43201.php on line 13 + +Notice: Indirect modification of overloaded property Foo::$arr has no effect in %sbug43201.php on line 14 + +Notice: Undefined variable: ref in %sbug43201.php on line 14 + +Notice: Undefined variable: undef in %sbug43201.php on line 16 + +Notice: Indirect modification of overloaded property Foo::$arr has no effect in %sbug43201.php on line 17 + +Notice: Undefined variable: undef in %sbug43201.php on line 16 + +Notice: Indirect modification of overloaded property Foo::$arr has no effect in %sbug43201.php on line 17 + +Notice: Undefined variable: undef in %sbug43201.php on line 16 + +Notice: Indirect modification of overloaded property Foo::$arr has no effect in %sbug43201.php on line 17 + +Notice: Undefined variable: undef in %sbug43201.php on line 16 + +Notice: Indirect modification of overloaded property Foo::$arr has no effect in %sbug43201.php on line 17 + +Notice: Undefined variable: undef in %sbug43201.php on line 16 + +Notice: Indirect modification of overloaded property Foo::$arr has no effect in %sbug43201.php on line 17 + +Notice: Undefined variable: undef in %sbug43201.php on line 16 + +Notice: Indirect modification of overloaded property Foo::$arr has no effect in %sbug43201.php on line 17 +ok diff --git a/Zend/tests/bug43450.phpt b/Zend/tests/bug43450.phpt new file mode 100644 index 000000000..c55b4f722 --- /dev/null +++ b/Zend/tests/bug43450.phpt @@ -0,0 +1,35 @@ +--TEST--
+Bug #43450 (Memory leak on some functions with implicit object __toString() call)
+--SKIPIF--
+<?php if (!function_exists('memory_get_usage')) die('memory_get_usage() not installed'); ?>
+--FILE--
+<?php
+error_reporting(E_ALL|E_STRICT);
+
+class Foo
+{
+ public function __toString()
+ {
+ return __CLASS__;
+ }
+}
+
+$num_repeats = 100000;
+
+$start = (memory_get_usage() / 1024) + 16;
+for ($i=1;$i<$num_repeats;$i++)
+{
+ $foo = new Foo();
+ md5($foo);
+}
+$end = memory_get_peak_usage() / 1024;
+
+if ($start < $end) {
+ echo 'FAIL';
+} else {
+ echo 'PASS';
+}
+
+?>
+--EXPECT--
+PASS
diff --git a/Zend/tests/bug43483.phpt b/Zend/tests/bug43483.phpt new file mode 100644 index 000000000..0cfbfe878 --- /dev/null +++ b/Zend/tests/bug43483.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #43483 (get_class_methods() does not list all visible methods) +--FILE-- +<?php +class C { + public static function test() { + D::prot(); + print_r(get_class_methods("D")); + } +} +class D extends C { + protected static function prot() { + echo "Successfully called D::prot().\n"; + } +} +D::test(); +?> +--EXPECT-- +Successfully called D::prot(). +Array +( + [0] => prot + [1] => test +) diff --git a/Zend/tests/bug43703.phpt b/Zend/tests/bug43703.phpt new file mode 100644 index 000000000..de4f8a89f --- /dev/null +++ b/Zend/tests/bug43703.phpt @@ -0,0 +1,23 @@ +--TEST-- +Bug #43703 (Signature compatibility check broken) +--FILE-- +<?php +class JoinPoint +{ +} + +abstract class Pointcut +{ + abstract public function evaluate(JoinPoint $joinPoint); +} + +class Read extends Pointcut +{ + public function evaluate(Joinpoint $joinPoint) + { + } +} +?> +DONE +--EXPECT-- +DONE diff --git a/Zend/tests/bug44069.phpt b/Zend/tests/bug44069.phpt new file mode 100644 index 000000000..75beaafed --- /dev/null +++ b/Zend/tests/bug44069.phpt @@ -0,0 +1,21 @@ +--TEST-- +Bug #44069 (Huge memory usage with concatenation using . instead of .=) +--FILE-- +<?php +$array = array(); +$newstring = ""; +$string = str_repeat('This is a teststring.', 50); +for($i = 1; $i <= 2000; $i++) +{ +// $newstring .= $string; //This uses an expected amount of mem. + $newstring = $newstring . $string; //This uses very much mem. + + for($j = 1; $j <= 10; $j++) + { + $array[] = 'test'; + } +} +echo "ok\n"; +?> +--EXPECT-- +ok diff --git a/Zend/tests/bug44141.phpt b/Zend/tests/bug44141.phpt new file mode 100644 index 000000000..1a9ee892b --- /dev/null +++ b/Zend/tests/bug44141.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #44141 (private parent constructor callable through static function) +--FILE-- +<?php +class X +{ + public $x; + private function __construct($x) + { + $this->x = $x; + } +} + +class Y extends X +{ + static public function cheat($x) + { + return new Y($x); + } +} + +$y = Y::cheat(5); +echo $y->x, PHP_EOL; +--EXPECTF-- +Fatal error: Call to private X::__construct() from context 'Y' in %sbug44141.php on line 15 diff --git a/Zend/tests/bug44184.phpt b/Zend/tests/bug44184.phpt new file mode 100644 index 000000000..7f277acc7 --- /dev/null +++ b/Zend/tests/bug44184.phpt @@ -0,0 +1,21 @@ +--TEST-- +Bug #44184 (Double free of loop-variable on exception) +--FILE-- +<?php +function foo() { + $x = array(1,2,3); + foreach ($x as $a) { + while (1) { + throw new Exception(); + } + return; + } +} +try { + foo(); +} catch (Exception $ex) { + echo "ok\n"; +} +?> +--EXPECT-- +ok diff --git a/Zend/tests/clone_uncloneable.phpt b/Zend/tests/clone_uncloneable.phpt new file mode 100644 index 000000000..c991d1060 --- /dev/null +++ b/Zend/tests/clone_uncloneable.phpt @@ -0,0 +1,20 @@ +--TEST-- +cloning uncloneable object +--SKIPIF-- +<?php if (!extension_loaded("xsl")) die("skip xsl extension is missing");?> +--INI-- +zend.ze1_compatibility_mode=1 +--FILE-- +<?php + +$new = &new XSLTProcessor(); +var_dump($new); + +echo "Done\n"; +?> +--EXPECTF-- +Strict Standards: Assigning the return value of new by reference is deprecated in %s on line %d + +Strict Standards: Implicit cloning object of class 'XSLTProcessor' because of 'zend.ze1_compatibility_mode' in %s on line %d + +Fatal error: Trying to clone uncloneable object of class XSLTProcessor in Unknown on line 0 diff --git a/Zend/tests/errmsg_038.phpt b/Zend/tests/errmsg_038.phpt index fdab803ba..2927e945f 100644 --- a/Zend/tests/errmsg_038.phpt +++ b/Zend/tests/errmsg_038.phpt @@ -10,4 +10,4 @@ class test { echo "Done\n"; ?> --EXPECTF-- -Fatal error: Cannot declare property test::$var final, the final modifier is allowed only for methods in %s on line %d +Fatal error: Cannot declare property test::$var final, the final modifier is allowed only for methods and classes in %s on line %d diff --git a/Zend/tests/indexing_001.phpt b/Zend/tests/indexing_001.phpt new file mode 100644 index 000000000..83c2c8d52 --- /dev/null +++ b/Zend/tests/indexing_001.phpt @@ -0,0 +1,212 @@ +--TEST-- +Indexing - various special cases. +--FILE-- +<?php +echo "*** Indexing - Testing value assignment with key ***\n"; +$array=array(1); +$testvalues=array(null, 0, 1, true, false,'',' ',0.1,array()); + +foreach ($testvalues as $testvalue) { + $testvalue['foo']=$array; + var_dump ($testvalue); +} +echo "\n*** Indexing - Testing reference assignment with key ***\n"; + +$testvalues=array(null, 0, 1, true, false,'',0.1,array()); + +foreach ($testvalues as $testvalue) { + $testvalue['foo']=&$array; + var_dump ($testvalue); +} +echo "*** Indexing - Testing value assignment no key ***\n"; +$array=array(1); +$testvalues=array(null, 0, 1, true, false,'',0.1,array()); + +foreach ($testvalues as $testvalue) { + $testvalue[]=$array; + var_dump ($testvalue); +} +echo "\n*** Indexing - Testing reference assignment no key ***\n"; + +$testvalues=array(null, 0, 1, true, false,'',0.1,array()); + +foreach ($testvalues as $testvalue) { + $testvalue[]=&$array; + var_dump ($testvalue); +} + + +echo "\nDone"; +?> +--EXPECTF-- +*** Indexing - Testing value assignment with key *** +array(1) { + ["foo"]=> + array(1) { + [0]=> + int(1) + } +} + +Warning: Cannot use a scalar value as an array in %s on line %d +int(0) + +Warning: Cannot use a scalar value as an array in %s on line %d +int(1) + +Warning: Cannot use a scalar value as an array in %s on line %d +bool(true) +array(1) { + ["foo"]=> + array(1) { + [0]=> + int(1) + } +} +array(1) { + ["foo"]=> + array(1) { + [0]=> + int(1) + } +} + +Notice: Array to string conversion in %s on line %d +string(1) "A" + +Warning: Cannot use a scalar value as an array in %s on line %d +float(0.1) +array(1) { + ["foo"]=> + array(1) { + [0]=> + int(1) + } +} + +*** Indexing - Testing reference assignment with key *** +array(1) { + ["foo"]=> + &array(1) { + [0]=> + int(1) + } +} + +Warning: Cannot use a scalar value as an array in %s on line %d +int(0) + +Warning: Cannot use a scalar value as an array in %s on line %d +int(1) + +Warning: Cannot use a scalar value as an array in %s on line %d +bool(true) +array(1) { + ["foo"]=> + &array(1) { + [0]=> + int(1) + } +} +array(1) { + ["foo"]=> + &array(1) { + [0]=> + int(1) + } +} + +Warning: Cannot use a scalar value as an array in %s on line %d +float(0.1) +array(1) { + ["foo"]=> + &array(1) { + [0]=> + int(1) + } +} +*** Indexing - Testing value assignment no key *** +array(1) { + [0]=> + array(1) { + [0]=> + int(1) + } +} + +Warning: Cannot use a scalar value as an array in %s on line %d +int(0) + +Warning: Cannot use a scalar value as an array in %s on line %d +int(1) + +Warning: Cannot use a scalar value as an array in %s on line %d +bool(true) +array(1) { + [0]=> + array(1) { + [0]=> + int(1) + } +} +array(1) { + [0]=> + array(1) { + [0]=> + int(1) + } +} + +Warning: Cannot use a scalar value as an array in %s on line %d +float(0.1) +array(1) { + [0]=> + array(1) { + [0]=> + int(1) + } +} + +*** Indexing - Testing reference assignment no key *** +array(1) { + [0]=> + &array(1) { + [0]=> + int(1) + } +} + +Warning: Cannot use a scalar value as an array in %s on line %d +int(0) + +Warning: Cannot use a scalar value as an array in %s on line %d +int(1) + +Warning: Cannot use a scalar value as an array in %s on line %d +bool(true) +array(1) { + [0]=> + &array(1) { + [0]=> + int(1) + } +} +array(1) { + [0]=> + &array(1) { + [0]=> + int(1) + } +} + +Warning: Cannot use a scalar value as an array in %s on line %d +float(0.1) +array(1) { + [0]=> + &array(1) { + [0]=> + int(1) + } +} + +Done
\ No newline at end of file diff --git a/Zend/tests/multibyte/multibyte_encoding_001.phpt b/Zend/tests/multibyte/multibyte_encoding_001.phpt new file mode 100755 index 000000000..19b6064cf --- /dev/null +++ b/Zend/tests/multibyte/multibyte_encoding_001.phpt @@ -0,0 +1,23 @@ +--TEST-- +Zend Multibyte and ShiftJIS +--SKIPIF-- +<?php +if (!in_array("detect_unicode", array_keys(ini_get_all()))) { + die("skip Requires configure --enable-zend-multibyte option"); +} +if (!extension_loaded("mbstring")) { + die("skip Requires mbstring extension"); +} +?> +--INI-- +mbstring.internal_encoding=SJIS +--FILE-- +<?php +declare(encoding='Shift_JIS'); +$s = "•\"; // 0x95+0x5c in script, not somewhere else " +printf("%x:%x\n", ord($s[0]), ord($s[1])); +?> +===DONE=== +--EXPECT-- +95:5c +===DONE=== diff --git a/Zend/tests/multibyte/multibyte_encoding_002.phpt b/Zend/tests/multibyte/multibyte_encoding_002.phpt new file mode 100755 index 000000000..813222d82 --- /dev/null +++ b/Zend/tests/multibyte/multibyte_encoding_002.phpt @@ -0,0 +1,21 @@ +--TEST-- +Zend Multibyte and UTF-8 BOM +--SKIPIF-- +<?php +if (!in_array("detect_unicode", array_keys(ini_get_all()))) { + die("skip Requires configure --enable-zend-multibyte option"); +} +if (!extension_loaded("mbstring")) { + die("skip Requires mbstring extension"); +} +?> +--INI-- +mbstring.internal_encoding=iso-8859-1 +--FILE-- +<?php +print "Hello World\n"; +?> +===DONE=== +--EXPECT-- +Hello World +===DONE=== diff --git a/Zend/tests/multibyte/multibyte_encoding_003.phpt b/Zend/tests/multibyte/multibyte_encoding_003.phpt Binary files differnew file mode 100755 index 000000000..19b29f209 --- /dev/null +++ b/Zend/tests/multibyte/multibyte_encoding_003.phpt |
