From: Ant Phillips Date: Fri, 28 Nov 2008 10:41:19 +0000 (+0000) Subject: Language tests: checked on PHP 5.2.6, 5.3 and 6.0 (Windows, Linux and Linux 64 bit). X-Git-Tag: php-5.3.0alpha2~54 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=775389cd1d0dc08d54c17c6abac7e56d2eef9bcb;p=php Language tests: checked on PHP 5.2.6, 5.3 and 6.0 (Windows, Linux and Linux 64 bit). --- diff --git a/tests/lang/func_get_arg.001.phpt b/tests/lang/func_get_arg.001.phpt new file mode 100644 index 0000000000..b1bbb18699 --- /dev/null +++ b/tests/lang/func_get_arg.001.phpt @@ -0,0 +1,15 @@ +--TEST-- +func_get_arg test +--FILE-- + +--EXPECT-- +2 \ No newline at end of file diff --git a/tests/lang/func_get_arg.002.phpt b/tests/lang/func_get_arg.002.phpt new file mode 100644 index 0000000000..6ab4f95719 --- /dev/null +++ b/tests/lang/func_get_arg.002.phpt @@ -0,0 +1,19 @@ +--TEST-- +func_get_arg with variable number of args +--FILE-- + +--EXPECT-- +int(3) +int(3) diff --git a/tests/lang/func_get_arg.003.phpt b/tests/lang/func_get_arg.003.phpt new file mode 100644 index 0000000000..4ef9967674 --- /dev/null +++ b/tests/lang/func_get_arg.003.phpt @@ -0,0 +1,11 @@ +--TEST-- +func_get_arg outside of a function declaration +--FILE-- + +--EXPECTF-- +Warning: func_get_arg(): Called from the global scope - no function context in %s on line %d +bool(false) diff --git a/tests/lang/func_get_arg.004.phpt b/tests/lang/func_get_arg.004.phpt new file mode 100644 index 0000000000..6931df04e6 --- /dev/null +++ b/tests/lang/func_get_arg.004.phpt @@ -0,0 +1,16 @@ +--TEST-- +func_get_arg on non-existent arg +--FILE-- + +--EXPECTF-- +Warning: func_get_arg(): Argument 2 not passed to function in %s on line %d +bool(false) \ No newline at end of file diff --git a/tests/lang/func_get_arg.005.phpt b/tests/lang/func_get_arg.005.phpt new file mode 100644 index 0000000000..e1ae78e162 --- /dev/null +++ b/tests/lang/func_get_arg.005.phpt @@ -0,0 +1,19 @@ +--TEST-- +A variable, which is referenced by another variable, is passed by value. +During the call, the original variable is updated. This should not affect func_get_arg(). +--FILE-- + +--EXPECTF-- +string(10) "original.a" +string(10) "original.a" \ No newline at end of file diff --git a/tests/lang/func_get_arg_variation.phpt b/tests/lang/func_get_arg_variation.phpt new file mode 100644 index 0000000000..5dd0ed63db --- /dev/null +++ b/tests/lang/func_get_arg_variation.phpt @@ -0,0 +1,28 @@ +--TEST-- +func_get_arg test +--FILE-- + +--EXPECTF-- +Warning: func_get_arg() expects exactly 1 parameter, 0 given in %s on line %d + +Warning: func_get_arg() expects exactly 1 parameter, 2 given in %s on line %d + +Warning: func_get_arg() expects parameter 1 to be long, string given in %s on line %d + +Warning: func_get_arg(): The argument number should be >= 0 in %s on line %d + +Warning: func_get_arg(): Argument 2 not passed to function in %s on line %d + diff --git a/tests/lang/func_get_args.001.phpt b/tests/lang/func_get_args.001.phpt new file mode 100644 index 0000000000..740a0a2165 --- /dev/null +++ b/tests/lang/func_get_args.001.phpt @@ -0,0 +1,15 @@ +--TEST-- +func_get_args with no args +--FILE-- + +--EXPECT-- +array(0) { +} \ No newline at end of file diff --git a/tests/lang/func_get_args.002.phpt b/tests/lang/func_get_args.002.phpt new file mode 100644 index 0000000000..0a886c2f04 --- /dev/null +++ b/tests/lang/func_get_args.002.phpt @@ -0,0 +1,22 @@ +--TEST-- +func_get_args with variable number of args +--FILE-- + +--EXPECT-- +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) +} + diff --git a/tests/lang/func_get_args.003.phpt b/tests/lang/func_get_args.003.phpt new file mode 100644 index 0000000000..44faf7ebf8 --- /dev/null +++ b/tests/lang/func_get_args.003.phpt @@ -0,0 +1,11 @@ +--TEST-- +func_get_args() outside of a function declaration +--FILE-- + +--EXPECTREGEX-- +Warning\: func_get_args\(\)\: Called from the global scope - no function context in \S* on line 3 +bool\(false\) diff --git a/tests/lang/func_get_args.004.phpt b/tests/lang/func_get_args.004.phpt new file mode 100644 index 0000000000..84e3ebe5a2 --- /dev/null +++ b/tests/lang/func_get_args.004.phpt @@ -0,0 +1,67 @@ +--TEST-- +Pass same variable by ref and by value. +--FILE-- + +--EXPECTF-- + +-- Val, Ref -- +string(10) "original.a" +string(10) "original.a" +array(2) { + [0]=> + string(10) "original.a" + [1]=> + string(10) "original.a" +} +array(2) { + [0]=> + string(10) "original.a" + [1]=> + string(9) "changed.y" +} +string(9) "changed.y" + + +-- Ref, Val -- +string(10) "original.b" +string(10) "original.b" +array(2) { + [0]=> + string(10) "original.b" + [1]=> + string(10) "original.b" +} +array(2) { + [0]=> + string(9) "changed.x" + [1]=> + string(10) "original.b" +} +string(9) "changed.x" \ No newline at end of file diff --git a/tests/lang/func_num_args.001.phpt b/tests/lang/func_num_args.001.phpt new file mode 100644 index 0000000000..c281557feb --- /dev/null +++ b/tests/lang/func_num_args.001.phpt @@ -0,0 +1,14 @@ +--TEST-- +func_num_args with no args +--FILE-- + +--EXPECT-- +int(0) \ No newline at end of file diff --git a/tests/lang/func_num_args.002.phpt b/tests/lang/func_num_args.002.phpt new file mode 100644 index 0000000000..bfb8f7c705 --- /dev/null +++ b/tests/lang/func_num_args.002.phpt @@ -0,0 +1,14 @@ +--TEST-- +func_num_args with variable number of args +--FILE-- + +--EXPECT-- +int(3) \ No newline at end of file diff --git a/tests/lang/func_num_args.003.phpt b/tests/lang/func_num_args.003.phpt new file mode 100644 index 0000000000..7cf1229bce --- /dev/null +++ b/tests/lang/func_num_args.003.phpt @@ -0,0 +1,12 @@ +--TEST-- +func_num_args() outside of a function declaration +--FILE-- + +--EXPECTF-- + +Warning: func_num_args(): Called from the global scope - no function context in %s on line %d +int(-1) \ No newline at end of file diff --git a/tests/lang/func_num_args.004.phpt b/tests/lang/func_num_args.004.phpt new file mode 100644 index 0000000000..8bdc6f07f6 --- /dev/null +++ b/tests/lang/func_num_args.004.phpt @@ -0,0 +1,48 @@ +--TEST-- +Pass same variable by ref and by value. +--FILE-- + +--EXPECTF-- + + +-- Val, Ref -- +string(10) "original.a" +string(10) "original.a" +int(2) +int(2) +string(9) "changed.y" + + +-- Ref, Val -- +string(10) "original.b" +string(10) "original.b" +int(2) +int(2) +string(9) "changed.x" diff --git a/tests/lang/passByReference_001.phpt b/tests/lang/passByReference_001.phpt new file mode 100644 index 0000000000..c73eacc594 --- /dev/null +++ b/tests/lang/passByReference_001.phpt @@ -0,0 +1,37 @@ +--TEST-- +passing of function parameters by reference +--FILE-- + +--EXPECT-- +int(7) +int(15) +int(7) +int(16) +array(1) { + [0]=> + &int(1) +} +int(1) \ No newline at end of file diff --git a/tests/lang/passByReference_002.phpt b/tests/lang/passByReference_002.phpt new file mode 100644 index 0000000000..d1968a3528 --- /dev/null +++ b/tests/lang/passByReference_002.phpt @@ -0,0 +1,15 @@ +--TEST-- +Attempt to pass a constant by reference +--FILE-- + +--EXPECTF-- +Fatal error: Only variables can be passed by reference in %s on line 8 diff --git a/tests/lang/passByReference_003.phpt b/tests/lang/passByReference_003.phpt new file mode 100644 index 0000000000..bbbc564654 --- /dev/null +++ b/tests/lang/passByReference_003.phpt @@ -0,0 +1,48 @@ +--TEST-- +Implicit initialisation when passing by reference +--FILE-- + +--EXPECTF-- + +Passing undefined by value + +Notice: Undefined variable: undef1 in %s on line 13 + +Inside passbyVal call: +NULL + +After call + +Notice: Undefined variable: undef1 in %s on line 15 +NULL + +Passing undefined by reference + +Inside passbyRef call: +NULL + +After call +array(1) { + [0]=> + NULL +} diff --git a/tests/lang/passByReference_004.phpt b/tests/lang/passByReference_004.phpt new file mode 100644 index 0000000000..e8a7963d26 --- /dev/null +++ b/tests/lang/passByReference_004.phpt @@ -0,0 +1,21 @@ +--TEST-- +passing the return value from a function by reference +--FILE-- + +--EXPECTF-- +Strict Standards: Only variables should be passed by reference in %s on line 13 +int(5) diff --git a/tests/lang/passByReference_005.phpt b/tests/lang/passByReference_005.phpt new file mode 100644 index 0000000000..52ddeebd1c --- /dev/null +++ b/tests/lang/passByReference_005.phpt @@ -0,0 +1,261 @@ +--TEST-- +Pass uninitialised variables by reference and by value to test implicit initialisation. +--FILE-- +v($u1); +$c->r($u2); +var_dump($u1, $u2); + +unset($u1, $u2); +$c->vv($u1, $u2); +var_dump($u1, $u2); + +unset($u1, $u2); +$c->vr($u1, $u2); +var_dump($u1, $u2); + +unset($u1, $u2); +$c->rv($u1, $u2); +var_dump($u1, $u2); + +unset($u1, $u2); +$c->rr($u1, $u2); +var_dump($u1, $u2); + +?> +--EXPECTF-- + + ---- Pass by ref / pass by val: functions ---- + +Notice: Undefined variable: u1 in %s on line 72 + +Notice: Undefined variable: u1 in %s on line 74 +NULL +string(11) "Ref changed" + +Notice: Undefined variable: u1 in %s on line 77 + +Notice: Undefined variable: u2 in %s on line 77 + +Notice: Undefined variable: u1 in %s on line 78 + +Notice: Undefined variable: u2 in %s on line 78 +NULL +NULL + +Notice: Undefined variable: u1 in %s on line 81 + +Notice: Undefined variable: u1 in %s on line 82 +NULL +string(11) "Ref changed" + +Notice: Undefined variable: u2 in %s on line 85 + +Notice: Undefined variable: u2 in %s on line 86 +string(11) "Ref changed" +NULL +string(12) "Ref1 changed" +string(12) "Ref2 changed" + + + ---- Pass by ref / pass by val: static method calls ---- + +Notice: Undefined variable: u1 in %s on line 95 + +Strict Standards: Non-static method C::v() should not be called statically in %s on line 95 + +Strict Standards: Non-static method C::r() should not be called statically in %s on line 96 + +Notice: Undefined variable: u1 in %s on line 97 +NULL +string(11) "Ref changed" + +Notice: Undefined variable: u1 in %s on line 100 + +Notice: Undefined variable: u2 in %s on line 100 + +Strict Standards: Non-static method C::vv() should not be called statically in %s on line 100 + +Notice: Undefined variable: u1 in %s on line 101 + +Notice: Undefined variable: u2 in %s on line 101 +NULL +NULL + +Notice: Undefined variable: u1 in %s on line 104 + +Strict Standards: Non-static method C::vr() should not be called statically in %s on line 104 + +Notice: Undefined variable: u1 in %s on line 105 +NULL +string(11) "Ref changed" + +Notice: Undefined variable: u2 in %s on line 108 + +Strict Standards: Non-static method C::rv() should not be called statically in %s on line 108 + +Notice: Undefined variable: u2 in %s on line 109 +string(11) "Ref changed" +NULL + +Strict Standards: Non-static method C::rr() should not be called statically in %s on line 112 +string(12) "Ref1 changed" +string(12) "Ref2 changed" + + + ---- Pass by ref / pass by val: instance method calls ---- + +Notice: Undefined variable: u1 in %s on line 117 + +Notice: Undefined variable: u1 in %s on line 118 +NULL +string(11) "Ref changed" + +Notice: Undefined variable: u1 in %s on line 121 + +Notice: Undefined variable: u1 in %s on line 123 +NULL +string(11) "Ref changed" + +Notice: Undefined variable: u1 in %s on line 126 + +Notice: Undefined variable: u2 in %s on line 126 + +Notice: Undefined variable: u1 in %s on line 127 + +Notice: Undefined variable: u2 in %s on line 127 +NULL +NULL + +Notice: Undefined variable: u1 in %s on line 130 + +Notice: Undefined variable: u1 in %s on line 131 +NULL +string(11) "Ref changed" + +Notice: Undefined variable: u2 in %s on line 134 + +Notice: Undefined variable: u2 in %s on line 135 +string(11) "Ref changed" +NULL +string(12) "Ref1 changed" +string(12) "Ref2 changed" \ No newline at end of file diff --git a/tests/lang/passByReference_006.phpt b/tests/lang/passByReference_006.phpt new file mode 100644 index 0000000000..248be88b44 --- /dev/null +++ b/tests/lang/passByReference_006.phpt @@ -0,0 +1,195 @@ +--TEST-- +Pass uninitialised objects and arrays by reference to test implicit initialisation. +--FILE-- +a, $u4->a->b, $u5->a->b->c); +var_dump($u1, $u2, $u3, $u4, $u5); + +echo "\n ---- Pass uninitialised arrays & objects by ref: static method call ---\n"; +unset($u1, $u2, $u3, $u4, $u5); +C::refs($u1[0], $u2[0][1], $u3->a, $u4->a->b, $u5->a->b->c); +var_dump($u1, $u2, $u3, $u4, $u5); + +echo "\n\n---- Pass uninitialised arrays & objects by ref: constructor ---\n"; +unset($u1, $u2, $u3, $u4, $u5); +$c = new C($u1[0], $u2[0][1], $u3->a, $u4->a->b, $u5->a->b->c); +var_dump($u1, $u2, $u3, $u4, $u5); + +echo "\n ---- Pass uninitialised arrays & objects by ref: instance method call ---\n"; +unset($u1, $u2, $u3, $u4, $u5); +$c->refs($u1[0], $u2[0][1], $u3->a, $u4->a->b, $u5->a->b->c); +var_dump($u1, $u2, $u3, $u4, $u5); + +?> +--EXPECTF-- + + ---- Pass uninitialised array & object by ref: function call --- +array(1) { + [0]=> + string(12) "Ref1 changed" +} +array(1) { + [0]=> + array(1) { + [1]=> + string(12) "Ref2 changed" + } +} +object(stdClass)#%d (1) { + ["a"]=> + string(12) "Ref3 changed" +} +object(stdClass)#%d (1) { + ["a"]=> + object(stdClass)#%d (1) { + ["b"]=> + string(12) "Ref4 changed" + } +} +object(stdClass)#%d (1) { + ["a"]=> + object(stdClass)#%d (1) { + ["b"]=> + object(stdClass)#%d (1) { + ["c"]=> + string(12) "Ref5 changed" + } + } +} + + ---- Pass uninitialised arrays & objects by ref: static method call --- + +Strict Standards: Non-static method C::refs() should not be called statically in %s on line 39 +array(1) { + [0]=> + string(12) "Ref1 changed" +} +array(1) { + [0]=> + array(1) { + [1]=> + string(12) "Ref2 changed" + } +} +object(stdClass)#%d (1) { + ["a"]=> + string(12) "Ref3 changed" +} +object(stdClass)#%d (1) { + ["a"]=> + object(stdClass)#%d (1) { + ["b"]=> + string(12) "Ref4 changed" + } +} +object(stdClass)#%d (1) { + ["a"]=> + object(stdClass)#%d (1) { + ["b"]=> + object(stdClass)#%d (1) { + ["c"]=> + string(12) "Ref5 changed" + } + } +} + + +---- Pass uninitialised arrays & objects by ref: constructor --- +array(1) { + [0]=> + string(12) "Ref1 changed" +} +array(1) { + [0]=> + array(1) { + [1]=> + string(12) "Ref2 changed" + } +} +object(stdClass)#%d (1) { + ["a"]=> + string(12) "Ref3 changed" +} +object(stdClass)#%d (1) { + ["a"]=> + object(stdClass)#%d (1) { + ["b"]=> + string(12) "Ref4 changed" + } +} +object(stdClass)#%d (1) { + ["a"]=> + object(stdClass)#%d (1) { + ["b"]=> + object(stdClass)#%d (1) { + ["c"]=> + string(12) "Ref5 changed" + } + } +} + + ---- Pass uninitialised arrays & objects by ref: instance method call --- +array(1) { + [0]=> + string(12) "Ref1 changed" +} +array(1) { + [0]=> + array(1) { + [1]=> + string(12) "Ref2 changed" + } +} +object(stdClass)#%d (1) { + ["a"]=> + string(12) "Ref3 changed" +} +object(stdClass)#%d (1) { + ["a"]=> + object(stdClass)#%d (1) { + ["b"]=> + string(12) "Ref4 changed" + } +} +object(stdClass)#%d (1) { + ["a"]=> + object(stdClass)#%d (1) { + ["b"]=> + object(stdClass)#%d (1) { + ["c"]=> + string(12) "Ref5 changed" + } + } +} \ No newline at end of file diff --git a/tests/lang/passByReference_007.phpt b/tests/lang/passByReference_007.phpt new file mode 100644 index 0000000000..558ceae27e --- /dev/null +++ b/tests/lang/passByReference_007.phpt @@ -0,0 +1,105 @@ +--TEST-- +Pass function and method calls by reference and by value. +--FILE-- +returnVal()); +var_dump($a); + +echo "Pass a method call that returns a reference:\n"; +$a = "original"; +foo($myC->returnReference()); +var_dump($a); + +?> +--EXPECTF-- +Pass a function call that returns a value: + +Strict Standards: Only variables should be passed by reference in %s on line 44 +string(8) "original" +string(8) "original" +Pass a function call that returns a reference: +string(8) "original" +string(7) "changed" + +Pass a static method call that returns a value: + +Strict Standards: Only variables should be passed by reference in %s on line 55 +string(8) "original" +string(8) "original" +Pass a static method call that returns a reference: +string(8) "original" +string(7) "changed" + +Pass a method call that returns a value: + +Strict Standards: Only variables should be passed by reference in %s on line 67 +string(8) "original" +string(8) "original" +Pass a method call that returns a reference: +string(8) "original" +string(7) "changed" \ No newline at end of file diff --git a/tests/lang/passByReference_008.phpt b/tests/lang/passByReference_008.phpt new file mode 100644 index 0000000000..36852170bf --- /dev/null +++ b/tests/lang/passByReference_008.phpt @@ -0,0 +1,40 @@ +--TEST-- +Pass same variable by ref and by value. +--FILE-- + +--EXPECTF-- + + +-- Val, Ref -- +string(10) "original.a" +string(10) "original.a" +string(9) "changed.y" + + +-- Ref, Val -- +string(10) "original.b" +string(10) "original.b" +string(9) "changed.x" \ No newline at end of file diff --git a/tests/lang/passByReference_009.phpt b/tests/lang/passByReference_009.phpt new file mode 100644 index 0000000000..1cbd87d6c4 --- /dev/null +++ b/tests/lang/passByReference_009.phpt @@ -0,0 +1,24 @@ +--TEST-- +Assignement as argument +--FILE-- + +--EXPECTF-- +1012 \ No newline at end of file diff --git a/tests/lang/passByReference_010.phpt b/tests/lang/passByReference_010.phpt new file mode 100644 index 0000000000..0393cce2d1 --- /dev/null +++ b/tests/lang/passByReference_010.phpt @@ -0,0 +1,61 @@ +--TEST-- +Passing assignments by reference +--FILE-- + Pass constant assignment by reference:\n"; +f($a="a.original"); +var_dump($a); + +echo "\n\n---> Pass variable assignment by reference:\n"; +unset($a); +$a = "a.original"; +f($b = $a); +var_dump($a); + +echo "\n\n---> Pass reference assignment by reference:\n"; +unset($a, $b); +$a = "a.original"; +f($b =& $a); +var_dump($a); + +echo "\n\n---> Pass concat assignment by reference:\n"; +unset($a, $b); +$b = "b.original"; +$a = "a.original"; +f($b .= $a); +var_dump($a); + +?> +--EXPECTF-- + + +---> Pass constant assignment by reference: + +Strict Standards: Only variables should be passed by reference in %s on line 9 +string(10) "a.original" +string(10) "a.original" + + +---> Pass variable assignment by reference: + +Strict Standards: Only variables should be passed by reference in %s on line 15 +string(10) "a.original" +string(10) "a.original" + + +---> Pass reference assignment by reference: +string(10) "a.original" +string(9) "a.changed" + + +---> Pass concat assignment by reference: + +Strict Standards: Only variables should be passed by reference in %s on line 28 +string(20) "b.originala.original" +string(10) "a.original" diff --git a/tests/lang/short_tags.001.phpt b/tests/lang/short_tags.001.phpt new file mode 100644 index 0000000000..79939b01a0 --- /dev/null +++ b/tests/lang/short_tags.001.phpt @@ -0,0 +1,12 @@ +--TEST-- +short tags +--INI-- +short_open_tag=on +--FILE-- + +Finished +--EXPECT-- +Used a short tag +Finished diff --git a/tests/lang/short_tags.002.phpt b/tests/lang/short_tags.002.phpt new file mode 100644 index 0000000000..6f0da684ec --- /dev/null +++ b/tests/lang/short_tags.002.phpt @@ -0,0 +1,12 @@ +--TEST-- +short tags +--INI-- +short_tags=off +--FILE-- + +Finished +--EXPECT-- +Used a short tag +Finished diff --git a/tests/lang/short_tags.003.phpt b/tests/lang/short_tags.003.phpt new file mode 100644 index 0000000000..64f97bcc29 --- /dev/null +++ b/tests/lang/short_tags.003.phpt @@ -0,0 +1,32 @@ +--TEST-- +tags +--INI-- +short_open_tags=on +asp_tags=on +--FILE-- + + +<%= 'so should this' %> + + + + + +<%= $a%> + + + + +--EXPECT-- +this should get echoed +so should this + +This gets echoed twice +This gets echoed twice + +3 + diff --git a/tests/lang/short_tags.004.phpt b/tests/lang/short_tags.004.phpt new file mode 100644 index 0000000000..be16467e2f --- /dev/null +++ b/tests/lang/short_tags.004.phpt @@ -0,0 +1,37 @@ +--TEST-- +tags +--INI-- +short_open_tag=off +asp_tags=off +--FILE-- + + +<%= 'so should this' %> + + + + + +<%= $a%> + + + + +--EXPECTF-- + + +<%= 'so should this' %> + + + + +<%= $a%> + + + + +Notice: Undefined variable: b in %s on line %d \ No newline at end of file diff --git a/tests/lang/static_basic_001.phpt b/tests/lang/static_basic_001.phpt new file mode 100644 index 0000000000..45fc1b2abe --- /dev/null +++ b/tests/lang/static_basic_001.phpt @@ -0,0 +1,84 @@ +--TEST-- +Static keyword - basic tests +--FILE-- + +--EXPECT-- + +Same variable used as static and non static. +--------- +0 +10 +--------- +0 +11 +--------- +0 +12 + +Lots of initialisations in the same statement. +------------- Call 0 -------------- +Unitialised : +Initialised to 10: 10 +Initialised to 20: 20 +Unitialised : +Initialised to 30: 30 +------------- Call 1 -------------- +Unitialised : 1 +Initialised to 10: 11 +Initialised to 20: 21 +Unitialised : 1 +Initialised to 30: 31 +------------- Call 2 -------------- +Unitialised : 2 +Initialised to 10: 12 +Initialised to 20: 22 +Unitialised : 2 +Initialised to 30: 32 + +Using static keyword at global scope + 10 +1 11 +2 12 \ No newline at end of file diff --git a/tests/lang/static_basic_002.phpt b/tests/lang/static_basic_002.phpt new file mode 100644 index 0000000000..06e2f724ec --- /dev/null +++ b/tests/lang/static_basic_002.phpt @@ -0,0 +1,28 @@ +--TEST-- +Multiple declarations of the same static variable +--FILE-- + +--EXPECT-- +int(5) +int(11) +int(14) diff --git a/tests/lang/static_variation_001.phpt b/tests/lang/static_variation_001.phpt new file mode 100644 index 0000000000..a27b9fadc7 --- /dev/null +++ b/tests/lang/static_variation_001.phpt @@ -0,0 +1,112 @@ +--TEST-- +Statics in nested functions & evals. +--FILE-- + +--EXPECTF-- +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) +} +array(3) { + [0]=> + int(4) + [1]=> + int(5) + [2]=> + int(6) +} +array(3) { + [0]=> + int(7) + [1]=> + int(8) + [2]=> + int(9) +} +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) +} +array(3) { + [0]=> + int(4) + [1]=> + int(5) + [2]=> + int(6) +} +array(3) { + [0]=> + int(7) + [1]=> + int(8) + [2]=> + int(9) +} +array(3) { + [0]=> + int(10) + [1]=> + int(11) + [2]=> + int(12) +} +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) +} \ No newline at end of file diff --git a/tests/lang/static_variation_002.phpt b/tests/lang/static_variation_002.phpt new file mode 100644 index 0000000000..b8933fd26e --- /dev/null +++ b/tests/lang/static_variation_002.phpt @@ -0,0 +1,84 @@ +--TEST-- +Static variables in methods & nested functions & evals. +--FILE-- +f(); +cfg(); + +Class D { + static function f() { + eval('function dfg() { static $b = array(1,2,3); var_dump($b); } '); + } +} +D::f(); +dfg(); + +eval(' Class E { function f() { static $c = array(1,2,3); var_dump($c); } }'); +$e = new E; +$e->f(); + +?> +--EXPECTF-- +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) +} +array(3) { + [0]=> + int(4) + [1]=> + int(5) + [2]=> + int(6) +} +array(3) { + [0]=> + int(7) + [1]=> + int(8) + [2]=> + int(9) +} +array(3) { + [0]=> + int(10) + [1]=> + int(11) + [2]=> + int(12) +} +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) +} +array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) +} \ No newline at end of file