diff options
Diffstat (limited to 'tests/lang')
285 files changed, 37827 insertions, 0 deletions
diff --git a/tests/lang/001.phpt b/tests/lang/001.phpt new file mode 100644 index 0000000..71df318 --- /dev/null +++ b/tests/lang/001.phpt @@ -0,0 +1,6 @@ +--TEST-- +Simple If condition test +--FILE-- +<?php $a=1; if($a>0) { echo "Yes"; } ?> +--EXPECT-- +Yes diff --git a/tests/lang/002.phpt b/tests/lang/002.phpt new file mode 100644 index 0000000..ec14d01 --- /dev/null +++ b/tests/lang/002.phpt @@ -0,0 +1,12 @@ +--TEST-- +Simple While Loop Test +--FILE-- +<?php +$a=1; +while ($a<10) { + echo $a; + $a++; +} +?> +--EXPECT-- +123456789 diff --git a/tests/lang/003.phpt b/tests/lang/003.phpt new file mode 100644 index 0000000..7049db9 --- /dev/null +++ b/tests/lang/003.phpt @@ -0,0 +1,19 @@ +--TEST-- +Simple Switch Test +--FILE-- +<?php +$a=1; +switch($a) { + case 0: + echo "bad"; + break; + case 1: + echo "good"; + break; + default: + echo "bad"; + break; +} +?> +--EXPECT-- +good diff --git a/tests/lang/004.phpt b/tests/lang/004.phpt new file mode 100644 index 0000000..be8ebf4 --- /dev/null +++ b/tests/lang/004.phpt @@ -0,0 +1,13 @@ +--TEST-- +Simple If/Else Test +--FILE-- +<?php +$a=1; +if($a==0) { + echo "bad"; +} else { + echo "good"; +} +?> +--EXPECT-- +good diff --git a/tests/lang/005.phpt b/tests/lang/005.phpt new file mode 100644 index 0000000..404a7cb --- /dev/null +++ b/tests/lang/005.phpt @@ -0,0 +1,16 @@ +--TEST-- +Simple If/ElseIf/Else Test +--FILE-- +<?php +$a=1; + +if($a==0) { + echo "bad"; +} elseif($a==3) { + echo "bad"; +} else { + echo "good"; +} +?> +--EXPECT-- +good diff --git a/tests/lang/006.phpt b/tests/lang/006.phpt new file mode 100644 index 0000000..2a2db01 --- /dev/null +++ b/tests/lang/006.phpt @@ -0,0 +1,23 @@ +--TEST-- +Nested If/ElseIf/Else Test +--FILE-- +<?php +$a=1; +$b=2; + +if($a==0) { + echo "bad"; +} elseif($a==3) { + echo "bad"; +} else { + if($b==1) { + echo "bad"; + } elseif($b==2) { + echo "good"; + } else { + echo "bad"; + } +} +?> +--EXPECT-- +good diff --git a/tests/lang/007.phpt b/tests/lang/007.phpt new file mode 100644 index 0000000..4576d4e --- /dev/null +++ b/tests/lang/007.phpt @@ -0,0 +1,27 @@ +--TEST-- +Function call with global and static variables +--FILE-- +<?php +error_reporting(0); +$a = 10; + +function Test() +{ + static $a=1; + global $b; + $c = 1; + $b = 5; + echo "$a $b "; + $a++; + $c++; + echo "$a $c "; +} + +Test(); +echo "$a $b $c "; +Test(); +echo "$a $b $c "; +Test(); +?> +--EXPECT-- +1 5 2 2 10 5 2 5 3 2 10 5 3 5 4 2 diff --git a/tests/lang/008.phpt b/tests/lang/008.phpt new file mode 100644 index 0000000..d335e6f --- /dev/null +++ b/tests/lang/008.phpt @@ -0,0 +1,18 @@ +--TEST-- +Testing recursive function +--FILE-- +<?php + +function Test() +{ + static $a=1; + echo "$a "; + $a++; + if($a<10): Test(); endif; +} + +Test(); + +?> +--EXPECT-- +1 2 3 4 5 6 7 8 9 diff --git a/tests/lang/009.phpt b/tests/lang/009.phpt new file mode 100644 index 0000000..ea2aa92 --- /dev/null +++ b/tests/lang/009.phpt @@ -0,0 +1,11 @@ +--TEST-- +Testing function parameter passing +--FILE-- +<?php +function test ($a,$b) { + echo $a+$b; +} +test(1,2); +?> +--EXPECT-- +3 diff --git a/tests/lang/010.phpt b/tests/lang/010.phpt new file mode 100644 index 0000000..603abe3 --- /dev/null +++ b/tests/lang/010.phpt @@ -0,0 +1,13 @@ +--TEST-- +Testing function parameter passing with a return value +--FILE-- +<?php +function test ($b) { + $b++; + return($b); +} +$a = test(1); +echo $a; +?> +--EXPECT-- +2 diff --git a/tests/lang/011.phpt b/tests/lang/011.phpt new file mode 100644 index 0000000..771ef7c --- /dev/null +++ b/tests/lang/011.phpt @@ -0,0 +1,23 @@ +--TEST-- +Testing nested functions +--FILE-- +<?php +function F() +{ + $a = "Hello "; + return($a); +} + +function G() +{ + static $myvar = 4; + + echo "$myvar "; + echo F(); + echo "$myvar"; +} + +G(); +?> +--EXPECT-- +4 Hello 4 diff --git a/tests/lang/012.phpt b/tests/lang/012.phpt new file mode 100644 index 0000000..117137a --- /dev/null +++ b/tests/lang/012.phpt @@ -0,0 +1,18 @@ +--TEST-- +Testing stack after early function return +--FILE-- +<?php +function F () { + if(1) { + return("Hello"); + } +} + +$i=0; +while ($i<2) { + echo F(); + $i++; +} +?> +--EXPECT-- +HelloHello diff --git a/tests/lang/013.phpt b/tests/lang/013.phpt new file mode 100644 index 0000000..be84cdc --- /dev/null +++ b/tests/lang/013.phpt @@ -0,0 +1,10 @@ +--TEST-- +Testing eval function +--FILE-- +<?php +error_reporting(0); +$a="echo \"Hello\";"; +eval($a); +?> +--EXPECT-- +Hello diff --git a/tests/lang/014.phpt b/tests/lang/014.phpt new file mode 100644 index 0000000..f0033b2 --- /dev/null +++ b/tests/lang/014.phpt @@ -0,0 +1,13 @@ +--TEST-- +Testing eval function inside user-defined function +--FILE-- +<?php +function F ($a) { + eval($a); +} + +error_reporting(0); +F("echo \"Hello\";"); +?> +--EXPECT-- +Hello diff --git a/tests/lang/015.inc b/tests/lang/015.inc new file mode 100644 index 0000000..d436a7b --- /dev/null +++ b/tests/lang/015.inc @@ -0,0 +1,3 @@ +<?php + echo "Hello"; +?> diff --git a/tests/lang/015.phpt b/tests/lang/015.phpt new file mode 100644 index 0000000..952e7f1 --- /dev/null +++ b/tests/lang/015.phpt @@ -0,0 +1,8 @@ +--TEST-- +Testing include +--FILE-- +<?php +include "015.inc"; +?> +--EXPECT-- +Hello diff --git a/tests/lang/016.inc b/tests/lang/016.inc new file mode 100644 index 0000000..b73333f --- /dev/null +++ b/tests/lang/016.inc @@ -0,0 +1,5 @@ +<?php +function MyFunc ($a) { + echo $a; +} +?> diff --git a/tests/lang/016.phpt b/tests/lang/016.phpt new file mode 100644 index 0000000..dbaa908 --- /dev/null +++ b/tests/lang/016.phpt @@ -0,0 +1,9 @@ +--TEST-- +Testing user-defined function in included file +--FILE-- +<?php +include "016.inc"; +MyFunc("Hello"); +?> +--EXPECT-- +Hello diff --git a/tests/lang/017.phpt b/tests/lang/017.phpt new file mode 100644 index 0000000..fb90964 --- /dev/null +++ b/tests/lang/017.phpt @@ -0,0 +1,18 @@ +--TEST-- +Testing user-defined function falling out of an If into another +--FILE-- +<?php +$a = 1; +function Test ($a) { + if ($a<3) { + return(3); + } +} + +if ($a < Test($a)) { + echo "$a\n"; + $a++; +} +?> +--EXPECT-- +1 diff --git a/tests/lang/018.phpt b/tests/lang/018.phpt new file mode 100644 index 0000000..638b131 --- /dev/null +++ b/tests/lang/018.phpt @@ -0,0 +1,34 @@ +--TEST-- +eval() test +--FILE-- +<?php + +error_reporting(0); + +$message = "echo \"hey\n\";"; + +for ($i=0; $i<10; $i++) { + eval($message); + echo $i."\n"; +} +--EXPECT-- +hey +0 +hey +1 +hey +2 +hey +3 +hey +4 +hey +5 +hey +6 +hey +7 +hey +8 +hey +9 diff --git a/tests/lang/019.phpt b/tests/lang/019.phpt new file mode 100644 index 0000000..c9b5e5f --- /dev/null +++ b/tests/lang/019.phpt @@ -0,0 +1,38 @@ +--TEST-- +eval() test +--FILE-- +<?php + +eval("function test() { echo \"hey, this is a function inside an eval()!\\n\"; }"); + +$i=0; +while ($i<10) { + eval("echo \"hey, this is a regular echo'd eval()\\n\";"); + test(); + $i++; +} + +eval('-'); +--EXPECTF-- +hey, this is a regular echo'd eval() +hey, this is a function inside an eval()! +hey, this is a regular echo'd eval() +hey, this is a function inside an eval()! +hey, this is a regular echo'd eval() +hey, this is a function inside an eval()! +hey, this is a regular echo'd eval() +hey, this is a function inside an eval()! +hey, this is a regular echo'd eval() +hey, this is a function inside an eval()! +hey, this is a regular echo'd eval() +hey, this is a function inside an eval()! +hey, this is a regular echo'd eval() +hey, this is a function inside an eval()! +hey, this is a regular echo'd eval() +hey, this is a function inside an eval()! +hey, this is a regular echo'd eval() +hey, this is a function inside an eval()! +hey, this is a regular echo'd eval() +hey, this is a function inside an eval()! + +Parse error: syntax error, unexpected %s in %s019.php(12) : eval()'d code on line 1 diff --git a/tests/lang/020.phpt b/tests/lang/020.phpt new file mode 100644 index 0000000..46a2a2c --- /dev/null +++ b/tests/lang/020.phpt @@ -0,0 +1,76 @@ +--TEST-- +Switch test 1 +--FILE-- +<?php + +$i="abc"; + +for ($j=0; $j<10; $j++) { +switch (1) { + case 1: + echo "In branch 1\n"; + switch ($i) { + case "ab": + echo "This doesn't work... :(\n"; + break; + case "abcd": + echo "This works!\n"; + break; + case "blah": + echo "Hmmm, no worki\n"; + break; + default: + echo "Inner default...\n"; + } + for ($blah=0; $blah<200; $blah++) { + if ($blah==100) { + echo "blah=$blah\n"; + } + } + break; + case 2: + echo "In branch 2\n"; + break; + case $i: + echo "In branch \$i\n"; + break; + case 4: + echo "In branch 4\n"; + break; + default: + echo "Hi, I'm default\n"; + break; + } +} +?> +--EXPECT-- +In branch 1 +Inner default... +blah=100 +In branch 1 +Inner default... +blah=100 +In branch 1 +Inner default... +blah=100 +In branch 1 +Inner default... +blah=100 +In branch 1 +Inner default... +blah=100 +In branch 1 +Inner default... +blah=100 +In branch 1 +Inner default... +blah=100 +In branch 1 +Inner default... +blah=100 +In branch 1 +Inner default... +blah=100 +In branch 1 +Inner default... +blah=100 diff --git a/tests/lang/021.phpt b/tests/lang/021.phpt new file mode 100644 index 0000000..aff45b6 --- /dev/null +++ b/tests/lang/021.phpt @@ -0,0 +1,42 @@ +--TEST-- +Switch test 2 +--FILE-- +<?php + +for ($i=0; $i<=5; $i++) +{ + echo "i=$i\n"; + + switch($i) { + case 0: + echo "In branch 0\n"; + break; + case 1: + echo "In branch 1\n"; + break; + case 2: + echo "In branch 2\n"; + break; + case 3: + echo "In branch 3\n"; + break 2; + case 4: + echo "In branch 4\n"; + break; + default: + echo "In default\n"; + break; + } +} +echo "hi\n"; +?> +--EXPECT-- +i=0 +In branch 0 +i=1 +In branch 1 +i=2 +In branch 2 +i=3 +In branch 3 +hi diff --git a/tests/lang/022.phpt b/tests/lang/022.phpt new file mode 100644 index 0000000..dddc6c2 --- /dev/null +++ b/tests/lang/022.phpt @@ -0,0 +1,63 @@ +--TEST-- +Switch test 3 +--FILE-- +<?php + +function switchtest ($i, $j) +{ + switch ($i) { + case 0: + switch($j) { + case 0: + echo "zero"; + break; + case 1: + echo "one"; + break; + default: + echo $j; + break; + } + echo "\n"; + break; + default: + echo "Default taken\n"; + } +} +for ($i=0; $i<3; $i++) { + for ($k=0; $k<10; $k++) { + switchtest (0,$k); + } +} +?> +--EXPECT-- +zero +one +2 +3 +4 +5 +6 +7 +8 +9 +zero +one +2 +3 +4 +5 +6 +7 +8 +9 +zero +one +2 +3 +4 +5 +6 +7 +8 +9 diff --git a/tests/lang/023-1.inc b/tests/lang/023-1.inc new file mode 100644 index 0000000..8d52e84 --- /dev/null +++ b/tests/lang/023-1.inc @@ -0,0 +1,356 @@ +<html> +<head> +<?php +/* the point of this file is to intensively test various aspects of + * the parser. right now, each test focuses in one aspect only + * (e.g. variable aliasing, arithemtic operator, various control + * structures), while trying to combine code from other parts of the + * parser as well. + */ +?> + +*** Testing assignments and variable aliasing: ***<br> +<?php + /* This test tests assignments to variables using other variables as variable-names */ + $a = "b"; + $$a = "test"; + $$$a = "blah"; + ${$$$a}["associative arrays work too"] = "this is nifty"; +?> +This should read "blah": <?php echo "$test<br>\n"; ?> +This should read "this is nifty": <?php echo $blah[$test="associative arrays work too"]."<br>\n"; ?> +*************************************************<br> + +*** Testing integer operators ***<br> +<?php + /* test just about any operator possible on $i and $j (ints) */ + $i = 5; + $j = 3; +?> +Correct result - 8: <?php echo $i+$j; ?><br> +Correct result - 8: <?php echo $i+$j; ?><br> +Correct result - 2: <?php echo $i-$j; ?><br> +Correct result - -2: <?php echo $j-$i; ?><br> +Correct result - 15: <?php echo $i*$j; ?><br> +Correct result - 15: <?php echo $j*$i; ?><br> +Correct result - 2: <?php echo $i%$j; ?><br> +Correct result - 3: <?php echo $j%$i; ?><br> +*********************************<br> + +*** Testing real operators ***<br> +<?php + /* test just about any operator possible on $i and $j (floats) */ + $i = 5.0; + $j = 3.0; +?> +Correct result - 8: <?php echo $i+$j; ?><br> +Correct result - 8: <?php echo $i+$j; ?><br> +Correct result - 2: <?php echo $i-$j; ?><br> +Correct result - -2: <?php echo $j-$i; ?><br> +Correct result - 15: <?php echo $i*$j; ?><br> +Correct result - 15: <?php echo $j*$i; ?><br> +Correct result - 2: <?php echo $i%$j; ?><br> +Correct result - 3: <?php echo $j%$i; ?><br> +*********************************<br> + +*** Testing if/elseif/else control ***<br> + +<?php +/* sick if/elseif/else test by Andi :) */ +$a = 5; +if ($a == "4") { + echo "This "." does "." not "." work<br>\n"; +} elseif ($a == "5") { + echo "This "." works<br>\n"; + $a = 6; + if ("andi" == ($test = "andi")) { + echo "this_still_works<br>\n"; + } elseif (1) { + echo "should_not_print<br>\n"; + } else { + echo "should_not_print<br>\n"; + } + if (44 == 43) { + echo "should_not_print<br>\n"; + } else { + echo "should_print<br>\n"; + } +} elseif ($a == 6) { + echo "this "."broken<br>\n"; + if (0) { + echo "this_should_not_print<br>\n"; + } else { + echo "TestingDanglingElse_This_Should_not_print<br>\n"; + } +} else { + echo "This "."does "." not"." work<br>\n"; +} +?> + + +*** Seriously nested if's test ***<br> +** spelling correction by kluzz ** +<?php +/* yet another sick if/elseif/else test by Zeev */ +$i=$j=0; +echo "Only two lines of text should follow:<br>\n"; +if (0) { /* this code is not supposed to be executed */ + echo "hmm, this shouldn't be displayed #1<br>\n"; + $j++; + if (1) { + $i ++= + $j; + if (0) { + $j = ++$i; + if (1) { + $j *= $i; + echo "damn, this shouldn't be displayed<br>\n"; + } else { + $j /= $i; + ++$j; + echo "this shouldn't be displayed either<br>\n"; + } + } elseif (1) { + $i++; $j++; + echo "this isn't supposed to be displayed<br>\n"; + } + } elseif (0) { + $i++; + echo "this definitely shouldn't be displayed<br>\n"; + } else { + --$j; + echo "and this too shouldn't be displayed<br>\n"; + while ($j>0) { + $j--; + } + } +} elseif (2-2) { /* as long as 2-2==0, this isn't supposed to be executed either */ + $i = ++$j; + echo "hmm, this shouldn't be displayed #2<br>\n"; + if (1) { + $j = ++$i; + if (0) { + $j = $i*2+$j*($i++); + if (1) { + $i++; + echo "damn, this shouldn't be displayed<br>\n"; + } else { + $j++; + echo "this shouldn't be displayed either<br>\n"; + } + } else if (1) { + ++$j; + echo "this isn't supposed to be displayed<br>\n"; + } + } elseif (0) { + $j++; + echo "this definitely shouldn't be displayed<br>\n"; + } else { + $i++; + echo "and this too shouldn't be displayed<br>\n"; + } +} else { + $j=$i++; /* this should set $i to 1, but shouldn't change $j (it's assigned $i's previous values, zero) */ + echo "this should be displayed. should be: \$i=1, \$j=0. is: \$i=$i, \$j=$j<br>\n"; + if (1) { + $j += ++$i; /* ++$i --> $i==2, $j += 2 --> $j==2 */ + if (0) { + $j += 40; + if (1) { + $i += 50; + echo "damn, this shouldn't be displayed<br>\n"; + } else { + $j += 20; + echo "this shouldn't be displayed either<br>\n"; + } + } else if (1) { + $j *= $i; /* $j *= 2 --> $j == 4 */ + echo "this is supposed to be displayed. should be: \$i=2, \$j=4. is: \$i=$i, \$j=$j<br>\n"; + echo "3 loop iterations should follow:<br>\n"; + while ($i<=$j) { + echo $i++." $j<br>\n"; + } + } + } elseif (0) { + echo "this definitely shouldn't be displayed<br>\n"; + } else { + echo "and this too shouldn't be displayed<br>\n"; + } + echo "**********************************<br>\n"; +} +?> + +*** C-style else-if's ***<br> +<?php + /* looks like without we even tried, C-style else-if structure works fine! */ + if ($a=0) { + echo "This shouldn't be displayed<br>\n"; + } else if ($a++) { + echo "This shouldn't be displayed either<br>\n"; + } else if (--$a) { + echo "No, this neither<br>\n"; + } else if (++$a) { + echo "This should be displayed<br>\n"; + } else { + echo "This shouldn't be displayed at all<br>\n"; + } +?> +*************************<br> + +*** WHILE tests ***<br> +<?php +$i=0; +$j=20; +while ($i<(2*$j)) { + if ($i>$j) { + echo "$i is greater than $j<br>\n"; + } else if ($i==$j) { + echo "$i equals $j<br>\n"; + } else { + echo "$i is smaller than $j<br>\n"; + } + $i++; +} +?> +*******************<br> + + +*** Nested WHILEs ***<br> +<?php +$arr_len=3; + +$i=0; +while ($i<$arr_len) { + $j=0; + while ($j<$arr_len) { + $k=0; + while ($k<$arr_len) { + ${"test$i$j"}[$k] = $i+$j+$k; + $k++; + } + $j++; + } + $i++; +} + +echo "Each array variable should be equal to the sum of its indices:<br>\n"; + +$i=0; +while ($i<$arr_len) { + $j=0; + while ($j<$arr_len) { + $k=0; + while ($k<$arr_len) { + echo "\${test$i$j}[$k] = ".${"test$i$j"}[$k]."<br>\n"; + $k++; + } + $j++; + } + $i++; +} +?> +*********************<br> + +*** hash test... ***<br> +<?php +/* +$i=0; + +while ($i<10000) { + $arr[$i]=$i; + $i++; +} + +$i=0; +while ($i<10000) { + echo $arr[$i++]."<br>\n"; +} +*/ +echo "commented out..."; +?> + +**************************<br> + +*** Hash resizing test ***<br> +<?php +$i = 10; +$a = 'b'; +while ($i > 0) { + $a = $a . 'a'; + echo "$a<br>\n"; + $resize[$a] = $i; + $i--; +} +$i = 10; +$a = 'b'; +while ($i > 0) { + $a = $a . 'a'; + echo "$a<br>\n"; + echo $resize[$a]."<br>\n"; + $i--; +} +?> +**************************<br> + + +*** break/continue test ***<br> +<?php +$i=0; + +echo "\$i should go from 0 to 2<br>\n"; +while ($i<5) { + if ($i>2) { + break; + } + $j=0; + echo "\$j should go from 3 to 4, and \$q should go from 3 to 4<br>\n"; + while ($j<5) { + if ($j<=2) { + $j++; + continue; + } + echo " \$j=$j<br>\n"; + for ($q=0; $q<=10; $q++) { + if ($q<3) { + continue; + } + if ($q>4) { + break; + } + echo " \$q=$q<br>\n"; + } + $j++; + } + $j=0; + echo "\$j should go from 0 to 2<br>\n"; + while ($j<5) { + if ($j>2) { + $k=0; + echo "\$k should go from 0 to 2<br>\n"; + while ($k<5) { + if ($k>2) { + break 2; + } + echo " \$k=$k<br>\n"; + $k++; + } + } + echo " \$j=$j<br>\n"; + $j++; + } + echo "\$i=$i<br>\n"; + $i++; +} +?> +***********************<br> + +*** Nested file include test ***<br> +<?php include("023-2.inc"); ?> +********************************<br> + +<?php +{ + echo "Tests completed.<br>\n"; # testing some PHP style comment... +} +?> diff --git a/tests/lang/023-2.inc b/tests/lang/023-2.inc new file mode 100644 index 0000000..6dd1e73 --- /dev/null +++ b/tests/lang/023-2.inc @@ -0,0 +1,6 @@ +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +<?php echo "and this is PHP code, 2+2=".(2+2).""; ?> + +</html> diff --git a/tests/lang/023.phpt b/tests/lang/023.phpt new file mode 100644 index 0000000..331308d --- /dev/null +++ b/tests/lang/023.phpt @@ -0,0 +1,256 @@ +--TEST-- +Regression test +--INI-- +date.timezone=UTC +--FILE-- +PHP Regression Test + +<?php + +include("023-1.inc"); + +$wedding_timestamp = mktime(20,0,0,8,31,1997); +$time_left=$wedding_timestamp-time(); + +if ($time_left>0) { + $days = $time_left/(24*3600); + $time_left -= $days*24*3600; + $hours = $time_left/3600; + $time_left -= $hours*3600; + $minutes = $time_left/60; + echo "Limor Ullmann is getting married on ".($wedding_date=date("l, F dS, Y",$wedding_timestamp)).",\nwhich is $days days, $hours hours and $minutes minutes from now.\n"; + echo "Her hashed wedding date is $wedding_date.\n"; +} else { + echo "Limor Ullmann is now Limor Baruch :I\n"; +} +?> +--EXPECT-- +PHP Regression Test + +<html> +<head> + +*** Testing assignments and variable aliasing: ***<br> +This should read "blah": blah<br> +This should read "this is nifty": this is nifty<br> +*************************************************<br> + +*** Testing integer operators ***<br> +Correct result - 8: 8<br> +Correct result - 8: 8<br> +Correct result - 2: 2<br> +Correct result - -2: -2<br> +Correct result - 15: 15<br> +Correct result - 15: 15<br> +Correct result - 2: 2<br> +Correct result - 3: 3<br> +*********************************<br> + +*** Testing real operators ***<br> +Correct result - 8: 8<br> +Correct result - 8: 8<br> +Correct result - 2: 2<br> +Correct result - -2: -2<br> +Correct result - 15: 15<br> +Correct result - 15: 15<br> +Correct result - 2: 2<br> +Correct result - 3: 3<br> +*********************************<br> + +*** Testing if/elseif/else control ***<br> + +This works<br> +this_still_works<br> +should_print<br> + + +*** Seriously nested if's test ***<br> +** spelling correction by kluzz ** +Only two lines of text should follow:<br> +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0<br> +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4<br> +3 loop iterations should follow:<br> +2 4<br> +3 4<br> +4 4<br> +**********************************<br> + +*** C-style else-if's ***<br> +This should be displayed<br> +*************************<br> + +*** WHILE tests ***<br> +0 is smaller than 20<br> +1 is smaller than 20<br> +2 is smaller than 20<br> +3 is smaller than 20<br> +4 is smaller than 20<br> +5 is smaller than 20<br> +6 is smaller than 20<br> +7 is smaller than 20<br> +8 is smaller than 20<br> +9 is smaller than 20<br> +10 is smaller than 20<br> +11 is smaller than 20<br> +12 is smaller than 20<br> +13 is smaller than 20<br> +14 is smaller than 20<br> +15 is smaller than 20<br> +16 is smaller than 20<br> +17 is smaller than 20<br> +18 is smaller than 20<br> +19 is smaller than 20<br> +20 equals 20<br> +21 is greater than 20<br> +22 is greater than 20<br> +23 is greater than 20<br> +24 is greater than 20<br> +25 is greater than 20<br> +26 is greater than 20<br> +27 is greater than 20<br> +28 is greater than 20<br> +29 is greater than 20<br> +30 is greater than 20<br> +31 is greater than 20<br> +32 is greater than 20<br> +33 is greater than 20<br> +34 is greater than 20<br> +35 is greater than 20<br> +36 is greater than 20<br> +37 is greater than 20<br> +38 is greater than 20<br> +39 is greater than 20<br> +*******************<br> + + +*** Nested WHILEs ***<br> +Each array variable should be equal to the sum of its indices:<br> +${test00}[0] = 0<br> +${test00}[1] = 1<br> +${test00}[2] = 2<br> +${test01}[0] = 1<br> +${test01}[1] = 2<br> +${test01}[2] = 3<br> +${test02}[0] = 2<br> +${test02}[1] = 3<br> +${test02}[2] = 4<br> +${test10}[0] = 1<br> +${test10}[1] = 2<br> +${test10}[2] = 3<br> +${test11}[0] = 2<br> +${test11}[1] = 3<br> +${test11}[2] = 4<br> +${test12}[0] = 3<br> +${test12}[1] = 4<br> +${test12}[2] = 5<br> +${test20}[0] = 2<br> +${test20}[1] = 3<br> +${test20}[2] = 4<br> +${test21}[0] = 3<br> +${test21}[1] = 4<br> +${test21}[2] = 5<br> +${test22}[0] = 4<br> +${test22}[1] = 5<br> +${test22}[2] = 6<br> +*********************<br> + +*** hash test... ***<br> +commented out... +**************************<br> + +*** Hash resizing test ***<br> +ba<br> +baa<br> +baaa<br> +baaaa<br> +baaaaa<br> +baaaaaa<br> +baaaaaaa<br> +baaaaaaaa<br> +baaaaaaaaa<br> +baaaaaaaaaa<br> +ba<br> +10<br> +baa<br> +9<br> +baaa<br> +8<br> +baaaa<br> +7<br> +baaaaa<br> +6<br> +baaaaaa<br> +5<br> +baaaaaaa<br> +4<br> +baaaaaaaa<br> +3<br> +baaaaaaaaa<br> +2<br> +baaaaaaaaaa<br> +1<br> +**************************<br> + + +*** break/continue test ***<br> +$i should go from 0 to 2<br> +$j should go from 3 to 4, and $q should go from 3 to 4<br> + $j=3<br> + $q=3<br> + $q=4<br> + $j=4<br> + $q=3<br> + $q=4<br> +$j should go from 0 to 2<br> + $j=0<br> + $j=1<br> + $j=2<br> +$k should go from 0 to 2<br> + $k=0<br> + $k=1<br> + $k=2<br> +$i=0<br> +$j should go from 3 to 4, and $q should go from 3 to 4<br> + $j=3<br> + $q=3<br> + $q=4<br> + $j=4<br> + $q=3<br> + $q=4<br> +$j should go from 0 to 2<br> + $j=0<br> + $j=1<br> + $j=2<br> +$k should go from 0 to 2<br> + $k=0<br> + $k=1<br> + $k=2<br> +$i=1<br> +$j should go from 3 to 4, and $q should go from 3 to 4<br> + $j=3<br> + $q=3<br> + $q=4<br> + $j=4<br> + $q=3<br> + $q=4<br> +$j should go from 0 to 2<br> + $j=0<br> + $j=1<br> + $j=2<br> +$k should go from 0 to 2<br> + $k=0<br> + $k=1<br> + $k=2<br> +$i=2<br> +***********************<br> + +*** Nested file include test ***<br> +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +********************************<br> + +Tests completed.<br> +Limor Ullmann is now Limor Baruch :I diff --git a/tests/lang/024.phpt b/tests/lang/024.phpt new file mode 100644 index 0000000..954b58f --- /dev/null +++ b/tests/lang/024.phpt @@ -0,0 +1,11623 @@ +--TEST-- +Looped regression test (may take a while) +--FILE-- +<?php +for ($jdk=0; $jdk<50; $jdk++) { +?><html> +<head> +<?php /* the point of this file is to intensively test various aspects of the parser. + * right now, each test focuses in one aspect only (e.g. variable aliasing, arithemtic operator, + * various control structures), while trying to combine code from other parts of the parser as well. + */ +?> +*** Testing assignments and variable aliasing: *** +<?php + /* This test tests assignments to variables using other variables as variable-names */ + $a = "b"; + $$a = "test"; + $$$a = "blah"; + ${$$$a}["associative arrays work too"] = "this is nifty"; +?> +This should read "blah": <?php echo "$test\n"; ?> +This should read "this is nifty": <?php echo $blah[$test="associative arrays work too"]."\n"; ?> +************************************************* + +*** Testing integer operators *** +<?php + /* test just about any operator possible on $i and $j (ints) */ + $i = 5; + $j = 3; +?> +Correct result - 8: <?php echo $i+$j; ?> + +Correct result - 8: <?php echo $i+$j; ?> + +Correct result - 2: <?php echo $i-$j; ?> + +Correct result - -2: <?php echo $j-$i; ?> + +Correct result - 15: <?php echo $i*$j; ?> + +Correct result - 15: <?php echo $j*$i; ?> + +Correct result - 2: <?php echo $i%$j; ?> + +Correct result - 3: <?php echo $j%$i; ?> + +********************************* + +*** Testing real operators *** +<?php + /* test just about any operator possible on $i and $j (floats) */ + $i = 5.0; + $j = 3.0; +?> +Correct result - 8: <?php echo $i+$j; ?> + +Correct result - 8: <?php echo $i+$j; ?> + +Correct result - 2: <?php echo $i-$j; ?> + +Correct result - -2: <?php echo $j-$i; ?> + +Correct result - 15: <?php echo $i*$j; ?> + +Correct result - 15: <?php echo $j*$i; ?> + +Correct result - 2: <?php echo $i%$j; ?> + +Correct result - 3: <?php echo $j%$i; ?> + +********************************* + +*** Testing if/elseif/else control *** + +<?php +/* sick if/elseif/else test by Andi :) */ +$a = 5; +if ($a == "4") { + echo "This "." does "." not "." work\n"; +} elseif ($a == "5") { + echo "This "." works\n"; + $a = 6; + if ("andi" == ($test = "andi")) { + echo "this_still_works\n"; + } elseif (1) { + echo "should_not_print\n"; + } else { + echo "should_not_print\n"; + } + if (44 == 43) { + echo "should_not_print\n"; + } else { + echo "should_print\n"; + } +} elseif ($a == 6) { + echo "this "."broken\n"; + if (0) { + echo "this_should_not_print\n"; + } else { + echo "TestingDanglingElse_This_Should_not_print\n"; + } +} else { + echo "This "."does "." not"." work\n"; +} +?> + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +<?php +/* yet another sick if/elseif/else test by Zeev */ +$i=$j=0; +echo "Only two lines of text should follow:\n"; +if (0) { /* this code is not supposed to be executed */ + echo "hmm, this shouldn't be displayed #1\n"; + $j++; + if (1) { + $i += $j; + if (0) { + $j = ++$i; + if (1) { + $j *= $i; + echo "damn, this shouldn't be displayed\n"; + } else { + $j /= $i; + ++$j; + echo "this shouldn't be displayed either\n"; + } + } elseif (1) { + $i++; $j++; + echo "this isn't supposed to be displayed\n"; + } + } elseif (0) { + $i++; + echo "this definitely shouldn't be displayed\n"; + } else { + --$j; + echo "and this too shouldn't be displayed\n"; + while ($j>0) { + $j--; + } + } +} elseif (2-2) { /* as long as 2-2==0, this isn't supposed to be executed either */ + $i = ++$j; + echo "hmm, this shouldn't be displayed #2\n"; + if (1) { + $j = ++$i; + if (0) { + $j = $i*2+$j*($i++); + if (1) { + $i++; + echo "damn, this shouldn't be displayed\n"; + } else { + $j++; + echo "this shouldn't be displayed either\n"; + } + } else if (1) { + ++$j; + echo "this isn't supposed to be displayed\n"; + } + } elseif (0) { + $j++; + echo "this definitely shouldn't be displayed\n"; + } else { + $i++; + echo "and this too shouldn't be displayed\n"; + } +} else { + $j=$i++; /* this should set $i to 1, but shouldn't change $j (it's assigned $i's previous values, zero) */ + echo "this should be displayed. should be: \$i=1, \$j=0. is: \$i=$i, \$j=$j\n"; + if (1) { + $j += ++$i; /* ++$i --> $i==2, $j += 2 --> $j==2 */ + if (0) { + $j += 40; + if (1) { + $i += 50; + echo "damn, this shouldn't be displayed\n"; + } else { + $j += 20; + echo "this shouldn't be displayed either\n"; + } + } else if (1) { + $j *= $i; /* $j *= 2 --> $j == 4 */ + echo "this is supposed to be displayed. should be: \$i=2, \$j=4. is: \$i=$i, \$j=$j\n"; + echo "3 loop iterations should follow:\n"; + while ($i<=$j) { + echo $i++." $j\n"; + } + } + } elseif (0) { + echo "this definitely shouldn't be displayed\n"; + } else { + echo "and this too shouldn't be displayed\n"; + } + echo "**********************************\n"; +} +?> + +*** C-style else-if's *** +<?php + /* looks like without we even tried, C-style else-if structure works fine! */ + if ($a=0) { + echo "This shouldn't be displayed\n"; + } else if ($a++) { + echo "This shouldn't be displayed either\n"; + } else if (--$a) { + echo "No, this neither\n"; + } else if (++$a) { + echo "This should be displayed\n"; + } else { + echo "This shouldn't be displayed at all\n"; + } +?> +************************* + +*** WHILE tests *** +<?php +$i=0; +$j=20; +while ($i<(2*$j)) { + if ($i>$j) { + echo "$i is greater than $j\n"; + } else if ($i==$j) { + echo "$i equals $j\n"; + } else { + echo "$i is smaller than $j\n"; + } + $i++; +} +?> +******************* + + +*** Nested WHILEs *** +<?php +$arr_len=3; + +$i=0; +while ($i<$arr_len) { + $j=0; + while ($j<$arr_len) { + $k=0; + while ($k<$arr_len) { + ${"test$i$j"}[$k] = $i+$j+$k; + $k++; + } + $j++; + } + $i++; +} + +echo "Each array variable should be equal to the sum of its indices:\n"; + +$i=0; +while ($i<$arr_len) { + $j=0; + while ($j<$arr_len) { + $k=0; + while ($k<$arr_len) { + echo "\${test$i$j}[$k] = ".${"test$i$j"}[$k]."\n"; + $k++; + } + $j++; + } + $i++; +} +?> +********************* + +*** hash test... *** +<?php +/* +$i=0; + +while ($i<10000) { + $arr[$i]=$i; + $i++; +} + +$i=0; +while ($i<10000) { + echo $arr[$i++]."\n"; +} +*/ +echo "commented out..."; +?> + +************************** + +*** Hash resizing test *** +<?php +$i = 10; +$a = "b"; +while ($i > 0) { + $a = $a . "a"; + echo "$a\n"; + $resize[$a] = $i; + $i--; +} +$i = 10; +$a = "b"; +while ($i > 0) { + $a = $a . "a"; + echo "$a\n"; + echo $resize[$a]."\n"; + $i--; +} +?> +************************** + + +*** break/continue test *** +<?php +$i=0; + +echo "\$i should go from 0 to 2\n"; +while ($i<5) { + if ($i>2) { + break; + } + $j=0; + echo "\$j should go from 3 to 4, and \$q should go from 3 to 4\n"; + while ($j<5) { + if ($j<=2) { + $j++; + continue; + } + echo " \$j=$j\n"; + for ($q=0; $q<=10; $q++) { + if ($q<3) { + continue; + } + if ($q>4) { + break; + } + echo " \$q=$q\n"; + } + $j++; + } + $j=0; + echo "\$j should go from 0 to 2\n"; + while ($j<5) { + if ($j>2) { + $k=0; + echo "\$k should go from 0 to 2\n"; + while ($k<5) { + if ($k>2) { + break 2; + } + echo " \$k=$k\n"; + $k++; + } + } + echo " \$j=$j\n"; + $j++; + } + echo "\$i=$i\n"; + $i++; +} +?> +*********************** + +*** Nested file include test *** +<?php include("023-2.inc"); ?> +******************************** + +<?php +{ + echo "Tests completed.\n"; # testing some PHP style comment... +} + +} ?> +--EXPECT-- +<html> +<head> +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +******************************** + +Tests completed. +<html> +<head> +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +******************************** + +Tests completed. +<html> +<head> +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +******************************** + +Tests completed. +<html> +<head> +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +******************************** + +Tests completed. +<html> +<head> +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +******************************** + +Tests completed. +<html> +<head> +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +******************************** + +Tests completed. +<html> +<head> +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +******************************** + +Tests completed. +<html> +<head> +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +******************************** + +Tests completed. +<html> +<head> +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +******************************** + +Tests completed. +<html> +<head> +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +******************************** + +Tests completed. +<html> +<head> +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +******************************** + +Tests completed. +<html> +<head> +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +******************************** + +Tests completed. +<html> +<head> +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +******************************** + +Tests completed. +<html> +<head> +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +******************************** + +Tests completed. +<html> +<head> +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +******************************** + +Tests completed. +<html> +<head> +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +******************************** + +Tests completed. +<html> +<head> +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +******************************** + +Tests completed. +<html> +<head> +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +******************************** + +Tests completed. +<html> +<head> +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +******************************** + +Tests completed. +<html> +<head> +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +******************************** + +Tests completed. +<html> +<head> +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +******************************** + +Tests completed. +<html> +<head> +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +******************************** + +Tests completed. +<html> +<head> +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +******************************** + +Tests completed. +<html> +<head> +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +******************************** + +Tests completed. +<html> +<head> +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +******************************** + +Tests completed. +<html> +<head> +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +******************************** + +Tests completed. +<html> +<head> +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +******************************** + +Tests completed. +<html> +<head> +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +******************************** + +Tests completed. +<html> +<head> +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +******************************** + +Tests completed. +<html> +<head> +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +******************************** + +Tests completed. +<html> +<head> +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +******************************** + +Tests completed. +<html> +<head> +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +******************************** + +Tests completed. +<html> +<head> +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +******************************** + +Tests completed. +<html> +<head> +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +******************************** + +Tests completed. +<html> +<head> +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +******************************** + +Tests completed. +<html> +<head> +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +******************************** + +Tests completed. +<html> +<head> +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +******************************** + +Tests completed. +<html> +<head> +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +******************************** + +Tests completed. +<html> +<head> +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +******************************** + +Tests completed. +<html> +<head> +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +******************************** + +Tests completed. +<html> +<head> +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +******************************** + +Tests completed. +<html> +<head> +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +******************************** + +Tests completed. +<html> +<head> +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +******************************** + +Tests completed. +<html> +<head> +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +******************************** + +Tests completed. +<html> +<head> +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +******************************** + +Tests completed. +<html> +<head> +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +******************************** + +Tests completed. +<html> +<head> +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +******************************** + +Tests completed. +<html> +<head> +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +******************************** + +Tests completed. +<html> +<head> +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +******************************** + +Tests completed. +<html> +<head> +*** Testing assignments and variable aliasing: *** +This should read "blah": blah +This should read "this is nifty": this is nifty +************************************************* + +*** Testing integer operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing real operators *** +Correct result - 8: 8 +Correct result - 8: 8 +Correct result - 2: 2 +Correct result - -2: -2 +Correct result - 15: 15 +Correct result - 15: 15 +Correct result - 2: 2 +Correct result - 3: 3 +********************************* + +*** Testing if/elseif/else control *** + +This works +this_still_works +should_print + + +*** Seriously nested if's test *** +** spelling correction by kluzz ** +Only two lines of text should follow: +this should be displayed. should be: $i=1, $j=0. is: $i=1, $j=0 +this is supposed to be displayed. should be: $i=2, $j=4. is: $i=2, $j=4 +3 loop iterations should follow: +2 4 +3 4 +4 4 +********************************** + +*** C-style else-if's *** +This should be displayed +************************* + +*** WHILE tests *** +0 is smaller than 20 +1 is smaller than 20 +2 is smaller than 20 +3 is smaller than 20 +4 is smaller than 20 +5 is smaller than 20 +6 is smaller than 20 +7 is smaller than 20 +8 is smaller than 20 +9 is smaller than 20 +10 is smaller than 20 +11 is smaller than 20 +12 is smaller than 20 +13 is smaller than 20 +14 is smaller than 20 +15 is smaller than 20 +16 is smaller than 20 +17 is smaller than 20 +18 is smaller than 20 +19 is smaller than 20 +20 equals 20 +21 is greater than 20 +22 is greater than 20 +23 is greater than 20 +24 is greater than 20 +25 is greater than 20 +26 is greater than 20 +27 is greater than 20 +28 is greater than 20 +29 is greater than 20 +30 is greater than 20 +31 is greater than 20 +32 is greater than 20 +33 is greater than 20 +34 is greater than 20 +35 is greater than 20 +36 is greater than 20 +37 is greater than 20 +38 is greater than 20 +39 is greater than 20 +******************* + + +*** Nested WHILEs *** +Each array variable should be equal to the sum of its indices: +${test00}[0] = 0 +${test00}[1] = 1 +${test00}[2] = 2 +${test01}[0] = 1 +${test01}[1] = 2 +${test01}[2] = 3 +${test02}[0] = 2 +${test02}[1] = 3 +${test02}[2] = 4 +${test10}[0] = 1 +${test10}[1] = 2 +${test10}[2] = 3 +${test11}[0] = 2 +${test11}[1] = 3 +${test11}[2] = 4 +${test12}[0] = 3 +${test12}[1] = 4 +${test12}[2] = 5 +${test20}[0] = 2 +${test20}[1] = 3 +${test20}[2] = 4 +${test21}[0] = 3 +${test21}[1] = 4 +${test21}[2] = 5 +${test22}[0] = 4 +${test22}[1] = 5 +${test22}[2] = 6 +********************* + +*** hash test... *** +commented out... +************************** + +*** Hash resizing test *** +ba +baa +baaa +baaaa +baaaaa +baaaaaa +baaaaaaa +baaaaaaaa +baaaaaaaaa +baaaaaaaaaa +ba +10 +baa +9 +baaa +8 +baaaa +7 +baaaaa +6 +baaaaaa +5 +baaaaaaa +4 +baaaaaaaa +3 +baaaaaaaaa +2 +baaaaaaaaaa +1 +************************** + + +*** break/continue test *** +$i should go from 0 to 2 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=0 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=1 +$j should go from 3 to 4, and $q should go from 3 to 4 + $j=3 + $q=3 + $q=4 + $j=4 + $q=3 + $q=4 +$j should go from 0 to 2 + $j=0 + $j=1 + $j=2 +$k should go from 0 to 2 + $k=0 + $k=1 + $k=2 +$i=2 +*********************** + +*** Nested file include test *** +<html> +This is Finish.phtml. This file is supposed to be included +from regression_test.phtml. This is normal HTML. +and this is PHP code, 2+2=4 +</html> +******************************** + +Tests completed. diff --git a/tests/lang/025.phpt b/tests/lang/025.phpt new file mode 100644 index 0000000..382960f --- /dev/null +++ b/tests/lang/025.phpt @@ -0,0 +1,531 @@ +--TEST-- +Mean recursion test +--FILE-- +<?php +function RekTest ($nr) { + echo " $nr "; + $j=$nr+1; + while ($j < 10) { + echo " a "; + RekTest($j); + $j++; + echo " b $j "; + } + echo "\n"; +} + +RekTest(0); +?> +--EXPECT-- + 0 a 1 a 2 a 3 a 4 a 5 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 6 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 5 a 5 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 6 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 4 a 4 a 5 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 6 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 5 a 5 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 6 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 3 a 3 a 4 a 5 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 6 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 5 a 5 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 6 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 4 a 4 a 5 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 6 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 5 a 5 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 6 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 2 a 2 a 3 a 4 a 5 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 6 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 5 a 5 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 6 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 4 a 4 a 5 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 6 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 5 a 5 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 6 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 3 a 3 a 4 a 5 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 6 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 5 a 5 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 6 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 4 a 4 a 5 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 6 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 5 a 5 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 6 a 6 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 7 a 7 a 8 a 9 + b 10 + b 9 a 9 + b 10 + b 8 a 8 a 9 + b 10 + b 9 a 9 + b 10 diff --git a/tests/lang/026.phpt b/tests/lang/026.phpt new file mode 100644 index 0000000..eb2d621 --- /dev/null +++ b/tests/lang/026.phpt @@ -0,0 +1,6 @@ +--TEST-- +Testing string scanner confirmance +--FILE-- +<?php echo "\"\t\\'" . '\n\\\'a\\\b\\' ?> +--EXPECT-- +" \'\n\'a\\b\ diff --git a/tests/lang/027.phpt b/tests/lang/027.phpt new file mode 100644 index 0000000..d3eb74b --- /dev/null +++ b/tests/lang/027.phpt @@ -0,0 +1,12 @@ +--TEST-- +Testing do-while loop +--FILE-- +<?php +$i=3; +do { + echo $i; + $i--; +} while($i>0); +?> +--EXPECT-- +321 diff --git a/tests/lang/028.phpt b/tests/lang/028.phpt new file mode 100644 index 0000000..bd4525e --- /dev/null +++ b/tests/lang/028.phpt @@ -0,0 +1,1058 @@ +--TEST-- +Testing calling user-level functions from C +--FILE-- +<?php + +error_reporting(1023); + +function print_stuff($stuff) +{ + print $stuff; +} + + +function still_working() +{ + return "I'm still alive"; +} + +function dafna() +{ + static $foo = 0; + + print "Dafna!\n"; + print call_user_func("still_working")."\n"; + $foo++; + return (string) $foo; +} + + +class dafna_class { + function dafna_class() { + $this->myname = "Dafna"; + } + function GetMyName() { + return $this->myname; + } + function SetMyName($name) { + $this->myname = $name; + } +}; + +for ($i=0; $i<200; $i++): + print "$i\n"; + call_user_func("dafna"); + call_user_func("print_stuff","Hey there!!\n"); + print "$i\n"; +endfor; + + +$dafna = new dafna_class(); + +print $name=call_user_func(array(&$dafna,"GetMyName")); +print "\n"; + +?> +--EXPECT-- +0 +Dafna! +I'm still alive +Hey there!! +0 +1 +Dafna! +I'm still alive +Hey there!! +1 +2 +Dafna! +I'm still alive +Hey there!! +2 +3 +Dafna! +I'm still alive +Hey there!! +3 +4 +Dafna! +I'm still alive +Hey there!! +4 +5 +Dafna! +I'm still alive +Hey there!! +5 +6 +Dafna! +I'm still alive +Hey there!! +6 +7 +Dafna! +I'm still alive +Hey there!! +7 +8 +Dafna! +I'm still alive +Hey there!! +8 +9 +Dafna! +I'm still alive +Hey there!! +9 +10 +Dafna! +I'm still alive +Hey there!! +10 +11 +Dafna! +I'm still alive +Hey there!! +11 +12 +Dafna! +I'm still alive +Hey there!! +12 +13 +Dafna! +I'm still alive +Hey there!! +13 +14 +Dafna! +I'm still alive +Hey there!! +14 +15 +Dafna! +I'm still alive +Hey there!! +15 +16 +Dafna! +I'm still alive +Hey there!! +16 +17 +Dafna! +I'm still alive +Hey there!! +17 +18 +Dafna! +I'm still alive +Hey there!! +18 +19 +Dafna! +I'm still alive +Hey there!! +19 +20 +Dafna! +I'm still alive +Hey there!! +20 +21 +Dafna! +I'm still alive +Hey there!! +21 +22 +Dafna! +I'm still alive +Hey there!! +22 +23 +Dafna! +I'm still alive +Hey there!! +23 +24 +Dafna! +I'm still alive +Hey there!! +24 +25 +Dafna! +I'm still alive +Hey there!! +25 +26 +Dafna! +I'm still alive +Hey there!! +26 +27 +Dafna! +I'm still alive +Hey there!! +27 +28 +Dafna! +I'm still alive +Hey there!! +28 +29 +Dafna! +I'm still alive +Hey there!! +29 +30 +Dafna! +I'm still alive +Hey there!! +30 +31 +Dafna! +I'm still alive +Hey there!! +31 +32 +Dafna! +I'm still alive +Hey there!! +32 +33 +Dafna! +I'm still alive +Hey there!! +33 +34 +Dafna! +I'm still alive +Hey there!! +34 +35 +Dafna! +I'm still alive +Hey there!! +35 +36 +Dafna! +I'm still alive +Hey there!! +36 +37 +Dafna! +I'm still alive +Hey there!! +37 +38 +Dafna! +I'm still alive +Hey there!! +38 +39 +Dafna! +I'm still alive +Hey there!! +39 +40 +Dafna! +I'm still alive +Hey there!! +40 +41 +Dafna! +I'm still alive +Hey there!! +41 +42 +Dafna! +I'm still alive +Hey there!! +42 +43 +Dafna! +I'm still alive +Hey there!! +43 +44 +Dafna! +I'm still alive +Hey there!! +44 +45 +Dafna! +I'm still alive +Hey there!! +45 +46 +Dafna! +I'm still alive +Hey there!! +46 +47 +Dafna! +I'm still alive +Hey there!! +47 +48 +Dafna! +I'm still alive +Hey there!! +48 +49 +Dafna! +I'm still alive +Hey there!! +49 +50 +Dafna! +I'm still alive +Hey there!! +50 +51 +Dafna! +I'm still alive +Hey there!! +51 +52 +Dafna! +I'm still alive +Hey there!! +52 +53 +Dafna! +I'm still alive +Hey there!! +53 +54 +Dafna! +I'm still alive +Hey there!! +54 +55 +Dafna! +I'm still alive +Hey there!! +55 +56 +Dafna! +I'm still alive +Hey there!! +56 +57 +Dafna! +I'm still alive +Hey there!! +57 +58 +Dafna! +I'm still alive +Hey there!! +58 +59 +Dafna! +I'm still alive +Hey there!! +59 +60 +Dafna! +I'm still alive +Hey there!! +60 +61 +Dafna! +I'm still alive +Hey there!! +61 +62 +Dafna! +I'm still alive +Hey there!! +62 +63 +Dafna! +I'm still alive +Hey there!! +63 +64 +Dafna! +I'm still alive +Hey there!! +64 +65 +Dafna! +I'm still alive +Hey there!! +65 +66 +Dafna! +I'm still alive +Hey there!! +66 +67 +Dafna! +I'm still alive +Hey there!! +67 +68 +Dafna! +I'm still alive +Hey there!! +68 +69 +Dafna! +I'm still alive +Hey there!! +69 +70 +Dafna! +I'm still alive +Hey there!! +70 +71 +Dafna! +I'm still alive +Hey there!! +71 +72 +Dafna! +I'm still alive +Hey there!! +72 +73 +Dafna! +I'm still alive +Hey there!! +73 +74 +Dafna! +I'm still alive +Hey there!! +74 +75 +Dafna! +I'm still alive +Hey there!! +75 +76 +Dafna! +I'm still alive +Hey there!! +76 +77 +Dafna! +I'm still alive +Hey there!! +77 +78 +Dafna! +I'm still alive +Hey there!! +78 +79 +Dafna! +I'm still alive +Hey there!! +79 +80 +Dafna! +I'm still alive +Hey there!! +80 +81 +Dafna! +I'm still alive +Hey there!! +81 +82 +Dafna! +I'm still alive +Hey there!! +82 +83 +Dafna! +I'm still alive +Hey there!! +83 +84 +Dafna! +I'm still alive +Hey there!! +84 +85 +Dafna! +I'm still alive +Hey there!! +85 +86 +Dafna! +I'm still alive +Hey there!! +86 +87 +Dafna! +I'm still alive +Hey there!! +87 +88 +Dafna! +I'm still alive +Hey there!! +88 +89 +Dafna! +I'm still alive +Hey there!! +89 +90 +Dafna! +I'm still alive +Hey there!! +90 +91 +Dafna! +I'm still alive +Hey there!! +91 +92 +Dafna! +I'm still alive +Hey there!! +92 +93 +Dafna! +I'm still alive +Hey there!! +93 +94 +Dafna! +I'm still alive +Hey there!! +94 +95 +Dafna! +I'm still alive +Hey there!! +95 +96 +Dafna! +I'm still alive +Hey there!! +96 +97 +Dafna! +I'm still alive +Hey there!! +97 +98 +Dafna! +I'm still alive +Hey there!! +98 +99 +Dafna! +I'm still alive +Hey there!! +99 +100 +Dafna! +I'm still alive +Hey there!! +100 +101 +Dafna! +I'm still alive +Hey there!! +101 +102 +Dafna! +I'm still alive +Hey there!! +102 +103 +Dafna! +I'm still alive +Hey there!! +103 +104 +Dafna! +I'm still alive +Hey there!! +104 +105 +Dafna! +I'm still alive +Hey there!! +105 +106 +Dafna! +I'm still alive +Hey there!! +106 +107 +Dafna! +I'm still alive +Hey there!! +107 +108 +Dafna! +I'm still alive +Hey there!! +108 +109 +Dafna! +I'm still alive +Hey there!! +109 +110 +Dafna! +I'm still alive +Hey there!! +110 +111 +Dafna! +I'm still alive +Hey there!! +111 +112 +Dafna! +I'm still alive +Hey there!! +112 +113 +Dafna! +I'm still alive +Hey there!! +113 +114 +Dafna! +I'm still alive +Hey there!! +114 +115 +Dafna! +I'm still alive +Hey there!! +115 +116 +Dafna! +I'm still alive +Hey there!! +116 +117 +Dafna! +I'm still alive +Hey there!! +117 +118 +Dafna! +I'm still alive +Hey there!! +118 +119 +Dafna! +I'm still alive +Hey there!! +119 +120 +Dafna! +I'm still alive +Hey there!! +120 +121 +Dafna! +I'm still alive +Hey there!! +121 +122 +Dafna! +I'm still alive +Hey there!! +122 +123 +Dafna! +I'm still alive +Hey there!! +123 +124 +Dafna! +I'm still alive +Hey there!! +124 +125 +Dafna! +I'm still alive +Hey there!! +125 +126 +Dafna! +I'm still alive +Hey there!! +126 +127 +Dafna! +I'm still alive +Hey there!! +127 +128 +Dafna! +I'm still alive +Hey there!! +128 +129 +Dafna! +I'm still alive +Hey there!! +129 +130 +Dafna! +I'm still alive +Hey there!! +130 +131 +Dafna! +I'm still alive +Hey there!! +131 +132 +Dafna! +I'm still alive +Hey there!! +132 +133 +Dafna! +I'm still alive +Hey there!! +133 +134 +Dafna! +I'm still alive +Hey there!! +134 +135 +Dafna! +I'm still alive +Hey there!! +135 +136 +Dafna! +I'm still alive +Hey there!! +136 +137 +Dafna! +I'm still alive +Hey there!! +137 +138 +Dafna! +I'm still alive +Hey there!! +138 +139 +Dafna! +I'm still alive +Hey there!! +139 +140 +Dafna! +I'm still alive +Hey there!! +140 +141 +Dafna! +I'm still alive +Hey there!! +141 +142 +Dafna! +I'm still alive +Hey there!! +142 +143 +Dafna! +I'm still alive +Hey there!! +143 +144 +Dafna! +I'm still alive +Hey there!! +144 +145 +Dafna! +I'm still alive +Hey there!! +145 +146 +Dafna! +I'm still alive +Hey there!! +146 +147 +Dafna! +I'm still alive +Hey there!! +147 +148 +Dafna! +I'm still alive +Hey there!! +148 +149 +Dafna! +I'm still alive +Hey there!! +149 +150 +Dafna! +I'm still alive +Hey there!! +150 +151 +Dafna! +I'm still alive +Hey there!! +151 +152 +Dafna! +I'm still alive +Hey there!! +152 +153 +Dafna! +I'm still alive +Hey there!! +153 +154 +Dafna! +I'm still alive +Hey there!! +154 +155 +Dafna! +I'm still alive +Hey there!! +155 +156 +Dafna! +I'm still alive +Hey there!! +156 +157 +Dafna! +I'm still alive +Hey there!! +157 +158 +Dafna! +I'm still alive +Hey there!! +158 +159 +Dafna! +I'm still alive +Hey there!! +159 +160 +Dafna! +I'm still alive +Hey there!! +160 +161 +Dafna! +I'm still alive +Hey there!! +161 +162 +Dafna! +I'm still alive +Hey there!! +162 +163 +Dafna! +I'm still alive +Hey there!! +163 +164 +Dafna! +I'm still alive +Hey there!! +164 +165 +Dafna! +I'm still alive +Hey there!! +165 +166 +Dafna! +I'm still alive +Hey there!! +166 +167 +Dafna! +I'm still alive +Hey there!! +167 +168 +Dafna! +I'm still alive +Hey there!! +168 +169 +Dafna! +I'm still alive +Hey there!! +169 +170 +Dafna! +I'm still alive +Hey there!! +170 +171 +Dafna! +I'm still alive +Hey there!! +171 +172 +Dafna! +I'm still alive +Hey there!! +172 +173 +Dafna! +I'm still alive +Hey there!! +173 +174 +Dafna! +I'm still alive +Hey there!! +174 +175 +Dafna! +I'm still alive +Hey there!! +175 +176 +Dafna! +I'm still alive +Hey there!! +176 +177 +Dafna! +I'm still alive +Hey there!! +177 +178 +Dafna! +I'm still alive +Hey there!! +178 +179 +Dafna! +I'm still alive +Hey there!! +179 +180 +Dafna! +I'm still alive +Hey there!! +180 +181 +Dafna! +I'm still alive +Hey there!! +181 +182 +Dafna! +I'm still alive +Hey there!! +182 +183 +Dafna! +I'm still alive +Hey there!! +183 +184 +Dafna! +I'm still alive +Hey there!! +184 +185 +Dafna! +I'm still alive +Hey there!! +185 +186 +Dafna! +I'm still alive +Hey there!! +186 +187 +Dafna! +I'm still alive +Hey there!! +187 +188 +Dafna! +I'm still alive +Hey there!! +188 +189 +Dafna! +I'm still alive +Hey there!! +189 +190 +Dafna! +I'm still alive +Hey there!! +190 +191 +Dafna! +I'm still alive +Hey there!! +191 +192 +Dafna! +I'm still alive +Hey there!! +192 +193 +Dafna! +I'm still alive +Hey there!! +193 +194 +Dafna! +I'm still alive +Hey there!! +194 +195 +Dafna! +I'm still alive +Hey there!! +195 +196 +Dafna! +I'm still alive +Hey there!! +196 +197 +Dafna! +I'm still alive +Hey there!! +197 +198 +Dafna! +I'm still alive +Hey there!! +198 +199 +Dafna! +I'm still alive +Hey there!! +199 +Dafna + diff --git a/tests/lang/030.phpt b/tests/lang/030.phpt new file mode 100644 index 0000000..758369b --- /dev/null +++ b/tests/lang/030.phpt @@ -0,0 +1,36 @@ +--TEST-- +$this in constructor test +--FILE-- +<?php +class foo { + function foo($name) { + $GLOBALS['List']= &$this; + $this->Name = $name; + $GLOBALS['List']->echoName(); + } + + function echoName() { + $GLOBALS['names'][]=$this->Name; + } +} + +function &foo2(&$foo) { + return $foo; +} + + +$bar1 =new foo('constructor'); +$bar1->Name = 'outside'; +$bar1->echoName(); +$List->echoName(); + +$bar1 =& foo2(new foo('constructor')); +$bar1->Name = 'outside'; +$bar1->echoName(); + +$List->echoName(); + +print ($names==array('constructor','outside','outside','constructor','outside','outside')) ? 'success':'failure'; +?> +--EXPECT-- +success diff --git a/tests/lang/031.phpt b/tests/lang/031.phpt new file mode 100644 index 0000000..b2d1e63 --- /dev/null +++ b/tests/lang/031.phpt @@ -0,0 +1,70 @@ +--TEST-- +Bug #16227 (Internal hash position bug on assignment) +--FILE-- +<?php +// reported by php.net@alienbill.com +$arrayOuter = array("key1","key2"); +$arrayInner = array("0","1"); + +print "Correct - with inner loop reset.\n"; + +while(list(,$o) = each($arrayOuter)){ + reset($arrayInner); + while(list(,$i) = each($arrayInner)){ + print "inloop $i for $o\n"; + } +} +reset($arrayOuter); +reset($arrayInner); + +print "What happens without inner loop reset.\n"; + +while(list(,$o) = each($arrayOuter)){ + while(list(,$i) = each($arrayInner)){ + print "inloop $i for $o\n"; + } +} +reset($arrayOuter); +reset($arrayInner); + +print "What happens without inner loop reset but copy.\n"; + +while(list(,$o) = each($arrayOuter)){ + $placeholder = $arrayInner; + while(list(,$i) = each($arrayInner)){ + print "inloop $i for $o\n"; + } +} +reset($arrayOuter); +reset($arrayInner); + +print "What happens with inner loop reset over copy.\n"; + +while(list(,$o) = each($arrayOuter)){ + $placeholder = $arrayInner; + while(list(,$i) = each($placeholder)){ + print "inloop $i for $o\n"; + } +} +reset($arrayOuter); +reset($arrayInner); +?> +--EXPECT-- +Correct - with inner loop reset. +inloop 0 for key1 +inloop 1 for key1 +inloop 0 for key2 +inloop 1 for key2 +What happens without inner loop reset. +inloop 0 for key1 +inloop 1 for key1 +What happens without inner loop reset but copy. +inloop 0 for key1 +inloop 1 for key1 +inloop 0 for key2 +inloop 1 for key2 +What happens with inner loop reset over copy. +inloop 0 for key1 +inloop 1 for key1 +inloop 0 for key2 +inloop 1 for key2 diff --git a/tests/lang/032.phpt b/tests/lang/032.phpt new file mode 100644 index 0000000..caa4c7e --- /dev/null +++ b/tests/lang/032.phpt @@ -0,0 +1,36 @@ +--TEST-- +Class method registration +--FILE-- +<?php +class A { + function foo() {} +} + +class B extends A { + function foo() {} +} + +class C extends B { + function foo() {} +} + +class D extends A { +} + +class F extends D { + function foo() {} +} + +// Following class definition should fail, but cannot test +/* +class X { + function foo() {} + function foo() {} +} +*/ + +echo "OK\n"; +?> +--EXPECT-- +OK + diff --git a/tests/lang/033.phpt b/tests/lang/033.phpt new file mode 100644 index 0000000..21e3768 --- /dev/null +++ b/tests/lang/033.phpt @@ -0,0 +1,47 @@ +--TEST-- +Alternative syntaxes test +--FILE-- +<?php +$a = 1; + +echo "If: "; +if ($a) echo 1; else echo 0; +if ($a): + echo 1; +else: + echo 0; +endif; + +echo "\nWhile: "; +while ($a<5) echo $a++; +while ($a<9): + echo ++$a; +endwhile; + +echo "\nFor: "; +for($a=0;$a<5;$a++) echo $a; +for($a=0;$a<5;$a++): + echo $a; +endfor; + +echo "\nSwitch: "; +switch ($a): + case 0; + echo 0; + break; + case 5: + echo 1; + break; + default; + echo 0; + break; +endswitch; +?> + +===DONE=== +--EXPECT-- +If: 11 +While: 12346789 +For: 0123401234 +Switch: 1 +===DONE=== diff --git a/tests/lang/034.phpt b/tests/lang/034.phpt new file mode 100644 index 0000000..cea0797 --- /dev/null +++ b/tests/lang/034.phpt @@ -0,0 +1,23 @@ +--TEST-- +Bug #12647 (Locale settings affecting float parsing) +--INI-- +precision=14 +--SKIPIF-- +<?php # try to activate a german locale +if (substr(PHP_OS, 0, 3) == 'WIN') { + /* skip on windows until #63688 was fixed */ + die('skip'); +} +if (setlocale(LC_NUMERIC, "de_DE.UTF-8", "de_DE", "de", "german", "ge", "de_DE.ISO-8859-1") === FALSE) { + print "skip Can't find german locale"; +} +?> +--FILE-- +<?php +# activate the german locale +setlocale(LC_NUMERIC, "de_DE.UTF-8", "de_DE", "de", "german", "ge", "de_DE.ISO-8859-1"); + +echo (float)"3.14", "\n"; +?> +--EXPECT-- +3,14 diff --git a/tests/lang/035.phpt b/tests/lang/035.phpt new file mode 100644 index 0000000..9472999 --- /dev/null +++ b/tests/lang/035.phpt @@ -0,0 +1,38 @@ +--TEST-- +ZE2: set_exception_handler() +--SKIPIF-- +<?php if (version_compare(zend_version(), "2.0.0-dev", "<")) print "skip Zend engine 2 required"; ?> +--FILE-- +<?php +class MyException extends Exception { + 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 shouldn't be an exception: " . $exception->getException(); + print "\n"; +} + +try { + ThrowException(); +} catch (MyException $exception) { + print "There was an exception: " . $exception->getException(); + print "\n"; +} +?> +--EXPECT-- +There was an exception: 'This is an exception!' diff --git a/tests/lang/036.phpt b/tests/lang/036.phpt new file mode 100644 index 0000000..474316e --- /dev/null +++ b/tests/lang/036.phpt @@ -0,0 +1,27 @@ +--TEST-- +Child public element should not override parent private element in parent methods +--FILE-- +<?php +class par { + private $id = "foo"; + + function displayMe() + { + print $this->id; + } +}; + +class chld extends par { + public $id = "bar"; + function displayHim() + { + parent::displayMe(); + } +}; + + +$obj = new chld(); +$obj->displayHim(); +?> +--EXPECT-- +foo diff --git a/tests/lang/037.phpt b/tests/lang/037.phpt new file mode 100644 index 0000000..c2a1ee3 --- /dev/null +++ b/tests/lang/037.phpt @@ -0,0 +1,30 @@ +--TEST-- +'Static' binding for private variables +--FILE-- +<?php + +class par { + private $id="foo"; + + function displayMe() + { + $this->displayChild(); + } +}; + +class chld extends par { + private $id = "bar"; + + function displayChild() + { + print $this->id; + } +}; + + +$obj = new chld(); +$obj->displayMe(); + +?> +--EXPECT-- +bar diff --git a/tests/lang/038.phpt b/tests/lang/038.phpt new file mode 100644 index 0000000..195050b --- /dev/null +++ b/tests/lang/038.phpt @@ -0,0 +1,41 @@ +--TEST-- +Convert warnings to exceptions +--FILE-- +<?php + +class MyException extends Exception +{ + function __construct($errstr, $errno=0, $errfile='', $errline='') + { + parent::__construct($errstr, $errno); + $this->file = $errfile; + $this->line = $errline; + } +} + +function Error2Exception($errno, $errstr, $errfile, $errline) +{ + throw new MyException($errstr, $errno);//, $errfile, $errline); +} + +$err_msg = 'no exception'; +set_error_handler('Error2Exception'); + +try +{ + $con = fopen("/tmp/a_file_that_does_not_exist",'r'); +} +catch (Exception $e) +{ + $trace = $e->getTrace(); + var_dump($trace[0]['function']); + var_dump($trace[1]['function']); +} + +?> +===DONE=== +<?php exit(0); ?> +--EXPECTF-- +string(15) "Error2Exception" +string(5) "fopen" +===DONE=== diff --git a/tests/lang/039.phpt b/tests/lang/039.phpt new file mode 100644 index 0000000..aa4b591 --- /dev/null +++ b/tests/lang/039.phpt @@ -0,0 +1,45 @@ +--TEST-- +Catch Interfaces +--FILE-- +<?php + +interface Catchable +{ +} + +class MyException extends Exception implements Catchable +{ + function __construct($errstr, $errno, $errfile, $errline) + { + parent::__construct($errstr, $errno); + $this->file = $errfile; + $this->line = $errline; + } +} + +function Error2Exception($errno, $errstr, $errfile, $errline) +{ + throw new MyException($errstr, $errno, $errfile, $errline); +} + +$err_msg = 'no exception'; +set_error_handler('Error2Exception'); + +try +{ + $con = fopen('/tmp/a_file_that_does_not_exist','r'); +} +catch (Catchable $e) +{ + echo "Catchable\n"; +} +catch (Exception $e) +{ + echo "Exception\n"; +} + +?> +===DONE=== +--EXPECTF-- +Catchable +===DONE=== diff --git a/tests/lang/040.phpt b/tests/lang/040.phpt new file mode 100644 index 0000000..6d8ece9 --- /dev/null +++ b/tests/lang/040.phpt @@ -0,0 +1,15 @@ +--TEST-- +foreach into array +--FILE-- +<?php +$a = array(0,1); +$b[0]=2; +foreach($a as $b[0]) { + echo $b[0]."\n"; +} +?> +===DONE=== +--EXPECT-- +0 +1 +===DONE=== diff --git a/tests/lang/041.phpt b/tests/lang/041.phpt new file mode 100644 index 0000000..6972412 --- /dev/null +++ b/tests/lang/041.phpt @@ -0,0 +1,20 @@ +--TEST-- +Dynamic access of static members +--FILE-- +<?php +class A { + public static $b = 'foo'; +} + +$classname = 'A'; +$wrongClassname = 'B'; + +echo $classname::$b."\n"; +echo $wrongClassname::$b."\n"; + +?> +===DONE=== +--EXPECTF-- +foo + +Fatal error: Class 'B' not found in %s041.php on line %d diff --git a/tests/lang/042.phpt b/tests/lang/042.phpt new file mode 100644 index 0000000..217aab8 --- /dev/null +++ b/tests/lang/042.phpt @@ -0,0 +1,19 @@ +--TEST-- +Dynamic access of constants +--FILE-- +<?php +class A { + const B = 'foo'; +} + +$classname = 'A'; +$wrongClassname = 'B'; + +echo $classname::B."\n"; +echo $wrongClassname::B."\n"; +?> +===DONE=== +--EXPECTF-- +foo + +Fatal error: Class 'B' not found in %s042.php on line %d diff --git a/tests/lang/043.phpt b/tests/lang/043.phpt new file mode 100644 index 0000000..7ca2d74 --- /dev/null +++ b/tests/lang/043.phpt @@ -0,0 +1,19 @@ +--TEST-- +Dynamic call for static methods +--FILE-- +<?php +class A { + static function foo() { return 'foo'; } +} + +$classname = 'A'; +$wrongClassname = 'B'; + +echo $classname::foo()."\n"; +echo $wrongClassname::foo()."\n"; +?> +===DONE=== +--EXPECTF-- +foo + +Fatal error: Class 'B' not found in %s043.php on line %d diff --git a/tests/lang/044.phpt b/tests/lang/044.phpt new file mode 100644 index 0000000..a0de889 --- /dev/null +++ b/tests/lang/044.phpt @@ -0,0 +1,21 @@ +--TEST-- +Dynamic call for static methods dynamically named +--FILE-- +<?php +class A { + static function foo() { return 'foo'; } +} +$classname = 'A'; +$wrongClassname = 'B'; + +$methodname = 'foo'; + +echo $classname::$methodname()."\n"; + +echo $wrongClassname::$methodname()."\n"; +?> +===DONE=== +--EXPECTF-- +foo + +Fatal error: Class 'B' not found in %s044.php on line %d diff --git a/tests/lang/045.phpt b/tests/lang/045.phpt new file mode 100644 index 0000000..11598cf --- /dev/null +++ b/tests/lang/045.phpt @@ -0,0 +1,27 @@ +--TEST-- +Timeout again inside register_shutdown_function +--SKIPIF-- +<?php +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +?> +--FILE-- +<?php +set_time_limit(1); +register_shutdown_function("plop"); + +function plop() { + $ts = time(); + while(true) { + if ((time()-$ts) > 2) { + echo "Failed!"; + break; + } + } +} +plop(); +?> +===DONE=== +--EXPECTF-- +Fatal error: Maximum execution time of 1 second exceeded in %s on line %d + +Fatal error: Maximum execution time of 1 second exceeded in %s on line %d diff --git a/tests/lang/array_shortcut_001.phpt b/tests/lang/array_shortcut_001.phpt new file mode 100644 index 0000000..18a10ea --- /dev/null +++ b/tests/lang/array_shortcut_001.phpt @@ -0,0 +1,13 @@ +--TEST-- +Square bracket array shortcut test +--FILE-- +<?php +print_r([1, 2, 3]); +?> +--EXPECT-- +Array +( + [0] => 1 + [1] => 2 + [2] => 3 +) diff --git a/tests/lang/array_shortcut_002.phpt b/tests/lang/array_shortcut_002.phpt new file mode 100644 index 0000000..25aee9b --- /dev/null +++ b/tests/lang/array_shortcut_002.phpt @@ -0,0 +1,13 @@ +--TEST-- +Square bracket associative array shortcut test +--FILE-- +<?php +print_r(["foo" => "orange", "bar" => "apple", "baz" => "lemon"]); +?> +--EXPECT-- +Array +( + [foo] => orange + [bar] => apple + [baz] => lemon +) diff --git a/tests/lang/array_shortcut_003.phpt b/tests/lang/array_shortcut_003.phpt new file mode 100644 index 0000000..75e428b --- /dev/null +++ b/tests/lang/array_shortcut_003.phpt @@ -0,0 +1,13 @@ +--TEST-- +Testing array shortcut and bracket operator +--FILE-- +<?php +$a = [1, 2, 3, 4, 5]; +print_r([$a[1], $a[3]]); +?> +--EXPECT-- +Array +( + [0] => 2 + [1] => 4 +) diff --git a/tests/lang/array_shortcut_005.phpt b/tests/lang/array_shortcut_005.phpt new file mode 100644 index 0000000..7cc7386 --- /dev/null +++ b/tests/lang/array_shortcut_005.phpt @@ -0,0 +1,20 @@ +--TEST-- +Testing nested array shortcut +--FILE-- +<?php +print_r([1, 2, 3, ["foo" => "orange", "bar" => "apple", "baz" => "lemon"]]); +?> +--EXPECT-- +Array +( + [0] => 1 + [1] => 2 + [2] => 3 + [3] => Array + ( + [foo] => orange + [bar] => apple + [baz] => lemon + ) + +) diff --git a/tests/lang/bison1.phpt b/tests/lang/bison1.phpt new file mode 100644 index 0000000..3571576 --- /dev/null +++ b/tests/lang/bison1.phpt @@ -0,0 +1,9 @@ +--TEST-- +Bison weirdness +--FILE-- +<?php +error_reporting(E_ALL & ~E_NOTICE); +echo "blah-$foo\n"; +?> +--EXPECT-- +blah- diff --git a/tests/lang/bug17115.phpt b/tests/lang/bug17115.phpt new file mode 100644 index 0000000..0cb3bf4 --- /dev/null +++ b/tests/lang/bug17115.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #17115 (lambda functions produce segfault with static vars) +--FILE-- +<?php +$func = create_function('',' + static $foo = 0; + return $foo++; +'); +var_dump($func()); +var_dump($func()); +var_dump($func()); +?> +--EXPECT-- +int(0) +int(1) +int(2) diff --git a/tests/lang/bug18872.phpt b/tests/lang/bug18872.phpt new file mode 100644 index 0000000..2e3dc22 --- /dev/null +++ b/tests/lang/bug18872.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug #18872 (class constant used as default parameter) +--FILE-- +<?php +class FooBar { + const BIFF = 3; +} + +function foo($biff = FooBar::BIFF) { + echo $biff . "\n"; +} + +foo(); +foo(); +?> +--EXPECT-- +3 +3 diff --git a/tests/lang/bug19566.phpt b/tests/lang/bug19566.phpt new file mode 100644 index 0000000..45c3bc5 --- /dev/null +++ b/tests/lang/bug19566.phpt @@ -0,0 +1,10 @@ +--TEST-- +Bug #19566 (get_declared_classes() segfaults) +--FILE-- +<?php +class foo {} +$result = get_declared_classes(); +var_dump(array_search('foo', $result)); +?> +--EXPECTF-- +int(%d) diff --git a/tests/lang/bug19943.phpt b/tests/lang/bug19943.phpt new file mode 100644 index 0000000..c951190 --- /dev/null +++ b/tests/lang/bug19943.phpt @@ -0,0 +1,29 @@ +--TEST-- +Bug #19943 (memleaks) +--FILE-- +<?php + $ar = array(); + for ($count = 0; $count < 10; $count++) { + $ar[$count] = "$count"; + @$ar[$count]['idx'] = "$count"; + } + + for ($count = 0; $count < 10; $count++) { + echo $ar[$count]." -- ".@$ar[$count]['idx']."\n"; + } + $a = "0123456789"; + $a[9] = $a[0]; + var_dump($a); +?> +--EXPECT-- +0 -- 0 +1 -- 1 +2 -- 2 +3 -- 3 +4 -- 4 +5 -- 5 +6 -- 6 +7 -- 7 +8 -- 8 +9 -- 9 +string(10) "0123456780" diff --git a/tests/lang/bug20175.phpt b/tests/lang/bug20175.phpt new file mode 100644 index 0000000..7c6ec78 --- /dev/null +++ b/tests/lang/bug20175.phpt @@ -0,0 +1,169 @@ +--TEST-- +Bug #20175 (Static vars can't store ref to new instance) +--SKIPIF-- +<?php if (version_compare(zend_version(),'2.0.0-dev','<')) die('skip ZE1 does not have static class members'); ?> +--INI-- +error_reporting=E_ALL | E_STRICT | E_DEPRECATED +--FILE-- +<?php +print zend_version()."\n"; + +/* Part 1: + * Storing the result of a function in a static variable. + * foo_global() increments global variable $foo_count whenever it is executed. + * When foo_static() is called it checks for the static variable $foo_value + * being initialised. In case initialisation is necessary foo_global() will be + * called. Since that must happen only once the return value should be equal. + */ +$foo_count = 0; + +function foo_global() { + global $foo_count; + echo "foo_global()\n"; + return 'foo:' . ++$foo_count; +} + +function foo_static() { + static $foo_value; + echo "foo_static()\n"; + if (!isset($foo_value)) { + $foo_value = foo_global(); + } + return $foo_value; +} + +/* Part 2: + * Storing a reference to the result of a function in a static variable. + * Same as Part 1 but: + * The return statment transports a copy of the value to return. In other + * words the return value of bar_global() is a temporary variable only valid + * after the function call bar_global() is done in current local scope. + */ +$bar_count = 0; + +function bar_global() { + global $bar_count; + echo "bar_global()\n"; + return 'bar:' . ++$bar_count; +} + +function bar_static() { + static $bar_value; + echo "bar_static()\n"; + if (!isset($bar_value)) { + $bar_value = &bar_global(); + } + return $bar_value; +} + +/* Part 3: TO BE DISCUSSED + * + * Storing a reference to the result of a function in a static variable. + * Same as Part 2 but wow_global() returns a reference so $wow_value + * should store a reference to $wow_global. Therefor $wow_value is already + * initialised in second call to wow_static() and hence shouldn't call + * wow_global() again. + */ /* +$wow_count = 0; +$wow_name = ''; + +function &wow_global() { + global $wow_count, $wow_name; + echo "wow_global()\n"; + $wow_name = 'wow:' . ++$wow_count; + return $wow_name; +} + +function wow_static() { + static $wow_value; + echo "wow_static()\n"; + if (!isset($wow_value)) { + $wow_value = &wow_global(); + } + return $wow_value; +}*/ + +/* Part 4: + * Storing a reference to a new instance (that's where the name of the test + * comes from). First there is the global counter $oop_global again which + * counts the calls to the constructor of oop_class and hence counts the + * creation of oop_class instances. + * The class oop_test uses a static reference to a oop_class instance. + * When another oop_test instance is created it must reuse the statically + * stored reference oop_value. This way oop_class gets some singleton behavior + * since it will be created only once for all insatnces of oop_test. + */ +$oop_global = 0; +class oop_class { + var $oop_name; + + function oop_class() { + global $oop_global; + echo "oop_class()\n"; + $this->oop_name = 'oop:' . ++$oop_global; + } +} + +class oop_test { + static $oop_value; + + function oop_test() { + echo "oop_test()\n"; + } + + function oop_static() { + echo "oop_static()\n"; + if (!isset(self::$oop_value)) { + self::$oop_value = & new oop_class; + } + echo self::$oop_value->oop_name; + } +} + +print foo_static()."\n"; +print foo_static()."\n"; +print bar_static()."\n"; +print bar_static()."\n"; +//print wow_static()."\n"; +//print wow_static()."\n"; +echo "wow_static() +wow_global() +wow:1 +wow_static() +wow:1 +"; +$oop_tester = new oop_test; +print $oop_tester->oop_static()."\n"; +print $oop_tester->oop_static()."\n"; +$oop_tester = new oop_test; // repeated. +print $oop_tester->oop_static()."\n"; +?> +--EXPECTF-- +Deprecated: Assigning the return value of new by reference is deprecated in %s.php on line %d +%s +foo_static() +foo_global() +foo:1 +foo_static() +foo:1 +bar_static() +bar_global() + +Strict Standards: Only variables should be assigned by reference in %sbug20175.php on line 47 +bar:1 +bar_static() +bar:1 +wow_static() +wow_global() +wow:1 +wow_static() +wow:1 +oop_test() +oop_static() +oop_class() +oop:1 +oop_static() +oop:1 +oop_test() +oop_static() +oop:1 diff --git a/tests/lang/bug21094.phpt b/tests/lang/bug21094.phpt new file mode 100644 index 0000000..266a1d6 --- /dev/null +++ b/tests/lang/bug21094.phpt @@ -0,0 +1,17 @@ +--TEST-- +Bug #21094 (set_error_handler not accepting methods) +--FILE-- +<?php +class test { + function hdlr($errno, $errstr, $errfile, $errline) { + printf("[%d] errstr: %s, errfile: %s, errline: %d\n", $errno, $errstr, $errfile, $errline, $errstr); + } +} + +set_error_handler(array(new test(), "hdlr")); + +trigger_error("test"); +?> +--EXPECTF-- +[1024] errstr: test, errfile: %s, errline: %d + diff --git a/tests/lang/bug21600.phpt b/tests/lang/bug21600.phpt new file mode 100644 index 0000000..6ecf69a --- /dev/null +++ b/tests/lang/bug21600.phpt @@ -0,0 +1,39 @@ +--TEST-- +Bug #21600 (assign by reference function call changes variable contents) +--INI-- +error_reporting=4095 +--FILE-- +<?php +$tmp = array(); +$tmp['foo'] = "test"; +$tmp['foo'] = &bar($tmp['foo']); +var_dump($tmp); + +unset($tmp); + +$tmp = array(); +$tmp['foo'] = "test"; +$tmp['foo'] = &fubar($tmp['foo']); +var_dump($tmp); + +function bar($text){ + return $text; +} + +function fubar($text){ + $text = &$text; + return $text; +} +?> +--EXPECTF-- +Strict Standards: Only variables should be assigned by reference in %sbug21600.php on line 4 +array(1) { + ["foo"]=> + string(4) "test" +} + +Strict Standards: Only variables should be assigned by reference in %sbug21600.php on line 11 +array(1) { + ["foo"]=> + string(4) "test" +} diff --git a/tests/lang/bug21669.phpt b/tests/lang/bug21669.phpt new file mode 100644 index 0000000..643b069 --- /dev/null +++ b/tests/lang/bug21669.phpt @@ -0,0 +1,23 @@ +--TEST-- +Bug #21669 ("$obj = new $this->var;" doesn't work) +--FILE-- +<?php +class Test { + function say_hello() { + echo "Hello world"; + } +} + +class Factory { + public $name = "Test"; + function create() { + $obj = new $this->name; /* Parse error */ + return $obj; + } +} +$factory = new Factory; +$test = $factory->create(); +$test->say_hello(); +?> +--EXPECT-- +Hello world diff --git a/tests/lang/bug21820.phpt b/tests/lang/bug21820.phpt new file mode 100644 index 0000000..cbf466e --- /dev/null +++ b/tests/lang/bug21820.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #21820 ("$arr['foo']" generates bogus E_NOTICE, should be E_PARSE) +--FILE-- +<?php + +error_reporting(E_ALL); + +$arr = array('foo' => 'bar'); +echo "$arr['foo']"; + +?> +--EXPECTF-- +Parse error: %s error, %s(T_STRING)%s(T_VARIABLE)%s(T_NUM_STRING)%sin %sbug21820.php on line %d diff --git a/tests/lang/bug21849.phpt b/tests/lang/bug21849.phpt new file mode 100644 index 0000000..30b3113 --- /dev/null +++ b/tests/lang/bug21849.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #21849 (self::constant doesn't work as method's default parameter) +--FILE-- +<?php +class foo { + const bar = "fubar\n"; + + function foo($arg = self::bar) { + echo $arg; + } +} + +new foo(); +?> +--EXPECT-- +fubar diff --git a/tests/lang/bug21961.phpt b/tests/lang/bug21961.phpt new file mode 100644 index 0000000..24581d6 --- /dev/null +++ b/tests/lang/bug21961.phpt @@ -0,0 +1,58 @@ +--TEST-- +Bug #21961 (get_parent_class() segfault) +--SKIPIF-- +<?php if (version_compare(zend_version(),'2.0.0-dev','<')) die('skip prepared for ZE2'); ?> +--FILE-- +<?php + +class man +{ + public $name, $bars; + function man() + { + $this->name = 'Mr. X'; + $this->bars = array(); + } + + function getdrunk($where) + { + $this->bars[] = new bar($where); + } + + function getName() + { + return $this->name; + } +} + +class bar extends man +{ + public $name; + + function bar($w) + { + $this->name = $w; + } + + function getName() + { + return $this->name; + } + + function whosdrunk() + { + $who = get_parent_class($this); + if($who == NULL) + { + return 'nobody'; + } + return eval("return ".$who.'::getName();'); + } +} + +$x = new man; +$x->getdrunk('The old Tavern'); +var_dump($x->bars[0]->whosdrunk()); +?> +--EXPECT-- +string(14) "The old Tavern" diff --git a/tests/lang/bug22231.phpt b/tests/lang/bug22231.phpt new file mode 100644 index 0000000..ede6a37 --- /dev/null +++ b/tests/lang/bug22231.phpt @@ -0,0 +1,42 @@ +--TEST-- +Bug #22231 (segfault when returning a global variable by reference) +--INI-- +error_reporting=E_ALL | E_DEPRECATED +--FILE-- +<?php +class foo { + public $fubar = 'fubar'; +} + +function &foo(){ + $GLOBALS['foo'] = &new foo(); + return $GLOBALS['foo']; +} +$bar = &foo(); +var_dump($bar); +var_dump($bar->fubar); +unset($bar); +$bar = &foo(); +var_dump($bar->fubar); + +$foo = &foo(); +var_dump($foo); +var_dump($foo->fubar); +unset($foo); +$foo = &foo(); +var_dump($foo->fubar); +?> +--EXPECTF-- +Deprecated: Assigning the return value of new by reference is deprecated in %s on line %d +object(foo)#%d (1) { + ["fubar"]=> + string(5) "fubar" +} +string(5) "fubar" +string(5) "fubar" +object(foo)#%d (1) { + ["fubar"]=> + string(5) "fubar" +} +string(5) "fubar" +string(5) "fubar" diff --git a/tests/lang/bug22510.phpt b/tests/lang/bug22510.phpt new file mode 100644 index 0000000..fd71714 --- /dev/null +++ b/tests/lang/bug22510.phpt @@ -0,0 +1,126 @@ +--TEST-- +Bug #22510 (segfault among complex references) +--INI-- +error_reporting=E_ALL | E_DEPRECATED +--FILE-- +<?php +class foo +{ + public $list = array(); + + function finalize() { + print __CLASS__."::".__FUNCTION__."\n"; + $cl = &$this->list; + } + + function &method1() { + print __CLASS__."::".__FUNCTION__."\n"; + return @$this->foo; + } + + function &method2() { + print __CLASS__."::".__FUNCTION__."\n"; + return $this->foo; + } + + function method3() { + print __CLASS__."::".__FUNCTION__."\n"; + return @$this->foo; + } +} + +class bar +{ + function run1() { + print __CLASS__."::".__FUNCTION__."\n"; + $this->instance = new foo(); + $this->instance->method1($this); + $this->instance->method1($this); + } + + function run2() { + print __CLASS__."::".__FUNCTION__."\n"; + $this->instance = new foo(); + $this->instance->method2($this); + $this->instance->method2($this); + } + + function run3() { + print __CLASS__."::".__FUNCTION__."\n"; + $this->instance = new foo(); + $this->instance->method3($this); + $this->instance->method3($this); + } +} + +function ouch(&$bar) { + print __FUNCTION__."\n"; + @$a = $a; + $bar->run1(); +} + +function ok1(&$bar) { + print __FUNCTION__."\n"; + $bar->run1(); +} + +function ok2(&$bar) { + print __FUNCTION__."\n"; + @$a = $a; + $bar->run2(); +} + +function ok3(&$bar) { + print __FUNCTION__."\n"; + @$a = $a; + $bar->run3(); +} + +$bar = &new bar(); +ok1($bar); +$bar->instance->finalize(); +print "done!\n"; +ok2($bar); +$bar->instance->finalize(); +print "done!\n"; +ok3($bar); +$bar->instance->finalize(); +print "done!\n"; +ouch($bar); +$bar->instance->finalize(); +print "I'm alive!\n"; +?> +--EXPECTF-- +Deprecated: Assigning the return value of new by reference is deprecated in %s on line %d +ok1 +bar::run1 +foo::method1 + +Notice: Only variable references should be returned by reference in %s on line %d +foo::method1 + +Notice: Only variable references should be returned by reference in %s on line %d +foo::finalize +done! +ok2 +bar::run2 +foo::method2 +foo::method2 +foo::finalize +done! +ok3 +bar::run3 +foo::method3 +foo::method3 +foo::finalize +done! +ouch +bar::run1 +foo::method1 + +Notice: Only variable references should be returned by reference in %s on line %d +foo::method1 + +Notice: Only variable references should be returned by reference in %s on line %d +foo::finalize +I'm alive! diff --git a/tests/lang/bug22592.phpt b/tests/lang/bug22592.phpt new file mode 100644 index 0000000..2705841 --- /dev/null +++ b/tests/lang/bug22592.phpt @@ -0,0 +1,53 @@ +--TEST-- +Bug #22592 (cascading assignments to strings with curly braces broken) +--FILE-- +<?php +function error_hdlr($errno, $errstr) { + echo "[$errstr]\n"; +} + +set_error_handler('error_hdlr'); + +$i = 4; +$s = "string"; + +$result = "* *-*"; +var_dump($result); +$result[6] = '*'; +var_dump($result); +$result[1] = $i; +var_dump($result); +$result[3] = $s; +var_dump($result); +$result[7] = 0; +var_dump($result); +$a = $result[1] = $result[3] = '-'; +var_dump($result); +$b = $result[3] = $result[5] = $s; +var_dump($result); +$c = $result[0] = $result[2] = $result[4] = $i; +var_dump($result); +$d = $result[6] = $result[8] = 5; +var_dump($result); +$e = $result[1] = $result[6]; +var_dump($result); +var_dump($a, $b, $c, $d, $e); +$result[-1] = 'a'; +?> +--EXPECT-- +string(5) "* *-*" +string(7) "* *-* *" +string(7) "*4*-* *" +string(7) "*4*s* *" +string(8) "*4*s* *0" +string(8) "*-*-* *0" +string(8) "*-*s*s*0" +string(8) "4-4s4s*0" +string(9) "4-4s4s505" +string(9) "454s4s505" +string(1) "-" +string(1) "s" +string(1) "4" +string(1) "5" +string(1) "5" +[Illegal string offset: -1] diff --git a/tests/lang/bug22690.phpt b/tests/lang/bug22690.phpt new file mode 100644 index 0000000..6aed5be --- /dev/null +++ b/tests/lang/bug22690.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #22690 (ob_start() is broken with create_function() callbacks) +--FILE-- +<?php + $foo = create_function('$s', 'return strtoupper($s);'); + ob_start($foo); + echo $foo("bar\n"); +?> +bar +--EXPECT-- +BAR +BAR diff --git a/tests/lang/bug23279.phpt b/tests/lang/bug23279.phpt new file mode 100644 index 0000000..78d7850 --- /dev/null +++ b/tests/lang/bug23279.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #23279 (exception handler stops after first function call) +--FILE-- +<?php +ob_start(); +set_exception_handler('redirect_on_error'); +echo "Hello World\n"; +throw new Exception; + +function redirect_on_error($e) { + ob_end_clean(); + echo "Goodbye Cruel World\n"; +} +?> +--EXPECT-- +Goodbye Cruel World diff --git a/tests/lang/bug23384.phpt b/tests/lang/bug23384.phpt new file mode 100644 index 0000000..382bdfe --- /dev/null +++ b/tests/lang/bug23384.phpt @@ -0,0 +1,33 @@ +--TEST-- +Bug #23384 (use of class constants in statics) +--INI-- +error_reporting=4095 +--FILE-- +<?php +define('TEN', 10); +class Foo { + const HUN = 100; + function test($x = Foo::HUN) { + static $arr2 = array(TEN => 'ten'); + static $arr = array(Foo::HUN => 'ten'); + + print_r($arr); + print_r($arr2); + print_r($x); + } +} + +Foo::test(); +echo Foo::HUN."\n"; +?> +--EXPECTF-- +Strict Standards: Non-static method Foo::test() should not be called statically in %sbug23384.php on line %d +Array +( + [100] => ten +) +Array +( + [10] => ten +) +100100 diff --git a/tests/lang/bug23489.phpt b/tests/lang/bug23489.phpt new file mode 100644 index 0000000..645bb1b --- /dev/null +++ b/tests/lang/bug23489.phpt @@ -0,0 +1,23 @@ +--TEST-- +Bug #23489 (ob_start() is broken with method callbacks) +--FILE-- +<?php +class Test { + function Test() { + ob_start( + array( + $this, 'transform' + ) + ); + } + + function transform($buffer) { + return 'success'; + } +} + +$t = new Test; +?> +failure +--EXPECT-- +success diff --git a/tests/lang/bug23524.phpt b/tests/lang/bug23524.phpt new file mode 100644 index 0000000..512c714 --- /dev/null +++ b/tests/lang/bug23524.phpt @@ -0,0 +1,29 @@ +--TEST-- +Bug #23524 (Improper handling of constants in array indices) +--FILE-- +<?php + echo "Begin\n"; + define("THE_CONST",123); + function f($a=array(THE_CONST=>THE_CONST)) { + print_r($a); + } + f(); + f(); + f(); + echo "Done"; +?> +--EXPECT-- +Begin +Array +( + [123] => 123 +) +Array +( + [123] => 123 +) +Array +( + [123] => 123 +) +Done diff --git a/tests/lang/bug23584.phpt b/tests/lang/bug23584.phpt new file mode 100644 index 0000000..417cfb0 --- /dev/null +++ b/tests/lang/bug23584.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #23584 (error line numbers off by one when using #!php) +--FILE-- +#!php +<?php + +error_reporting(E_ALL); + +echo $foo; + +?> +--EXPECTREGEX-- +Notice: Undefined variable:.*foo in .* on line 6 diff --git a/tests/lang/bug23624.phpt b/tests/lang/bug23624.phpt new file mode 100644 index 0000000..4ddb82e --- /dev/null +++ b/tests/lang/bug23624.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #23624 (foreach leaves current array key as null) +--FILE-- +<?php + $arr = array ('one', 'two', 'three'); + var_dump(current($arr)); + foreach($arr as $key => $value); + var_dump(current($arr)); +?> +--EXPECT-- +string(3) "one" +bool(false) diff --git a/tests/lang/bug23922.phpt b/tests/lang/bug23922.phpt new file mode 100644 index 0000000..1fc6e54 --- /dev/null +++ b/tests/lang/bug23922.phpt @@ -0,0 +1,20 @@ +--TEST-- +Bug #23922 (scope doesn't properly propagate into internal functions) +--FILE-- +<?php + class foo + { + public $foo = 1; + + function as_string() + { assert('$this->foo == 1'); } + + function as_expr() + { assert($this->foo == 1); } + } + + $foo = new foo(); + $foo->as_expr(); + $foo->as_string(); +?> +--EXPECT-- diff --git a/tests/lang/bug24054.phpt b/tests/lang/bug24054.phpt new file mode 100644 index 0000000..fc51c83 --- /dev/null +++ b/tests/lang/bug24054.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #24054 (Assignment operator *= broken) +--FILE-- +<?php // $Id$ + +define('LONG_MAX', is_int(5000000000)? 9223372036854775807 : 0x7FFFFFFF); +define('LONG_MIN', -LONG_MAX - 1); +printf("%d,%d,%d,%d\n",is_int(LONG_MIN ),is_int(LONG_MAX ), + is_int(LONG_MIN-1),is_int(LONG_MAX+1)); + + $i = LONG_MAX; + + $j = $i * 1001; + $i *= 1001; + +$tests = <<<TESTS +$i === $j +TESTS; + +include(dirname(__FILE__) . '/../quicktester.inc'); + +--EXPECT-- +1,1,0,0 +OK diff --git a/tests/lang/bug24396.phpt b/tests/lang/bug24396.phpt new file mode 100644 index 0000000..b78e4b8 --- /dev/null +++ b/tests/lang/bug24396.phpt @@ -0,0 +1,19 @@ +--TEST-- +Bug #24396 (global $$variable broken) +--FILE-- +<?php + +$arr = array('a' => 1, 'b' => 2, 'c' => 3); + +foreach($arr as $k=>$v) { + global $$k; // comment this out and it works in PHP 5 too.. + + echo "($k => $v)\n"; + + $$k = $v; +} +?> +--EXPECT-- +(a => 1) +(b => 2) +(c => 3) diff --git a/tests/lang/bug24403.phpt b/tests/lang/bug24403.phpt new file mode 100644 index 0000000..fe99257 --- /dev/null +++ b/tests/lang/bug24403.phpt @@ -0,0 +1,20 @@ +--TEST-- +Bug #24403 (scope doesn't properly propagate into internal functions) +--FILE-- +<?php +class a +{ + public $a = array(); + + function a() + { + $output = preg_replace( + '!\{\s*([a-z0-9_]+)\s*\}!sie', + "(in_array('\\1',\$this->a) ? '\'.\$p[\'\\1\'].\'' : +'\'.\$r[\'\\1\'].\'')", + "{a} b {c}"); + } +} +new a(); +?> +--EXPECT-- diff --git a/tests/lang/bug24436.phpt b/tests/lang/bug24436.phpt new file mode 100644 index 0000000..b0cfbe0 --- /dev/null +++ b/tests/lang/bug24436.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #24436 (isset() and empty() produce errors with non-existent variables in objects) +--FILE-- +<?php +class test { + function __construct() { + if (empty($this->test[0][0])) { print "test1";} + if (!isset($this->test[0][0])) { print "test2";} + } +} + +$test1 = new test(); +?> +--EXPECT-- +test1test2 diff --git a/tests/lang/bug24499.phpt b/tests/lang/bug24499.phpt new file mode 100644 index 0000000..6ce56db --- /dev/null +++ b/tests/lang/bug24499.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #24499 (bogus handling of a public property as a private one) +--FILE-- +<?php +class Id { + private $id="priv"; + + public function tester($obj) + { + $obj->id = "bar"; + } +} + +$id = new Id(); +@$obj->foo = "bar"; +$id->tester($obj); +print_r($obj); +?> +--EXPECT-- +stdClass Object +( + [foo] => bar + [id] => bar +) diff --git a/tests/lang/bug24573.phpt b/tests/lang/bug24573.phpt new file mode 100644 index 0000000..e087d1f --- /dev/null +++ b/tests/lang/bug24573.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #24573 (debug_backtrace() crashes if $this is set to null) +--FILE-- +<?php + +class Foo { + function Bar() { + $__this = $this; + $this = null; + debug_backtrace(); + $this = $__this; + } +} + +$f = new Foo; + +$f->Bar(); + +echo "OK\n"; + +?> +--EXPECTF-- + +Fatal error: Cannot re-assign $this in %s on line %d
\ No newline at end of file diff --git a/tests/lang/bug24640.phpt b/tests/lang/bug24640.phpt new file mode 100644 index 0000000..919b38e --- /dev/null +++ b/tests/lang/bug24640.phpt @@ -0,0 +1,129 @@ +--TEST-- +Bug #24640 (var_export and var_dump can't output large float) +--INI-- +precision=12 +--FILE-- +<?php +function test($v) +{ + echo var_export($v, true) . "\n"; + var_dump($v); + echo "$v\n"; + print_r($v); + echo "\n------\n"; +} + +test(1.7e+300); +test(1.7e-300); +test(1.7e+79); +test(1.7e-79); +test(1.7e+80); +test(1.7e-80); +test(1.7e+81); +test(1.7e-81); +test(1.7e+319); +test(1.7e-319); +test(1.7e+320); +test(1.7e-320); +test(1.7e+321); +test(1.7e-321); +test(1.7e+324); +test(1.7e-324); +test(1.7e+1000); +test(1.7e-1000); + +?> +===DONE=== +<?php exit(0); ?> +--EXPECTF-- +1.7E+300 +float(1.7E+300) +1.7E+300 +1.7E+300 +------ +1.7E-300 +float(1.7E-300) +1.7E-300 +1.7E-300 +------ +1.7E+79 +float(1.7E+79) +1.7E+79 +1.7E+79 +------ +1.7E-79 +float(1.7E-79) +1.7E-79 +1.7E-79 +------ +1.7E+80 +float(1.7E+80) +1.7E+80 +1.7E+80 +------ +1.7E-80 +float(1.7E-80) +1.7E-80 +1.7E-80 +------ +1.7E+81 +float(1.7E+81) +1.7E+81 +1.7E+81 +------ +1.7E-81 +float(1.7E-81) +1.7E-81 +1.7E-81 +------ +I%s +float(I%s) +I%s +I%s +------ +1.69998107421E-319 +float(1.69998107421E-319) +1.69998107421E-319 +1.69998107421E-319 +------ +I%s +float(I%s) +I%s +I%s +------ +1.70007988734E-320 +float(1.70007988734E-320) +1.70007988734E-320 +1.70007988734E-320 +------ +I%s +float(I%s) +I%s +I%s +------ +1.69958582169E-321 +float(1.69958582169E-321) +1.69958582169E-321 +1.69958582169E-321 +------ +I%s +float(I%s) +I%s +I%s +------ +0 +float(0) +0 +0 +------ +I%s +float(I%s) +I%s +I%s +------ +0 +float(0) +0 +0 +------ +===DONE=== diff --git a/tests/lang/bug24652.phpt b/tests/lang/bug24652.phpt new file mode 100644 index 0000000..3bcea0e --- /dev/null +++ b/tests/lang/bug24652.phpt @@ -0,0 +1,31 @@ +--TEST-- +Bug #24652 (broken array_flip()) +--FILE-- +<?php + /* This works */ + $f = array('7' => 0); + var_dump($f); + var_dump(array_key_exists(7, $f)); + var_dump(array_key_exists('7', $f)); + + print "----------\n"; + /* This doesn't */ + $f = array_flip(array('7')); + var_dump($f); + var_dump(array_key_exists(7, $f)); + var_dump(array_key_exists('7', $f)); +?> +--EXPECT-- +array(1) { + [7]=> + int(0) +} +bool(true) +bool(true) +---------- +array(1) { + [7]=> + int(0) +} +bool(true) +bool(true) diff --git a/tests/lang/bug24658.phpt b/tests/lang/bug24658.phpt new file mode 100644 index 0000000..944fe44 --- /dev/null +++ b/tests/lang/bug24658.phpt @@ -0,0 +1,56 @@ +--TEST-- +Bug #24658 (combo of typehint / reference causes crash) +--FILE-- +<?php +class foo {} +function no_typehint($a) { + var_dump($a); +} +function typehint(foo $a) { + var_dump($a); +} +function no_typehint_ref(&$a) { + var_dump($a); +} +function typehint_ref(foo &$a) { + var_dump($a); +} +$v = new foo(); +$a = array(new foo(), 1, 2); +no_typehint($v); +typehint($v); +no_typehint_ref($v); +typehint_ref($v); +echo "===no_typehint===\n"; +array_walk($a, 'no_typehint'); +echo "===no_typehint_ref===\n"; +array_walk($a, 'no_typehint_ref'); +echo "===typehint===\n"; +array_walk($a, 'typehint'); +echo "===typehint_ref===\n"; +array_walk($a, 'typehint_ref'); +?> +--EXPECTF-- +object(foo)#%d (0) { +} +object(foo)#%d (0) { +} +object(foo)#%d (0) { +} +object(foo)#%d (0) { +} +===no_typehint=== +object(foo)#%d (0) { +} +int(1) +int(2) +===no_typehint_ref=== +object(foo)#%d (0) { +} +int(1) +int(2) +===typehint=== +object(foo)#%d (0) { +} + +Catchable fatal error: Argument 1 passed to typehint() must be an instance of foo, integer given in %s on line %d diff --git a/tests/lang/bug24783.phpt b/tests/lang/bug24783.phpt new file mode 100644 index 0000000..8c8cd6e --- /dev/null +++ b/tests/lang/bug24783.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #24783 ($key not binary safe in "foreach($arr as $key => $val)") +--FILE-- +<?php +error_reporting(E_ALL); + $arr = array ("foo\0bar" => "foo\0bar"); + foreach ($arr as $key => $val) { + echo strlen($key), ': '; + echo urlencode($key), ' => ', urlencode($val), "\n"; + } +?> +--EXPECT-- +7: foo%00bar => foo%00bar diff --git a/tests/lang/bug24908.phpt b/tests/lang/bug24908.phpt new file mode 100644 index 0000000..30056ab --- /dev/null +++ b/tests/lang/bug24908.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug #24908 (super-globals can not be used in __destruct()) +--INI-- +variables_order=GPS +--FILE-- +<?php +class test { + function __construct() { + if (count($_SERVER)) echo "O"; + } + function __destruct() { + if (count($_SERVER)) echo "K\n"; + } +} +$test = new test(); +?> +--EXPECT-- +OK diff --git a/tests/lang/bug24926.phpt b/tests/lang/bug24926.phpt new file mode 100644 index 0000000..3d2cc70 --- /dev/null +++ b/tests/lang/bug24926.phpt @@ -0,0 +1,28 @@ +--TEST-- +Bug #24926 (lambda function (create_function()) cannot be stored in a class property) +--FILE-- +<?php + +error_reporting (E_ALL); + +class foo { + + public $functions = array(); + + function foo() + { + $function = create_function('', 'return "FOO\n";'); + print($function()); + + $this->functions['test'] = $function; + print($this->functions['test']()); // werkt al niet meer + + } +} + +$a = new foo (); + +?> +--EXPECT-- +FOO +FOO diff --git a/tests/lang/bug24951.phpt b/tests/lang/bug24951.phpt new file mode 100644 index 0000000..aa48ab2 --- /dev/null +++ b/tests/lang/bug24951.phpt @@ -0,0 +1,42 @@ +--TEST-- +Bug #24951 (ob_flush() destroys output handler) +--FILE-- +<?php +function test($s, $mode) +{ + return (($mode & PHP_OUTPUT_HANDLER_START)?"[":"") . $s . (($mode & PHP_OUTPUT_HANDLER_END)?"]\n":""); +} +function t1() +{ + ob_start("test"); + echo "Hello from t1 1 "; + echo "Hello from t1 2 "; + ob_end_flush(); +} +function t2() +{ + ob_start("test"); + echo "Hello from t2 1 "; + ob_flush(); + echo "Hello from t2 2 "; + ob_end_flush(); +} +function t3() +{ + ob_start("test"); + echo "Hello from t3 1 "; + ob_clean(); + echo "Hello from t3 2 "; + ob_end_flush(); +} + +t1(); echo "\n"; +t2(); echo "\n"; +t3(); echo "\n"; +?> +--EXPECT-- +[Hello from t1 1 Hello from t1 2 ] + +[Hello from t2 1 Hello from t2 2 ] + +Hello from t3 2 ] diff --git a/tests/lang/bug25145.phpt b/tests/lang/bug25145.phpt new file mode 100644 index 0000000..9c53387 --- /dev/null +++ b/tests/lang/bug25145.phpt @@ -0,0 +1,20 @@ +--TEST-- +Bug #25145 (SEGV on recpt of form input with name like "123[]") +--GET-- +123[]=SEGV +--FILE-- +<?php + +var_dump($_REQUEST); +echo "Done\n"; + +?> +--EXPECT-- +array(1) { + [123]=> + array(1) { + [0]=> + string(4) "SEGV" + } +} +Done diff --git a/tests/lang/bug25547.phpt b/tests/lang/bug25547.phpt new file mode 100644 index 0000000..b54f467 --- /dev/null +++ b/tests/lang/bug25547.phpt @@ -0,0 +1,30 @@ +--TEST-- +Bug #25547 (error_handler and array index with function call) +--FILE-- +<?php + +function handler($errno, $errstr, $errfile, $errline, $context) +{ + echo __FUNCTION__ . "($errstr)\n"; +} + +set_error_handler('handler'); + +function foo($x) { + return "foo"; +} + +$output = array(); +++$output[foo("bar")]; + +print_r($output); + +echo "Done"; +?> +--EXPECT-- +handler(Undefined index: foo) +Array +( + [foo] => 1 +) +Done diff --git a/tests/lang/bug25652.phpt b/tests/lang/bug25652.phpt new file mode 100644 index 0000000..09cfc18 --- /dev/null +++ b/tests/lang/bug25652.phpt @@ -0,0 +1,22 @@ +--TEST-- +Bug #25652 (Calling Global functions dynamically fails from Class scope) +--FILE-- +<?php + + function testfunc ($var) { + echo "testfunc $var\n"; + } + + class foo { + public $arr = array('testfunc'); + function bar () { + $this->arr[0]('testvalue'); + } + } + + $a = new foo (); + $a->bar (); + +?> +--EXPECT-- +testfunc testvalue diff --git a/tests/lang/bug25922.phpt b/tests/lang/bug25922.phpt new file mode 100644 index 0000000..bb030c9 --- /dev/null +++ b/tests/lang/bug25922.phpt @@ -0,0 +1,23 @@ +--TEST-- +Bug #25922 (SEGV in error_handler when context is destroyed) +--INI-- +error_reporting=2047 +--FILE-- +<?php +function my_error_handler($error, $errmsg='', $errfile='', $errline=0, $errcontext='') +{ + echo "$errmsg\n"; + $errcontext = ''; +} + +set_error_handler('my_error_handler'); + +function test() +{ + echo "Undefined index here: '{$data['HTTP_HEADER']}'\n"; +} +test(); +?> +--EXPECT-- +Undefined variable: data +Undefined index here: '' diff --git a/tests/lang/bug26182.phpt b/tests/lang/bug26182.phpt new file mode 100644 index 0000000..7417293 --- /dev/null +++ b/tests/lang/bug26182.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #26182 (Object properties created redundantly) +--INI-- +error_reporting=4095 +--FILE-- +<?php + +class A { + function NotAConstructor () + { + if (isset($this->x)) { + //just for demo + } + } +} + +$t = new A (); + +print_r($t); + +?> +--EXPECT-- +A Object +( +) diff --git a/tests/lang/bug26696.phpt b/tests/lang/bug26696.phpt new file mode 100644 index 0000000..dae182d --- /dev/null +++ b/tests/lang/bug26696.phpt @@ -0,0 +1,28 @@ +--TEST-- +Bug #26696 (string index in a switch() crashes with multiple matches) +--FILE-- +<?php + +$str = 'asdd/?'; +$len = strlen($str); +for ($i = 0; $i < $len; $i++) { + switch ($str[$i]) { + case '?': + echo "OK\n"; + break; + } +} + +$str = '*'; +switch ($str[0]) { + case '*'; + echo "OK\n"; + break; + default: + echo 'Default RAN!'; +} + +?> +--EXPECT-- +OK +OK diff --git a/tests/lang/bug26866.phpt b/tests/lang/bug26866.phpt new file mode 100644 index 0000000..abb99c3 --- /dev/null +++ b/tests/lang/bug26866.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #26866 (segfault when exception raised in __get) +--FILE-- +<?php +class bar { + function get_name() { + return 'bar'; + } +} +class foo { + function __get($sName) { + throw new Exception('Exception!'); + return new bar(); + } +} +$foo = new foo(); +try { + echo $foo->bar->get_name(); +} +catch (Exception $E) { + echo "Exception raised!\n"; +} +?> +--EXPECT-- +Exception raised! diff --git a/tests/lang/bug26869.phpt b/tests/lang/bug26869.phpt new file mode 100644 index 0000000..77dd259 --- /dev/null +++ b/tests/lang/bug26869.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #26869 (constant as the key of static array) +--FILE-- +<?php + define("A", "1"); + static $a=array(A => 1); + var_dump($a); + var_dump(isset($a[A])); +?> +--EXPECT-- +array(1) { + [1]=> + int(1) +} +bool(true) diff --git a/tests/lang/bug27354.phpt b/tests/lang/bug27354.phpt new file mode 100644 index 0000000..e10ad9c --- /dev/null +++ b/tests/lang/bug27354.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #27354 (Modulus operator crashes PHP) +--FILE-- +<?php + var_dump(-2147483647 % -1); + var_dump(-2147483649 % -1); + var_dump(-2147483648 % -1); + var_dump(-2147483648 % -2); +?> +--EXPECTF-- +int(%i) +int(%i) +int(%i) +int(%i) diff --git a/tests/lang/bug27439.phpt b/tests/lang/bug27439.phpt new file mode 100644 index 0000000..4bcadb7 --- /dev/null +++ b/tests/lang/bug27439.phpt @@ -0,0 +1,76 @@ +--TEST-- +Bug #27439 (foreach() with $this segfaults) +--FILE-- +<?php + +class test_props { + public $a = 1; + public $b = 2; + public $c = 3; +} + +class test { + public $array = array(1,2,3); + public $string = "string"; + + public function __construct() { + $this->object = new test_props; + } + + public function getArray() { + return $this->array; + } + + public function getString() { + return $this->string; + } + + public function case1() { + foreach ($this->array as $foo) { + echo $foo; + } + } + + public function case2() { + foreach ($this->foobar as $foo); + } + + public function case3() { + foreach ($this->string as $foo); + } + + public function case4() { + foreach ($this->getArray() as $foo); + } + + public function case5() { + foreach ($this->getString() as $foo); + } + + public function case6() { + foreach ($this->object as $foo) { + echo $foo; + } + } +} +$test = new test(); +$test->case1(); +$test->case2(); +$test->case3(); +$test->case4(); +$test->case5(); +$test->case6(); +echo "\n"; +echo "===DONE==="; +?> +--EXPECTF-- +123 +Notice: Undefined property: test::$foobar in %s on line %d + +Warning: Invalid argument supplied for foreach() in %s on line %d + +Warning: Invalid argument supplied for foreach() in %s on line %d + +Warning: Invalid argument supplied for foreach() in %s on line %d +123 +===DONE=== diff --git a/tests/lang/bug27443.phpt b/tests/lang/bug27443.phpt new file mode 100644 index 0000000..4097943 --- /dev/null +++ b/tests/lang/bug27443.phpt @@ -0,0 +1,8 @@ +--TEST-- +Bug #27443 (defined() returns wrong type) +--FILE-- +<?php +echo gettype(defined('test')); +?> +--EXPECT-- +boolean diff --git a/tests/lang/bug27535.phpt b/tests/lang/bug27535.phpt new file mode 100644 index 0000000..a6ceae7 --- /dev/null +++ b/tests/lang/bug27535.phpt @@ -0,0 +1,28 @@ +--TEST-- +Bug #27535 (Objects pointing to each other cause Apache to crash) +--FILE-- +<?php + +class Class1 +{ + public $_Class2_obj; +} + +class Class2 +{ + public $storage = ''; + + function Class2() + { + $this->storage = new Class1(); + + $this->storage->_Class2_obj = $this; + } +} + +$foo = new Class2(); + +?> +Alive! +--EXPECT-- +Alive! diff --git a/tests/lang/bug28213.phpt b/tests/lang/bug28213.phpt new file mode 100644 index 0000000..3677d4c --- /dev/null +++ b/tests/lang/bug28213.phpt @@ -0,0 +1,10 @@ +--TEST-- +Bug #28213 (crash in debug_print_backtrace in static methods) +--FILE-- +<?php +class FooBar { static function error() { debug_print_backtrace(); } } +set_error_handler(array('FooBar', 'error')); +include('foobar.php'); +?> +--EXPECTREGEX-- +.*#1\s*include.* diff --git a/tests/lang/bug28800.phpt b/tests/lang/bug28800.phpt new file mode 100644 index 0000000..f81ad7f --- /dev/null +++ b/tests/lang/bug28800.phpt @@ -0,0 +1,17 @@ +--TEST-- +Bug #28800 (Incorrect string to number conversion for strings starting with 'inf') +--FILE-- +<?php + $strings = array('into', 'info', 'inf', 'infinity', 'infin', 'inflammable'); + foreach ($strings as $v) { + echo ($v+0)."\n"; + } +?> +--EXPECT-- +0 +0 +0 +0 +0 +0 + diff --git a/tests/lang/bug29566.phpt b/tests/lang/bug29566.phpt new file mode 100644 index 0000000..16aec8f --- /dev/null +++ b/tests/lang/bug29566.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug #29566 (foreach/string handling strangeness) +--FILE-- +<?php +$var="This is a string"; + +$dummy=""; +unset($dummy); + +foreach($var['nosuchkey'] as $v) { +} +?> +===DONE=== +--EXPECTF-- +Warning: Illegal string offset 'nosuchkey' in %sbug29566.php on line %d + +Warning: Invalid argument supplied for foreach() in %sbug29566.php on line %d +===DONE=== diff --git a/tests/lang/bug29893.phpt b/tests/lang/bug29893.phpt new file mode 100644 index 0000000..d320de0 --- /dev/null +++ b/tests/lang/bug29893.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #29893 (segfault when using array as index) +--FILE-- +<?php +$base = 50; +$base[$base] -= 0; +?> +===DONE=== +--EXPECTF-- +Warning: Cannot use a scalar value as an array in %sbug29893.php on line %d +===DONE=== diff --git a/tests/lang/bug29944.phpt b/tests/lang/bug29944.phpt new file mode 100644 index 0000000..7882936 --- /dev/null +++ b/tests/lang/bug29944.phpt @@ -0,0 +1,20 @@ +--TEST-- +Bug #29944 (function defined in switch crashes PHP) +--FILE-- +<?PHP +$a = 1; +$b = "1"; +switch ($a) { + case 1: + function foo($bar) { + if (preg_match('/\d/', $bar)) return true; + return false; + } + echo foo($b); +} +?> + +===DONE=== +--EXPECT-- +1 +===DONE=== diff --git a/tests/lang/bug30578.phpt b/tests/lang/bug30578.phpt new file mode 100644 index 0000000..d8a8d2e --- /dev/null +++ b/tests/lang/bug30578.phpt @@ -0,0 +1,31 @@ +--TEST-- +Bug #30578 (Output buffers flushed before calling __desctruct functions) +--FILE-- +<?php + +error_reporting(E_ALL); + +class Example +{ + function __construct() + { + ob_start(); + echo "This should be displayed last.\n"; + } + + function __destruct() + { + $buffered_data = ob_get_contents(); + ob_end_clean(); + + echo "This should be displayed first.\n"; + echo "Buffered data: $buffered_data"; + } +} + +$obj = new Example; + +?> +--EXPECT-- +This should be displayed first. +Buffered data: This should be displayed last. diff --git a/tests/lang/bug30638.phpt b/tests/lang/bug30638.phpt new file mode 100644 index 0000000..945a228 --- /dev/null +++ b/tests/lang/bug30638.phpt @@ -0,0 +1,26 @@ +--TEST-- +Bug #30638 (localeconv returns wrong LC_NUMERIC settings) (ok to fail on MacOS X) +--SKIPIF-- +<?php # try to activate a german locale +if (substr(PHP_OS, 0, 3) == 'WIN') { + /* skip on windows until #63688 was fixed */ + die('skip'); +} +if (setlocale(LC_NUMERIC, "de_DE.UTF-8", "de_DE", "de", "german", "ge", "de_DE.ISO-8859-1") === FALSE) { + print "skip setlocale() failed"; +} elseif (strtolower(php_uname('s')) == 'darwin') { + print "skip ok to fail on MacOS X"; +} +?> +--FILE-- +<?php +# activate the german locale +setlocale(LC_NUMERIC, "de_DE.UTF-8", "de_DE", "de", "german", "ge", "de_DE.ISO-8859-1"); + +$lc = localeconv(); +printf("decimal_point: %s\n", $lc['decimal_point']); +printf("thousands_sep: %s\n", $lc['thousands_sep']); +?> +--EXPECT-- +decimal_point: , +thousands_sep: . diff --git a/tests/lang/bug30726.phpt b/tests/lang/bug30726.phpt new file mode 100644 index 0000000..79aeff7 --- /dev/null +++ b/tests/lang/bug30726.phpt @@ -0,0 +1,8 @@ +--TEST-- +Bug #30726 (-.1 like numbers are not being handled correctly) +--FILE-- +<?php +echo (int) is_float('-.1' * 2), "\n"; +?> +--EXPECT-- +1 diff --git a/tests/lang/bug30862.phpt b/tests/lang/bug30862.phpt new file mode 100644 index 0000000..12c95d5 --- /dev/null +++ b/tests/lang/bug30862.phpt @@ -0,0 +1,30 @@ +--TEST-- +Bug #30862 (Static array with boolean indexes) +--FILE-- +<?php +class T { + static $a = array(false=>"false", true=>"true"); +} +print_r(T::$a); +?> +---------- +<?php +define("X",0); +define("Y",1); +class T2 { + static $a = array(X=>"false", Y=>"true"); +} +print_r(T2::$a); +?> +--EXPECT-- +Array +( + [0] => false + [1] => true +) +---------- +Array +( + [0] => false + [1] => true +) diff --git a/tests/lang/bug32828.phpt b/tests/lang/bug32828.phpt new file mode 100644 index 0000000..ad59646 --- /dev/null +++ b/tests/lang/bug32828.phpt @@ -0,0 +1,21 @@ +--TEST-- +Bug #32828 (Throwing exception in output_callback function with ob_start and ob_end_clean leads to segfault) +--FILE-- +<?php + +function output_handler($buffer) +{ + throw new Exception; +} + +ob_start('output_handler'); + +ob_end_clean(); +?> +--EXPECTF-- +Fatal error: Uncaught exception 'Exception' in %s:%d +Stack trace: +#0 [internal function]: output_handler('', %d) +#1 %s(%d): ob_end_clean() +#2 {main} + thrown in %s on line %d diff --git a/tests/lang/bug32924.phpt b/tests/lang/bug32924.phpt new file mode 100644 index 0000000..d72b0ea --- /dev/null +++ b/tests/lang/bug32924.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #32924 (prepend does not add file to included files) +--INI-- +include_path={PWD} +auto_prepend_file=inc.inc +--FILE-- +<?php +include_once(dirname(__FILE__).'/inc.inc'); +require_once(dirname(__FILE__).'/inc.inc'); +?> +END +--EXPECT-- +Included! +END diff --git a/tests/lang/bug35176.phpt b/tests/lang/bug35176.phpt new file mode 100644 index 0000000..2928f7e --- /dev/null +++ b/tests/lang/bug35176.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #35176 (include()/require()/*_once() produce wrong error messages about main()) +--INI-- +html_errors=1 +docref_root="/" +error_reporting=4095 +--FILE-- +<?php +require_once('nonexisiting.php'); +?> +--EXPECTF-- +<br /> +<b>Warning</b>: require_once(nonexisiting.php) [<a href='/function.require-once.html'>function.require-once.html</a>]: failed to open stream: No such file or directory in <b>%sbug35176.php</b> on line <b>2</b><br /> +<br /> +<b>Fatal error</b>: require_once() [<a href='/function.require.html'>function.require.html</a>]: Failed opening required 'nonexisiting.php' (%s) in <b>%sbug35176.php</b> on line <b>2</b><br /> diff --git a/tests/lang/bug35382.phpt b/tests/lang/bug35382.phpt new file mode 100644 index 0000000..69190d4 --- /dev/null +++ b/tests/lang/bug35382.phpt @@ -0,0 +1,9 @@ +--TEST-- +Bug #35382 (Comment in end of file produces fatal error) +--FILEEOF-- +<?php +eval("echo 'Hello'; // comment"); +echo " World"; +//last line comment +--EXPECTF-- +Hello World diff --git a/tests/lang/bug38579.inc b/tests/lang/bug38579.inc new file mode 100644 index 0000000..8ecc558 --- /dev/null +++ b/tests/lang/bug38579.inc @@ -0,0 +1,3 @@ +<?php +echo "ok\n"; +?> diff --git a/tests/lang/bug38579.phpt b/tests/lang/bug38579.phpt new file mode 100644 index 0000000..445296c --- /dev/null +++ b/tests/lang/bug38579.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #38579 (include_once() may include the same file twice) +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) != 'WIN') { + die('skip only for Windows'); +} +?> +--FILE-- +<?php +$file = dirname(__FILE__)."/bug38579.inc"; +include_once(strtolower($file)); +include_once(strtoupper($file)); +?> +--EXPECT-- +ok diff --git a/tests/lang/bug43958.phpt b/tests/lang/bug43958.phpt new file mode 100644 index 0000000..bc88bcd --- /dev/null +++ b/tests/lang/bug43958.phpt @@ -0,0 +1,17 @@ +--TEST-- +Bug #43958 (class name added into the error message) +--FILE-- +<?php +class MyClass +{ + static public function loadCode($p) { + return include $p; + } +} + +MyClass::loadCode('file-which-does-not-exist-on-purpose.php'); +--EXPECTF-- +Warning: include(file-which-does-not-exist-on-purpose.php): failed to open stream: No such file or directory in %sbug43958.php on line 5 + +Warning: include(): Failed opening 'file-which-does-not-exist-on-purpose.php' for inclusion (include_path='%s') in %sbug43958.php on line 5 + diff --git a/tests/lang/bug44654.phpt b/tests/lang/bug44654.phpt new file mode 100644 index 0000000..be714e8 --- /dev/null +++ b/tests/lang/bug44654.phpt @@ -0,0 +1,8 @@ +--TEST-- +Bug #44654 (syntax error for #) +--FILE-- +#<?php echo 1; ?> +<?php if (1) { ?>#<?php } ?> +#<?php echo 1; ?> +--EXPECT-- +#1##1 diff --git a/tests/lang/bug44827.phpt b/tests/lang/bug44827.phpt new file mode 100644 index 0000000..031045b --- /dev/null +++ b/tests/lang/bug44827.phpt @@ -0,0 +1,17 @@ +--TEST-- +Bug #44827 (Class error when trying to access :: as constant) +--CREDITS-- +Sebastian Schürmann +sebs@php.net +Testfest Munich 2009 +--FILE-- +<?php +define('::', true); +var_dump(constant('::')); +?> +--EXPECTF-- +Warning: Class constants cannot be defined or redefined in %s on line %d + +Warning: constant(): Couldn't find constant :: in %s on line %d +NULL + diff --git a/tests/lang/bug45392.phpt b/tests/lang/bug45392.phpt new file mode 100644 index 0000000..78876c7 --- /dev/null +++ b/tests/lang/bug45392.phpt @@ -0,0 +1,23 @@ +--TEST-- +Bug #45392 (ob_start()/ob_end_clean() and memory_limit) +--INI-- +display_errors=stderr +--SKIPIF-- +<?php +if (getenv("USE_ZEND_ALLOC") === "0") { + die("skip Zend MM disabled"); +} +--FILE-- +<?php +echo __LINE__ . "\n"; +ini_set('memory_limit', 100); +ob_start(); +$i = 0; +while($i++ < 5000) { + echo str_repeat("may not be displayed ", 42); +} +ob_end_clean(); +?> +--EXPECTF-- +2 +Fatal error: Allowed memory size of %d bytes exhausted%s diff --git a/tests/lang/bug55754.phpt b/tests/lang/bug55754.phpt new file mode 100644 index 0000000..c58ec91 --- /dev/null +++ b/tests/lang/bug55754.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #55754 (Only variables should be passed by reference for ZEND_SEND_PREFER_REF params) +--FILE-- +<?php + +current($arr = array(0 => "a")); +current(array(0 => "a")); +current($arr); + +echo "DONE"; + +?> +--EXPECT-- +DONE diff --git a/tests/lang/bug7515.phpt b/tests/lang/bug7515.phpt new file mode 100644 index 0000000..ea58061 --- /dev/null +++ b/tests/lang/bug7515.phpt @@ -0,0 +1,37 @@ +--TEST-- +Bug #7515 (weird & invisible referencing of objects) +--SKIPIF-- +<?php if(version_compare(zend_version(), "2.0.0-dev", '<')) echo "skip Zend Engine 2 needed\n"; ?> +--INI-- +error_reporting=2039 +--FILE-- +<?php +class obj { + function method() {} +} + +$o->root=new obj(); + +ob_start(); +var_dump($o); +$x=ob_get_contents(); +ob_end_clean(); + +$o->root->method(); + +ob_start(); +var_dump($o); +$y=ob_get_contents(); +ob_end_clean(); +if ($x == $y) { + print "success"; +} else { + print "failure +x=$x +y=$y +"; +} +?> +--EXPECTF-- +Warning: Creating default object from empty value in %s on line %d +success diff --git a/tests/lang/catchable_error_001.phpt b/tests/lang/catchable_error_001.phpt new file mode 100644 index 0000000..f6bbdd9 --- /dev/null +++ b/tests/lang/catchable_error_001.phpt @@ -0,0 +1,22 @@ +--TEST-- +Catchable fatal error [1] +--FILE-- +<?php + class Foo { + } + + function blah (Foo $a) + { + } + + function error() + { + $a = func_get_args(); + var_dump($a); + } + + blah (new StdClass); + echo "ALIVE!\n"; +?> +--EXPECTF-- +Catchable fatal error: Argument 1 passed to blah() must be an instance of Foo, instance of stdClass given, called in %scatchable_error_001.php on line 15 and defined in %scatchable_error_001.php on line 5 diff --git a/tests/lang/catchable_error_002.phpt b/tests/lang/catchable_error_002.phpt new file mode 100644 index 0000000..c1762b2 --- /dev/null +++ b/tests/lang/catchable_error_002.phpt @@ -0,0 +1,37 @@ +--TEST-- +Catchable fatal error [2] +--FILE-- +<?php + class Foo { + } + + function blah (Foo $a) + { + } + + function error() + { + $a = func_get_args(); + var_dump($a); + } + + set_error_handler('error'); + + blah (new StdClass); + echo "ALIVE!\n"; +?> +--EXPECTF-- +array(5) { + [0]=> + int(4096) + [1]=> + string(%d) "Argument 1 passed to blah() must be an instance of Foo, instance of stdClass given, called in %scatchable_error_002.php on line %d and defined" + [2]=> + string(%d) "%scatchable_error_002.php" + [3]=> + int(5) + [4]=> + array(0) { + } +} +ALIVE! diff --git a/tests/lang/comments.phpt b/tests/lang/comments.phpt new file mode 100644 index 0000000..ca8b1d2 --- /dev/null +++ b/tests/lang/comments.phpt @@ -0,0 +1,24 @@ +--TEST-- +#-style comments +--FILE-- +#teste +#teste2 +<?php + +#ahahah +#ahhfhf + +echo '#ola'; //? +echo "\n"; +echo 'uhm # ah'; #ah? +echo "\n"; +echo "e este, # hein?"; +echo "\n"; + +?> +--EXPECT-- +#teste +#teste2 +#ola +uhm # ah +e este, # hein? diff --git a/tests/lang/comments2.phpt b/tests/lang/comments2.phpt new file mode 100644 index 0000000..8d727d9 --- /dev/null +++ b/tests/lang/comments2.phpt @@ -0,0 +1,9 @@ +--TEST-- +#-style comments (part 2) +--FILEEOF-- +<?php +if (1) { +?> +#<?php } +--EXPECT-- +# diff --git a/tests/lang/compare_objects_basic1.phpt b/tests/lang/compare_objects_basic1.phpt new file mode 100644 index 0000000..fe312fc --- /dev/null +++ b/tests/lang/compare_objects_basic1.phpt @@ -0,0 +1,60 @@ +--TEST-- +Test standard 'compare' object handler +--FILE-- + +<?php + +echo "Simple test for standard compare object handler\n"; + +class class1{} + +class class2{} + +class class3{ + public $aaa; + private $bbb; + protected $ccc; +} + +class class4 extends class3{ +} + +class class5 extends class3{ + public $ddd; + private $eee; +} + +// Define a bunch of objects all of which will use standard compare object handler +$obj1 = new class1(); +$obj2 = new class2(); +$obj3 = new class3(); +$obj4 = new class4(); +$obj5 = new class5(); + +echo "\n-- The following compare should return TRUE --\n"; +var_dump($obj1 == $obj1); + +echo "\n-- All the following compares should return FALSE --\n"; +var_dump($obj1 == $obj2); +var_dump($obj1 == $obj3); +var_dump($obj1 == $obj4); +var_dump($obj1 == $obj5); +var_dump($obj4 == $obj3); +var_dump($obj5 == $obj3); + +?> +===DONE=== +--EXPECT-- +Simple test for standard compare object handler + +-- The following compare should return TRUE -- +bool(true) + +-- All the following compares should return FALSE -- +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +bool(false) +===DONE===
\ No newline at end of file diff --git a/tests/lang/compare_objects_basic2.phpt b/tests/lang/compare_objects_basic2.phpt new file mode 100644 index 0000000..7e4786c --- /dev/null +++ b/tests/lang/compare_objects_basic2.phpt @@ -0,0 +1,24 @@ +--TEST-- +Test object compare when object handler different +--FILE-- + +<?php + +//Set the default time zone +date_default_timezone_set("Europe/London"); + +echo "Simple test comparing two objects with different compare callback handler\n"; + +class X { +} + +$obj1 = new X(); +$obj2 = new DateTime(("2009-02-12 12:47:41 GMT")); + +var_dump($obj1 == $obj2); +?> +===DONE=== +--EXPECTF-- +Simple test comparing two objects with different compare callback handler +bool(false) +===DONE=== diff --git a/tests/lang/each_binary_safety.phpt b/tests/lang/each_binary_safety.phpt new file mode 100644 index 0000000..bb13534 --- /dev/null +++ b/tests/lang/each_binary_safety.phpt @@ -0,0 +1,13 @@ +--TEST-- +Binary safety of each() for both keys and values +--FILE-- +<?php +error_reporting(E_ALL); +$arr = array ("foo\0bar" => "foo\0bar"); +while (list($key, $val) = each($arr)) { + echo strlen($key), ': '; + echo urlencode($key), ' => ', urlencode($val), "\n"; +} +?> +--EXPECT-- +7: foo%00bar => foo%00bar diff --git a/tests/lang/empty_variation.phpt b/tests/lang/empty_variation.phpt new file mode 100644 index 0000000..8e940da --- /dev/null +++ b/tests/lang/empty_variation.phpt @@ -0,0 +1,14 @@ +--TEST-- +empty() on array elements +--FILE-- +<?php +$a=array('0','empty'=>'0'); +var_dump(empty($a['empty'])); +var_dump(empty($a[0])); +$b='0'; +var_dump(empty($b)); +?> +--EXPECT-- +bool(true) +bool(true) +bool(true) diff --git a/tests/lang/engine_assignExecutionOrder_001.phpt b/tests/lang/engine_assignExecutionOrder_001.phpt new file mode 100644 index 0000000..1b85cb7 --- /dev/null +++ b/tests/lang/engine_assignExecutionOrder_001.phpt @@ -0,0 +1,152 @@ +--TEST-- +Evaluation order during assignments. +--FILE-- +<?php + +function f() { + echo "in f()\n"; + return "name"; +} + +function g() { + echo "in g()\n"; + return "assigned value"; +} + + +echo "\n\nOrder with local assignment:\n"; +${f()} = g(); +var_dump($name); + +echo "\n\nOrder with array assignment:\n"; +$a[f()] = g(); +var_dump($a); + +echo "\n\nOrder with object property assignment:\n"; +$oa = new stdClass; +$oa->${f()} = g(); +var_dump($oa); + +echo "\n\nOrder with nested object property assignment:\n"; +$ob = new stdClass; +$ob->o1 = new stdClass; +$ob->o1->o2 = new stdClass; +$ob->o1->o2->${f()} = g(); +var_dump($ob); + +echo "\n\nOrder with dim_list property assignment:\n"; +$oc = new stdClass; +$oc->a[${f()}] = g(); +var_dump($oc); + + +class C { + public static $name = "original"; + public static $a = array(); + public static $string = "hello"; +} +echo "\n\nOrder with static property assignment:\n"; +C::${f()} = g(); +var_dump(C::$name); + +echo "\n\nOrder with static array property assignment:\n"; +C::$a[f()] = g(); +var_dump(C::$a); + +echo "\n\nOrder with indexed string assignment:\n"; +$string = "hello"; +function getOffset() { + echo "in getOffset()\n"; + return 0; +} +function newChar() { + echo "in newChar()\n"; + return 'j'; +} +$string[getOffset()] = newChar(); +var_dump($string); + +echo "\n\nOrder with static string property assignment:\n"; +C::$string[getOffset()] = newChar(); +var_dump(C::$string); + +?> +--EXPECTF-- + + +Order with local assignment: +in f() +in g() +%string|unicode%(14) "assigned value" + + +Order with array assignment: +in f() +in g() +array(1) { + [%u|b%"name"]=> + %string|unicode%(14) "assigned value" +} + + +Order with object property assignment: +in f() +in g() +object(stdClass)#%d (1) { + [%u|b%"assigned value"]=> + %string|unicode%(14) "assigned value" +} + + +Order with nested object property assignment: +in f() +in g() +object(stdClass)#%d (1) { + [%u|b%"o1"]=> + object(stdClass)#%d (1) { + [%u|b%"o2"]=> + object(stdClass)#%d (1) { + [%u|b%"assigned value"]=> + %string|unicode%(14) "assigned value" + } + } +} + + +Order with dim_list property assignment: +in f() +in g() +object(stdClass)#%d (1) { + [%u|b%"a"]=> + array(1) { + [%u|b%"assigned value"]=> + %string|unicode%(14) "assigned value" + } +} + + +Order with static property assignment: +in f() +in g() +%string|unicode%(14) "assigned value" + + +Order with static array property assignment: +in f() +in g() +array(1) { + [%u|b%"name"]=> + %string|unicode%(14) "assigned value" +} + + +Order with indexed string assignment: +in getOffset() +in newChar() +%string|unicode%(5) "jello" + + +Order with static string property assignment: +in getOffset() +in newChar() +%string|unicode%(5) "jello" diff --git a/tests/lang/engine_assignExecutionOrder_002.phpt b/tests/lang/engine_assignExecutionOrder_002.phpt new file mode 100644 index 0000000..ba88150 --- /dev/null +++ b/tests/lang/engine_assignExecutionOrder_002.phpt @@ -0,0 +1,135 @@ +--TEST-- +Evaluation order during assignments. +--FILE-- +<?php + +// simple case with missing element +$f = array("hello","item2","bye"); +list($a,,$b) = $f; +echo "A=$a B=$b\n"; + + +// Warning: Cannot use a scalar value as an array in %s on line %d +$c[$c=1] = 1; + +// i++ evaluated first, so $d[0] is 10 +$d = array(0,10); +$i = 0; +$d[$i++] = $i*10; +// expected array is 10,10 +var_dump($d); + +// the f++++ makes f into 2, so $e 0 and 1 should both be 30 +$e = array(0,0); +$f = 0; +$g1 = array(10,10); +$g2 = array(20,20); +$g3 = array(30,30); +$g = array($g1,$g2,$g3); +list($e[$f++],$e[$f++]) = $g[$f]; +// expect 30,30 +var_dump($e); + + +$i1 = array(1,2); +$i2 = array(10,20); +$i3 = array(100,200); +$i4 = array(array(1000,2000),3000); +$i = array($i1,$i2,$i3,$i4); +$j = array(0,0,0); +$h = 0; +// a list of lists +list(list($j[$h++],$j[$h++]),$j[$h++]) = $i[$h]; +var_dump($j); + + +// list of lists with just variable assignments - expect 100,200,300 +$k3 = array(100,200); +$k = array($k3,300); +list(list($l,$m),$n) = $k; +echo "L=$l M=$m N=$n\n"; + + +// expect $x and $y to be null - this fails on php.net 5.2.1 (invalid opcode) - fixed in 5.2.3 +list($o,$p) = 20; +echo "O=$o and P=$p\n"; + + +// list of lists with blanks and nulls expect 10 20 40 50 60 70 80 +$q1 = array(10,20,30,40); +$q2 = array(50,60); +$q3 = array($q1,$q2,null,70); +$q4 = array($q3,null,80); + +list(list(list($r,$s,,$t),list($u,$v),,$w),,$x) = $q4; +echo "$r $s $t $u $v $w $x\n"; + + +// expect y and z to be undefined +list($y,$z) = array(); +echo "Y=$y,Z=$z\n"; + +// expect h to be defined and be 10 +list($aa,$bb) = array(10); +echo "AA=$aa\n"; + +// expect cc and dd to be 10 and 30 +list($cc,,$dd) = array(10,20,30,40); +echo "CC=$cc DD=$dd\n"; + +// expect the inner array to be defined +$ee = array("original array"); +function f() { + global $ee; + $ee = array("array created in f()"); + return 1; +} +$ee["array entry created after f()"][f()] = "hello"; +print_r($ee); + +?> +--EXPECTF-- +A=hello B=bye + +Warning: Cannot use a scalar value as an array in %s on line %d +array(2) { + [0]=> + int(10) + [1]=> + int(10) +} +array(2) { + [0]=> + int(30) + [1]=> + int(30) +} +array(3) { + [0]=> + int(1000) + [1]=> + int(2000) + [2]=> + int(3000) +} +L=100 M=200 N=300 +O= and P= +10 20 40 50 60 70 80 + +Notice: Undefined offset: 1 in %s on line %d + +Notice: Undefined offset: 0 in %s on line %d +Y=,Z= + +Notice: Undefined offset: 1 in %s on line %d +AA=10 +CC=10 DD=30 +Array +( + [0] => array created in f() + [array entry created after f()] => Array + ( + [1] => hello + ) + +) diff --git a/tests/lang/engine_assignExecutionOrder_003.phpt b/tests/lang/engine_assignExecutionOrder_003.phpt new file mode 100644 index 0000000..ae3ae78 --- /dev/null +++ b/tests/lang/engine_assignExecutionOrder_003.phpt @@ -0,0 +1,96 @@ +--TEST-- +Evaluation order during assignments. +--FILE-- +<?php +$b = "bb"; +$a = "aa"; + +function foo() +{ +echo "Bad call\n"; +} + +function baa() +{ +echo "Good call\n"; +} + +$bb = "baa"; + +$aa = "foo"; + +$c = ${$a=$b}; + +$c(); + +$a1 = array("dead","dead","dead"); +$a2 = array("dead","dead","live"); +$a3 = array("dead","dead","dead"); + +$a = array($a1,$a2,$a3); + +function live() +{ +echo "Good call\n"; +} + +function dead() +{ +echo "Bad call\n"; +} + +$i = 0; + +$a[$i=1][++$i](); + +$a = -1; + +function foo1() +{ + global $a; + return ++$a; +} + +$arr = array(array(0,0),0); + +$brr = array(0,0,array(0,0,0,5),0); +$crr = array(0,0,0,0,array(0,0,0,0,0,10),0,0); + +$arr[foo1()][foo1()] = $brr[foo1()][foo1()] + + $crr[foo1()][foo1()]; + +$val = $arr[0][1]; +echo "Expect 15 and get...$val\n"; + +$x = array(array(0),0); +function mod($b) +{ +global $x; +$x = $b; +return 0; +} + +$x1 = array(array(1),1); +$x2 = array(array(2),2); +$x3 = array(array(3),3); +$bx = array(10); + +$x[mod($x1)][mod($x2)] = $bx[mod($x3)]; + +// expecting 10,3 + +var_dump($x); +?> +--EXPECT-- +Good call +Good call +Expect 15 and get...15 +array(2) { + [0]=> + array(1) { + [0]=> + int(10) + } + [1]=> + int(3) +}
\ No newline at end of file diff --git a/tests/lang/engine_assignExecutionOrder_004.phpt b/tests/lang/engine_assignExecutionOrder_004.phpt new file mode 100644 index 0000000..86bc87f --- /dev/null +++ b/tests/lang/engine_assignExecutionOrder_004.phpt @@ -0,0 +1,52 @@ +--TEST-- +Evaluation order during assignments. +--FILE-- +<?php + +function i1() { + echo "i1\n"; + return 1; +} + +function i2() { + echo "i2\n"; + return 1; +} + +function i3() { + echo "i3\n"; + return 3; +} + +function i4() { + global $a; + $a = array(10, 11, 12, 13, 14); + echo "i4\n"; + return 4; +} + +$a = 0; // $a should not be indexable till the i4 has been executed +list($a[i1()+i2()], , list($a[i3()], $a[i4()]), $a[]) = array (0, 1, array(30, 40), 3, 4); + +var_dump($a); + +?> +--EXPECT-- +i1 +i2 +i3 +i4 +array(6) { + [0]=> + int(10) + [1]=> + int(11) + [2]=> + int(0) + [3]=> + int(30) + [4]=> + int(40) + [5]=> + int(3) +} diff --git a/tests/lang/engine_assignExecutionOrder_005.phpt b/tests/lang/engine_assignExecutionOrder_005.phpt new file mode 100644 index 0000000..6ec03f1 --- /dev/null +++ b/tests/lang/engine_assignExecutionOrder_005.phpt @@ -0,0 +1,74 @@ +--TEST-- +Evaluation order during assignments. +--FILE-- +<?php + +function i1() { + echo "i1\n"; + return 0; +} + +function i2() { + echo "i2\n"; + return 0; +} + +function i3() { + echo "i3\n"; + return 0; +} + +function i4() { + echo "i4\n"; + return 0; +} + +function i5() { + echo "i5\n"; + return 0; +} + +function i6() { + echo "i6\n"; + return 0; +} + +$a = array(array(0)); +$b = array(array(1)); +$c = array(array(2)); + +$a[i1()][i2()] = $b[i3()][i4()] = $c[i5()][i6()]; + +var_dump($a); +var_dump($b); +var_dump($c); + +?> +--EXPECT-- +i1 +i2 +i3 +i4 +i5 +i6 +array(1) { + [0]=> + array(1) { + [0]=> + int(2) + } +} +array(1) { + [0]=> + array(1) { + [0]=> + int(2) + } +} +array(1) { + [0]=> + array(1) { + [0]=> + int(2) + } +} diff --git a/tests/lang/engine_assignExecutionOrder_006.phpt b/tests/lang/engine_assignExecutionOrder_006.phpt new file mode 100644 index 0000000..faa34c3 --- /dev/null +++ b/tests/lang/engine_assignExecutionOrder_006.phpt @@ -0,0 +1,138 @@ +--TEST-- +Evaluation order during assignments. +--FILE-- +<?php + +function i1() { + echo "i1\n"; + return 0; +} + +function i2() { + echo "i2\n"; + return 0; +} + +function i3() { + echo "i3\n"; + return 0; +} + +function i4() { + echo "i4\n"; + return 0; +} + +function i5() { + echo "i5\n"; + return 0; +} + +function i6() { + echo "i6\n"; + return 0; +} + +$a = array(array(0)); +$b = array(array(1)); +$c = array(array(2)); + +$a[i1()][i2()] = ($b[i3()][i4()] = $c[i5()][i6()]); +var_dump($a); +var_dump($b); +var_dump($c); + +$a[i1()][i2()] = $b[i3()][i4()] = -$c[i5()][i6()]; +var_dump($a); +var_dump($b); +var_dump($c); + +$a[i1()][i2()] = -($b[i3()][i4()] = +($c[i5()][i6()])); +var_dump($a); +var_dump($b); +var_dump($c); + + +?> +--EXPECT-- +i1 +i2 +i3 +i4 +i5 +i6 +array(1) { + [0]=> + array(1) { + [0]=> + int(2) + } +} +array(1) { + [0]=> + array(1) { + [0]=> + int(2) + } +} +array(1) { + [0]=> + array(1) { + [0]=> + int(2) + } +} +i1 +i2 +i3 +i4 +i5 +i6 +array(1) { + [0]=> + array(1) { + [0]=> + int(-2) + } +} +array(1) { + [0]=> + array(1) { + [0]=> + int(-2) + } +} +array(1) { + [0]=> + array(1) { + [0]=> + int(2) + } +} +i1 +i2 +i3 +i4 +i5 +i6 +array(1) { + [0]=> + array(1) { + [0]=> + int(-2) + } +} +array(1) { + [0]=> + array(1) { + [0]=> + int(2) + } +} +array(1) { + [0]=> + array(1) { + [0]=> + int(2) + } +} diff --git a/tests/lang/engine_assignExecutionOrder_007.phpt b/tests/lang/engine_assignExecutionOrder_007.phpt new file mode 100644 index 0000000..56b729e --- /dev/null +++ b/tests/lang/engine_assignExecutionOrder_007.phpt @@ -0,0 +1,46 @@ +--TEST-- +Check key execution order with &new. +--FILE-- +<?php +$a[2][3] = 'stdClass'; +$a[$i=0][++$i] =& new $a[++$i][++$i]; +print_r($a); + +$o = new stdClass; +$o->a =& new $a[$i=2][++$i]; +$o->a->b =& new $a[$i=2][++$i]; +print_r($o); +?> +--EXPECTF-- +Deprecated: Assigning the return value of new by reference is deprecated in %s.php on line 3 + +Deprecated: Assigning the return value of new by reference is deprecated in %s.php on line 7 + +Deprecated: Assigning the return value of new by reference is deprecated in %s.php on line 8 +Array +( + [2] => Array + ( + [3] => stdClass + ) + + [0] => Array + ( + [1] => stdClass Object + ( + ) + + ) + +) +stdClass Object +( + [a] => stdClass Object + ( + [b] => stdClass Object + ( + ) + + ) + +) diff --git a/tests/lang/engine_assignExecutionOrder_008.phpt b/tests/lang/engine_assignExecutionOrder_008.phpt new file mode 100644 index 0000000..1333bcd --- /dev/null +++ b/tests/lang/engine_assignExecutionOrder_008.phpt @@ -0,0 +1,81 @@ +--TEST-- +Ensure by value assignments leave temporaries on the stack, for all sorts of assignees. +--FILE-- +<?php +error_reporting(E_ALL & ~E_STRICT); + +function f() { return 0; } +$a[0][1] = 'good'; +$a[1][1] = 'bad'; + +echo "\n" . '$i=f(): '; +echo $a[$i=f()][++$i]; +unset($i); + +echo "\n" . '$$x=f(): '; +$x='i'; +echo $a[$$x=f()][++$$x]; +unset($i, $x); + +echo "\n" . '${\'i\'}=f(): '; +echo $a[${'i'}=f()][++${'i'}]; +unset(${'i'}); + +echo "\n" . '$i[0]=f(): '; +echo $a[$i[0]=f()][++$i[0]]; +unset($i); + +echo "\n" . '$i[0][0]=f(): '; +echo $a[$i[0][0]=f()][++$i[0][0]]; +unset($i); + +echo "\n" . '$i->p=f(): '; +echo $a[$i->p=f()][++$i->p]; +unset($i); + +echo "\n" . '$i->p->q=f(): '; +echo $a[$i->p->q=f()][++$i->p->q]; +unset($i); + +echo "\n" . '$i->p[0]=f(): '; +echo $a[$i->p[0]=f()][++$i->p[0]]; +unset($i); + +echo "\n" . '$i->p[0]->p=f(): '; +echo $a[$i->p[0]->p=f()][++$i->p[0]->p]; +unset($i); + +Class C { + static $p; +} + +echo "\n" . 'C::$p=f(): '; +echo $a[C::$p=f()][++C::$p]; + +echo "\n" . 'C::$p[0]=f(): '; +C::$p = array(); +echo $a[C::$p[0]=f()][++C::$p[0]]; + +echo "\n" . 'C::$p->q=f(): '; +C::$p = new stdclass; +echo $a[C::$p->q=f()][++C::$p->q]; +?> +--EXPECTF-- +$i=f(): good +$$x=f(): good +${'i'}=f(): good +$i[0]=f(): good +$i[0][0]=f(): good +$i->p=f(): +Warning: Creating default object from empty value in %s on line %d +good +$i->p->q=f(): +Warning: Creating default object from empty value in %s on line %d +good +$i->p[0]=f(): good +$i->p[0]->p=f(): +Warning: Creating default object from empty value in %s on line %d +good +C::$p=f(): good +C::$p[0]=f(): good +C::$p->q=f(): good diff --git a/tests/lang/engine_assignExecutionOrder_009.phpt b/tests/lang/engine_assignExecutionOrder_009.phpt new file mode 100644 index 0000000..e1d5b71 --- /dev/null +++ b/tests/lang/engine_assignExecutionOrder_009.phpt @@ -0,0 +1,36 @@ +--TEST-- +Execution ordering with comparison operators. +--FILE-- +<?php +function f($x) { + echo "f($x) "; + return $x; +} + +echo "Function call args:\n"; +var_dump(f($i=0) < f(++$i)); +var_dump(f($i=0) <= f(++$i)); +var_dump(f($i=0) > f(++$i)); +var_dump(f($i=0) >= f(++$i)); + +echo "\nArray indices:\n"; +$a[1][2] = 0; +$a[3][4] = 1; +$i=0; +var_dump($a[$i=1][++$i] < $a[++$i][++$i]); +var_dump($a[$i=1][++$i] <= $a[++$i][++$i]); +var_dump($a[$i=1][++$i] > $a[++$i][++$i]); +var_dump($a[$i=1][++$i] >= $a[++$i][++$i]); +?> +--EXPECTF-- +Function call args: +f(0) f(1) bool(true) +f(0) f(1) bool(true) +f(0) f(1) bool(false) +f(0) f(1) bool(false) + +Array indices: +bool(true) +bool(true) +bool(false) +bool(false) diff --git a/tests/lang/error_2_exception_001.phpt b/tests/lang/error_2_exception_001.phpt new file mode 100644 index 0000000..61f45d4 --- /dev/null +++ b/tests/lang/error_2_exception_001.phpt @@ -0,0 +1,45 @@ +--TEST-- +ZE2 errors caught as exceptions +--SKIPIF-- +<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> +--FILE-- +<?php + +class MyException extends Exception { + function MyException($_errno, $_errmsg) { + $this->errno = $_errno; + $this->errmsg = $_errmsg; + } + + function getErrno() { + return $this->errno; + } + + function getErrmsg() { + return $this->errmsg; + } +} + +function ErrorsToExceptions($errno, $errmsg) { + throw new MyException($errno, $errmsg); +} + +set_error_handler("ErrorsToExceptions"); + +// make sure it isn't catching exceptions that weren't +// thrown... + +try { +} catch (MyException $exception) { + echo "There was an exception: " . $exception->getErrno() . ", '" . $exception->getErrmsg() . "'\n"; +} + +try { + trigger_error("I will become an exception", E_USER_ERROR); +} catch (MyException $exception) { + echo "There was an exception: " . $exception->getErrno() . ", '" . $exception->getErrmsg() . "'\n"; +} + +?> +--EXPECT-- +There was an exception: 256, 'I will become an exception' diff --git a/tests/lang/execution_order.phpt b/tests/lang/execution_order.phpt new file mode 100644 index 0000000..ca3feb3 --- /dev/null +++ b/tests/lang/execution_order.phpt @@ -0,0 +1,198 @@ +--TEST-- +Execution order of variables +--FILE-- +<?php + +/* strings and concat */ + +class strclass { + var $str = "bad"; + static $statstr = "bad"; +} + +$a = "bad"; +$b = "good"; +echo "1)"; +$c = $a.($a=$b); +echo $c; +echo "\r\n"; + +$a = "bad"; +$b = "good"; +$c = ($a=$b).$a; +echo "2)"; +echo $c; +echo "\r\n"; + + +$str = new strclass(); +$c = $str->str.($str->str="good"); +echo "3)"; +echo $c; +echo "\r\n"; + +$str->str = "bad"; + +$c = ($str->str="good").$str->str; +echo "4)"; +echo $c; +echo "\r\n"; + +$c = strclass::$statstr.(strclass::$statstr="good"); +echo "5)"; +echo $c; +echo "\r\n"; + +strclass::$statstr = "bad"; + +$c = (strclass::$statstr="good").strclass::$statstr; +echo "6)"; +echo $c; +echo "\r\n"; + + +function foo() { + global $a; + $a = "good"; + return $a; +} + + +$a = "bad"; +echo "7)"; +echo foo() . $a; +echo "\r\n"; + +$a = "bad"; +echo "8)"; +echo $a . foo(); +echo "\r\n"; + +/* other operators */ + +$x = 1; +$z = $x - ($x++); +echo "9)"; +echo $z; +echo "\r\n"; + +$x = 1; +$z = ($x++) - $x; +echo "10)"; +echo $z; +echo "\r\n"; + +$x = 1; +$z = $x - (++$x); +echo "11)"; +echo $z; +echo "\r\n"; + +$x = 1; +$z = (++$x) - $x; +echo "12)"; +echo $z; +echo "\r\n"; + + +$x = 1; +$y = 3; +$z = $x - ($x=$y); +echo "13)"; +echo $z; +echo "\r\n"; + +$x = 1; +$y = 3; +$z = ($x=$y) - $x; +echo "14)"; +echo $z; +echo "\r\n"; + + +$a = 100; +$b = 200; +echo "15)"; +echo $a + ($a=$b); +echo "\r\n"; + +$a = 100; +$b = 200; +echo "16)"; +echo ($a=$b) + $a; +echo "\r\n"; + + +$a = array(100,200); +$i = 0; + +echo "17)"; +echo $a[$i++] + $a[$i++]; +echo "\r\n"; + +$i = -1; +echo "18)"; +echo $a[++$i] + $a[++$i]; +echo "\r\n"; + +$i = 0; +echo "19)"; +echo $a[$i] + ($a[$i]=400); +echo "\r\n"; + + +$a[0] = 100; +echo "20)"; +echo ($a[$i]=400) + $a[$i]; +echo "\r\n"; + + +class c { + var $val = 10; + static $stat = 20; +} + +echo "21)"; +echo c::$stat + (c::$stat=200); +echo "\r\n"; + +echo "22)"; +echo (c::$stat=300) + c::$stat; +echo "\r\n"; + +$c = new c(); + +echo "23)"; +echo $c->val + ($c->val=200); +echo "\r\n"; + +echo "24)"; +echo ($c->val=300) + $c->val; +echo "\r\n"; + +?> +--EXPECT-- +1)goodgood +2)goodgood +3)badgood +4)goodgood +5)badgood +6)goodgood +7)goodgood +8)goodgood +9)1 +10)-1 +11)0 +12)0 +13)0 +14)0 +15)400 +16)400 +17)300 +18)300 +19)500 +20)800 +21)220 +22)600 +23)210 +24)600 diff --git a/tests/lang/foreachLoop.001.phpt b/tests/lang/foreachLoop.001.phpt new file mode 100644 index 0000000..164cac6 --- /dev/null +++ b/tests/lang/foreachLoop.001.phpt @@ -0,0 +1,64 @@ +--TEST--
+Foreach loop tests - basic loop with just value and key => value.
+--FILE--
+<?php
+
+$a = array("a","b","c");
+
+foreach ($a as $v) {
+ var_dump($v);
+}
+foreach ($a as $k => $v) {
+ var_dump($k, $v);
+}
+//check key and value after the loop.
+var_dump($k, $v);
+
+echo "\n";
+//Dynamic array
+foreach (array("d","e","f") as $v) {
+ var_dump($v);
+}
+foreach (array("d","e","f") as $k => $v) {
+ var_dump($k, $v);
+}
+//check key and value after the loop.
+var_dump($k, $v);
+
+echo "\n";
+//Ensure counter is advanced during loop
+$a=array("a","b","c");
+foreach ($a as $v);
+var_dump(current($a));
+$a=array("a","b","c");
+foreach ($a as &$v);
+var_dump(current($a));
+
+?>
+--EXPECT--
+string(1) "a"
+string(1) "b"
+string(1) "c"
+int(0)
+string(1) "a"
+int(1)
+string(1) "b"
+int(2)
+string(1) "c"
+int(2)
+string(1) "c"
+
+string(1) "d"
+string(1) "e"
+string(1) "f"
+int(0)
+string(1) "d"
+int(1)
+string(1) "e"
+int(2)
+string(1) "f"
+int(2)
+string(1) "f"
+
+bool(false)
+bool(false)
\ No newline at end of file diff --git a/tests/lang/foreachLoop.002.phpt b/tests/lang/foreachLoop.002.phpt new file mode 100644 index 0000000..e3000c7 --- /dev/null +++ b/tests/lang/foreachLoop.002.phpt @@ -0,0 +1,173 @@ +--TEST--
+Foreach loop tests - modifying the array during the loop.
+--FILE--
+<?php
+
+echo "\nDirectly changing array values.\n";
+$a = array("original.1","original.2","original.3");
+foreach ($a as $k=>$v) {
+ $a[$k]="changed.$k";
+ var_dump($v);
+}
+var_dump($a);
+
+echo "\nModifying the foreach \$value.\n";
+$a = array("original.1","original.2","original.3");
+foreach ($a as $k=>$v) {
+ $v="changed.$k";
+}
+var_dump($a);
+
+
+echo "\nModifying the foreach &\$value.\n";
+$a = array("original.1","original.2","original.3");
+foreach ($a as $k=>&$v) {
+ $v="changed.$k";
+}
+var_dump($a);
+
+echo "\nPushing elements onto an unreferenced array.\n";
+$a = array("original.1","original.2","original.3");
+$counter=0;
+foreach ($a as $v) {
+ array_push($a, "new.$counter");
+
+ //avoid infinite loop if test is failing
+ if ($counter++>10) {
+ echo "Loop detected\n";
+ break;
+ }
+}
+var_dump($a);
+
+echo "\nPushing elements onto an unreferenced array, using &\$value.\n";
+$a = array("original.1","original.2","original.3");
+$counter=0;
+foreach ($a as &$v) {
+ array_push($a, "new.$counter");
+
+ //avoid infinite loop if test is failing
+ if ($counter++>10) {
+ echo "Loop detected\n";
+ break;
+ }
+}
+var_dump($a);
+
+echo "\nPopping elements off an unreferenced array.\n";
+$a = array("original.1","original.2","original.3");
+foreach ($a as $v) {
+ array_pop($a);
+ var_dump($v);
+}
+var_dump($a);
+
+echo "\nPopping elements off an unreferenced array, using &\$value.\n";
+$a = array("original.1","original.2","original.3");
+foreach ($a as &$v) {
+ array_pop($a);
+ var_dump($v);
+}
+var_dump($a);
+
+?>
+--EXPECT--
+
+Directly changing array values.
+string(10) "original.1"
+string(10) "original.2"
+string(10) "original.3"
+array(3) {
+ [0]=>
+ string(9) "changed.0"
+ [1]=>
+ string(9) "changed.1"
+ [2]=>
+ string(9) "changed.2"
+}
+
+Modifying the foreach $value.
+array(3) {
+ [0]=>
+ string(10) "original.1"
+ [1]=>
+ string(10) "original.2"
+ [2]=>
+ string(10) "original.3"
+}
+
+Modifying the foreach &$value.
+array(3) {
+ [0]=>
+ string(9) "changed.0"
+ [1]=>
+ string(9) "changed.1"
+ [2]=>
+ &string(9) "changed.2"
+}
+
+Pushing elements onto an unreferenced array.
+array(6) {
+ [0]=>
+ string(10) "original.1"
+ [1]=>
+ string(10) "original.2"
+ [2]=>
+ string(10) "original.3"
+ [3]=>
+ string(5) "new.0"
+ [4]=>
+ string(5) "new.1"
+ [5]=>
+ string(5) "new.2"
+}
+
+Pushing elements onto an unreferenced array, using &$value.
+Loop detected
+array(15) {
+ [0]=>
+ string(10) "original.1"
+ [1]=>
+ string(10) "original.2"
+ [2]=>
+ string(10) "original.3"
+ [3]=>
+ string(5) "new.0"
+ [4]=>
+ string(5) "new.1"
+ [5]=>
+ string(5) "new.2"
+ [6]=>
+ string(5) "new.3"
+ [7]=>
+ string(5) "new.4"
+ [8]=>
+ string(5) "new.5"
+ [9]=>
+ string(5) "new.6"
+ [10]=>
+ string(5) "new.7"
+ [11]=>
+ &string(5) "new.8"
+ [12]=>
+ string(5) "new.9"
+ [13]=>
+ string(6) "new.10"
+ [14]=>
+ string(6) "new.11"
+}
+
+Popping elements off an unreferenced array.
+string(10) "original.1"
+string(10) "original.2"
+string(10) "original.3"
+array(0) {
+}
+
+Popping elements off an unreferenced array, using &$value.
+string(10) "original.1"
+string(10) "original.2"
+array(1) {
+ [0]=>
+ string(10) "original.1"
+}
\ No newline at end of file diff --git a/tests/lang/foreachLoop.003.phpt b/tests/lang/foreachLoop.003.phpt new file mode 100644 index 0000000..d554d0d --- /dev/null +++ b/tests/lang/foreachLoop.003.phpt @@ -0,0 +1,46 @@ +--TEST--
+Foreach loop tests - error case: not an array.
+--FILE--
+<?php
+echo "\nNot an array.\n";
+$a = TRUE;
+foreach ($a as $v) {
+ var_dump($v);
+}
+
+$a = null;
+foreach ($a as $v) {
+ var_dump($v);
+}
+
+$a = 1;
+foreach ($a as $v) {
+ var_dump($v);
+}
+
+$a = 1.5;
+foreach ($a as $v) {
+ var_dump($v);
+}
+
+$a = "hello";
+foreach ($a as $v) {
+ var_dump($v);
+}
+
+echo "done.\n";
+?>
+--EXPECTF--
+
+Not an array.
+
+Warning: Invalid argument supplied for foreach() in %s on line 4
+
+Warning: Invalid argument supplied for foreach() in %s on line 9
+
+Warning: Invalid argument supplied for foreach() in %s on line 14
+
+Warning: Invalid argument supplied for foreach() in %s on line 19
+
+Warning: Invalid argument supplied for foreach() in %s on line 24
+done.
diff --git a/tests/lang/foreachLoop.004.phpt b/tests/lang/foreachLoop.004.phpt new file mode 100644 index 0000000..8cc6094 --- /dev/null +++ b/tests/lang/foreachLoop.004.phpt @@ -0,0 +1,76 @@ +--TEST--
+Foreach loop tests - using an array element as the $value
+--FILE--
+<?php
+
+$a=array("a", "b", "c");
+$v=array();
+foreach($a as $v[0]) {
+ var_dump($v);
+}
+var_dump($a);
+var_dump($v);
+
+echo "\n";
+$a=array("a", "b", "c");
+$v=array();
+foreach($a as $k=>$v[0]) {
+ var_dump($k, $v);
+}
+var_dump($a);
+var_dump($k, $v);
+?>
+--EXPECT--
+array(1) {
+ [0]=>
+ string(1) "a"
+}
+array(1) {
+ [0]=>
+ string(1) "b"
+}
+array(1) {
+ [0]=>
+ string(1) "c"
+}
+array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+}
+array(1) {
+ [0]=>
+ string(1) "c"
+}
+
+int(0)
+array(1) {
+ [0]=>
+ string(1) "a"
+}
+int(1)
+array(1) {
+ [0]=>
+ string(1) "b"
+}
+int(2)
+array(1) {
+ [0]=>
+ string(1) "c"
+}
+array(3) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "b"
+ [2]=>
+ string(1) "c"
+}
+int(2)
+array(1) {
+ [0]=>
+ string(1) "c"
+}
\ No newline at end of file diff --git a/tests/lang/foreachLoop.005.phpt b/tests/lang/foreachLoop.005.phpt new file mode 100644 index 0000000..ae6ed3a --- /dev/null +++ b/tests/lang/foreachLoop.005.phpt @@ -0,0 +1,23 @@ +--TEST--
+Foreach loop tests - modifying the array during the loop: special case. Behaviour is good since php 5.2.2.
+--FILE--
+<?php
+$a = array("original.0","original.1","original.2");
+foreach ($a as $k=>&$v){
+ $a[$k] = "changed.$k";
+ echo "After changing \$a directly, \$v@$k is: $v\n";
+}
+//--- Expected output:
+//After changing $a directly, $v@0 is: changed.0
+//After changing $a directly, $v@1 is: changed.1
+//After changing $a directly, $v@2 is: changed.2
+//--- Actual output from php.net before 5.2.2:
+//After changing $a directly, $v@0 is: changed.0
+//After changing $a directly, $v@1 is: original.1
+//After changing $a directly, $v@2 is: original.2
+
+?>
+--EXPECT--
+After changing $a directly, $v@0 is: changed.0
+After changing $a directly, $v@1 is: changed.1
+After changing $a directly, $v@2 is: changed.2
diff --git a/tests/lang/foreachLoop.006.phpt b/tests/lang/foreachLoop.006.phpt new file mode 100644 index 0000000..a90f924 --- /dev/null +++ b/tests/lang/foreachLoop.006.phpt @@ -0,0 +1,11 @@ +--TEST--
+Foreach loop tests - error case: key is a reference.
+--FILE--
+<?php
+$a = array("a","b","c");
+foreach ($a as &$k=>$v) {
+ var_dump($v);
+}
+?>
+--EXPECTF--
+Fatal error: Key element cannot be a reference in %s on line 3
\ No newline at end of file diff --git a/tests/lang/foreachLoop.007.phpt b/tests/lang/foreachLoop.007.phpt new file mode 100644 index 0000000..f47fdc7 --- /dev/null +++ b/tests/lang/foreachLoop.007.phpt @@ -0,0 +1,11 @@ +--TEST--
+Foreach loop tests - error case: reference to constant array.
+--FILE--
+<?php
+echo "\nReference to constant array\n";
+foreach (array(1,2) as &$v) {
+ var_dump($v);
+}
+?>
+--EXPECTF--
+Parse error: %s on line 3
diff --git a/tests/lang/foreachLoop.008.phpt b/tests/lang/foreachLoop.008.phpt new file mode 100644 index 0000000..787f43b --- /dev/null +++ b/tests/lang/foreachLoop.008.phpt @@ -0,0 +1,10 @@ +--TEST--
+Foreach loop tests - error case: reference to constant array, with key.
+--FILE--
+<?php
+foreach (array(1,2) as $k=>&$v) {
+ var_dump($v);
+}
+?>
+--EXPECTF--
+Fatal error: Cannot create references to elements of a temporary array expression in %s on line 2
diff --git a/tests/lang/foreachLoop.009.phpt b/tests/lang/foreachLoop.009.phpt new file mode 100644 index 0000000..4586a35 --- /dev/null +++ b/tests/lang/foreachLoop.009.phpt @@ -0,0 +1,82 @@ +--TEST--
+Foreach loop tests - foreach operates on the original array if the array is referenced outside the loop.
+--FILE--
+<?php
+// From php.net/foreach:
+// "Unless the array is referenced, foreach operates on a copy of the specified array."
+
+echo "\nRemove elements from a referenced array during loop\n";
+$refedArray=array("original.0", "original.1", "original.2");
+$ref=&$refedArray;
+foreach ($refedArray as $k=>$v1) {
+ array_pop($refedArray);
+ echo "key: $k; value: $v1\n";
+}
+
+echo "\nRemove elements from a referenced array during loop, using &\$value\n";
+$refedArray=array("original.0", "original.1", "original.2");
+$ref=&$refedArray;
+foreach ($refedArray as $k=>&$v2) {
+ array_pop($refedArray);
+ echo "key: $k; value: $v2\n";
+}
+
+echo "\nAdd elements to a referenced array during loop\n";
+$refedArray=array("original.0", "original.1", "original.2");
+$ref=&$refedArray;
+$count=0;
+foreach ($refedArray as $k=>$v3) {
+ array_push($refedArray, "new.$k");
+ echo "key: $k; value: $v3\n";
+
+ if ($count++>5) {
+ echo "Loop detected, as expected.\n";
+ break;
+ }
+}
+
+echo "\nAdd elements to a referenced array during loop, using &\$value\n";
+$refedArray=array("original.0", "original.1", "original.2");
+$ref=&$refedArray;
+$count=0;
+foreach ($refedArray as $k=>&$v4) {
+ array_push($refedArray, "new.$k");
+ echo "key: $k; value: $v4\n";
+
+ if ($count++>5) {
+ echo "Loop detected, as expected.\n";
+ break;
+ }
+}
+
+?>
+--EXPECT--
+
+Remove elements from a referenced array during loop
+key: 0; value: original.0
+key: 1; value: original.1
+
+Remove elements from a referenced array during loop, using &$value
+key: 0; value: original.0
+key: 1; value: original.1
+
+Add elements to a referenced array during loop
+key: 0; value: original.0
+key: 1; value: original.1
+key: 2; value: original.2
+key: 3; value: new.0
+key: 4; value: new.1
+key: 5; value: new.2
+key: 6; value: new.3
+Loop detected, as expected.
+
+Add elements to a referenced array during loop, using &$value
+key: 0; value: original.0
+key: 1; value: original.1
+key: 2; value: original.2
+key: 3; value: new.0
+key: 4; value: new.1
+key: 5; value: new.2
+key: 6; value: new.3
+Loop detected, as expected.
+
diff --git a/tests/lang/foreachLoop.010.phpt b/tests/lang/foreachLoop.010.phpt new file mode 100644 index 0000000..a7a3e97 --- /dev/null +++ b/tests/lang/foreachLoop.010.phpt @@ -0,0 +1,40 @@ +--TEST--
+This test illustrates the impact of invoking destructors when refcount is decremented to 0 on foreach.
+It will pass only if the 'contentious code' in PHPValue.decReferences() is enabled.
+--FILE--
+<?php
+
+$a = array(1,2,3);
+$container = array(&$a);
+
+// From php.net:
+// "Unless the array is referenced, foreach operates on a copy of
+// the specified array and not the array itself."
+// At this point, the array $a is referenced.
+
+// The following line ensures $a is no longer references as a consequence
+// of running the 'destructor' on $container.
+$container = null;
+
+// At this point the array $a is no longer referenced, so foreach should operate on a copy of the array.
+// However, P8 does not invoke 'destructors' when refcount is decremented to 0.
+// Consequently, $a thinks it is still referenced, and foreach will operate on the array itself.
+// This provokes a difference in behaviour when changing the number of elements in the array while
+// iterating over it.
+
+$i=0;
+foreach ($a as $v) {
+ array_push($a, 'new');
+ var_dump($v);
+
+ if (++$i>10) {
+ echo "Infinite loop detected\n";
+ break;
+ }
+}
+
+?>
+--EXPECTF--
+int(1)
+int(2)
+int(3)
\ No newline at end of file diff --git a/tests/lang/foreachLoop.011.phpt b/tests/lang/foreachLoop.011.phpt new file mode 100644 index 0000000..94cb605 --- /dev/null +++ b/tests/lang/foreachLoop.011.phpt @@ -0,0 +1,34 @@ +--TEST--
+Changing from an interable type to a non iterable type during the iteration
+--FILE--
+<?php
+echo "\nChange from array to non iterable:\n";
+$a = array(1,2,3);
+$b=&$a;
+foreach ($a as $v) {
+ var_dump($v);
+ $b=1;
+}
+
+echo "\nChange from object to non iterable:\n";
+$a = new stdClass;
+$a->a=1;
+$a->b=2;
+$b=&$a;
+foreach ($a as $v) {
+ var_dump($v);
+ $b='x';
+}
+
+?>
+--EXPECTF--
+
+Change from array to non iterable:
+int(1)
+
+Warning: Invalid argument supplied for foreach() in %s on line 5
+
+Change from object to non iterable:
+int(1)
+
+Warning: Invalid argument supplied for foreach() in %s on line 15
\ No newline at end of file diff --git a/tests/lang/foreachLoop.012.phpt b/tests/lang/foreachLoop.012.phpt new file mode 100644 index 0000000..1165b74 --- /dev/null +++ b/tests/lang/foreachLoop.012.phpt @@ -0,0 +1,494 @@ +--TEST--
+Directly modifying an unreferenced array when foreach'ing over it.
+--FILE--
+<?php
+
+define('MAX_LOOPS',5);
+
+function withRefValue($elements, $transform) {
+ echo "\n---( Array with $elements element(s): )---\n";
+ //Build array:
+ for ($i=0; $i<$elements; $i++) {
+ $a[] = "v.$i";
+ }
+ $counter=0;
+
+ echo "--> State of array before loop:\n";
+ var_dump($a);
+
+ echo "--> Do loop:\n";
+ foreach ($a as $k=>$v) {
+ echo " iteration $counter: \$k=$k; \$v=$v\n";
+ eval($transform);
+ $counter++;
+ if ($counter>MAX_LOOPS) {
+ echo " ** Stuck in a loop! **\n";
+ break;
+ }
+ }
+
+ echo "--> State of array after loop:\n";
+ var_dump($a);
+}
+
+
+echo "\nPopping elements off end of an unreferenced array";
+$transform = 'array_pop($a);';
+withRefValue(1, $transform);
+withRefValue(2, $transform);
+withRefValue(3, $transform);
+withRefValue(4, $transform);
+
+echo "\n\n\nShift elements off start of an unreferenced array";
+$transform = 'array_shift($a);';
+withRefValue(1, $transform);
+withRefValue(2, $transform);
+withRefValue(3, $transform);
+withRefValue(4, $transform);
+
+echo "\n\n\nRemove current element of an unreferenced array";
+$transform = 'unset($a[$k]);';
+withRefValue(1, $transform);
+withRefValue(2, $transform);
+withRefValue(3, $transform);
+withRefValue(4, $transform);
+
+echo "\n\n\nAdding elements to the end of an unreferenced array";
+$transform = 'array_push($a, "new.$counter");';
+withRefValue(1, $transform);
+withRefValue(2, $transform);
+withRefValue(3, $transform);
+withRefValue(4, $transform);
+
+echo "\n\n\nAdding elements to the start of an unreferenced array";
+$transform = 'array_unshift($a, "new.$counter");';
+withRefValue(1, $transform);
+withRefValue(2, $transform);
+withRefValue(3, $transform);
+withRefValue(4, $transform);
+
+?>
+--EXPECTF--
+
+Popping elements off end of an unreferenced array
+---( Array with 1 element(s): )---
+--> State of array before loop:
+array(1) {
+ [0]=>
+ string(3) "v.0"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 2 element(s): )---
+--> State of array before loop:
+array(2) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 3 element(s): )---
+--> State of array before loop:
+array(3) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=v.2
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 4 element(s): )---
+--> State of array before loop:
+array(4) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(3) "v.3"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=v.2
+ iteration 3: $k=3; $v=v.3
+--> State of array after loop:
+array(0) {
+}
+
+
+
+Shift elements off start of an unreferenced array
+---( Array with 1 element(s): )---
+--> State of array before loop:
+array(1) {
+ [0]=>
+ string(3) "v.0"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 2 element(s): )---
+--> State of array before loop:
+array(2) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 3 element(s): )---
+--> State of array before loop:
+array(3) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=v.2
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 4 element(s): )---
+--> State of array before loop:
+array(4) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(3) "v.3"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=v.2
+ iteration 3: $k=3; $v=v.3
+--> State of array after loop:
+array(0) {
+}
+
+
+
+Remove current element of an unreferenced array
+---( Array with 1 element(s): )---
+--> State of array before loop:
+array(1) {
+ [0]=>
+ string(3) "v.0"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 2 element(s): )---
+--> State of array before loop:
+array(2) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 3 element(s): )---
+--> State of array before loop:
+array(3) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=v.2
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 4 element(s): )---
+--> State of array before loop:
+array(4) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(3) "v.3"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=v.2
+ iteration 3: $k=3; $v=v.3
+--> State of array after loop:
+array(0) {
+}
+
+
+
+Adding elements to the end of an unreferenced array
+---( Array with 1 element(s): )---
+--> State of array before loop:
+array(1) {
+ [0]=>
+ string(3) "v.0"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+--> State of array after loop:
+array(2) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(5) "new.0"
+}
+
+---( Array with 2 element(s): )---
+--> State of array before loop:
+array(2) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+--> State of array after loop:
+array(4) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(5) "new.0"
+ [3]=>
+ string(5) "new.1"
+}
+
+---( Array with 3 element(s): )---
+--> State of array before loop:
+array(3) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=v.2
+--> State of array after loop:
+array(6) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(5) "new.0"
+ [4]=>
+ string(5) "new.1"
+ [5]=>
+ string(5) "new.2"
+}
+
+---( Array with 4 element(s): )---
+--> State of array before loop:
+array(4) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(3) "v.3"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=v.2
+ iteration 3: $k=3; $v=v.3
+--> State of array after loop:
+array(8) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(3) "v.3"
+ [4]=>
+ string(5) "new.0"
+ [5]=>
+ string(5) "new.1"
+ [6]=>
+ string(5) "new.2"
+ [7]=>
+ string(5) "new.3"
+}
+
+
+
+Adding elements to the start of an unreferenced array
+---( Array with 1 element(s): )---
+--> State of array before loop:
+array(1) {
+ [0]=>
+ string(3) "v.0"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+--> State of array after loop:
+array(2) {
+ [0]=>
+ string(5) "new.0"
+ [1]=>
+ string(3) "v.0"
+}
+
+---( Array with 2 element(s): )---
+--> State of array before loop:
+array(2) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+--> State of array after loop:
+array(4) {
+ [0]=>
+ string(5) "new.1"
+ [1]=>
+ string(5) "new.0"
+ [2]=>
+ string(3) "v.0"
+ [3]=>
+ string(3) "v.1"
+}
+
+---( Array with 3 element(s): )---
+--> State of array before loop:
+array(3) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=v.2
+--> State of array after loop:
+array(6) {
+ [0]=>
+ string(5) "new.2"
+ [1]=>
+ string(5) "new.1"
+ [2]=>
+ string(5) "new.0"
+ [3]=>
+ string(3) "v.0"
+ [4]=>
+ string(3) "v.1"
+ [5]=>
+ string(3) "v.2"
+}
+
+---( Array with 4 element(s): )---
+--> State of array before loop:
+array(4) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(3) "v.3"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=v.2
+ iteration 3: $k=3; $v=v.3
+--> State of array after loop:
+array(8) {
+ [0]=>
+ string(5) "new.3"
+ [1]=>
+ string(5) "new.2"
+ [2]=>
+ string(5) "new.1"
+ [3]=>
+ string(5) "new.0"
+ [4]=>
+ string(3) "v.0"
+ [5]=>
+ string(3) "v.1"
+ [6]=>
+ string(3) "v.2"
+ [7]=>
+ string(3) "v.3"
+}
diff --git a/tests/lang/foreachLoop.013.phpt b/tests/lang/foreachLoop.013.phpt new file mode 100644 index 0000000..3dec119 --- /dev/null +++ b/tests/lang/foreachLoop.013.phpt @@ -0,0 +1,555 @@ +--TEST--
+Directly modifying an unreferenced array when foreach'ing over it while using &$value syntax.
+--FILE--
+<?php
+
+define('MAX_LOOPS',5);
+
+function withRefValue($elements, $transform) {
+ echo "\n---( Array with $elements element(s): )---\n";
+ //Build array:
+ for ($i=0; $i<$elements; $i++) {
+ $a[] = "v.$i";
+ }
+ $counter=0;
+
+ echo "--> State of array before loop:\n";
+ var_dump($a);
+
+ echo "--> Do loop:\n";
+ foreach ($a as $k=>&$v) {
+ echo " iteration $counter: \$k=$k; \$v=$v\n";
+ eval($transform);
+ $counter++;
+ if ($counter>MAX_LOOPS) {
+ echo " ** Stuck in a loop! **\n";
+ break;
+ }
+ }
+
+ echo "--> State of array after loop:\n";
+ var_dump($a);
+}
+
+
+echo "\nPopping elements off end of an unreferenced array, using &\$value.";
+$transform = 'array_pop($a);';
+withRefValue(1, $transform);
+withRefValue(2, $transform);
+withRefValue(3, $transform);
+withRefValue(4, $transform);
+
+echo "\n\n\nShift elements off start of an unreferenced array, using &\$value.";
+$transform = 'array_shift($a);';
+withRefValue(1, $transform);
+withRefValue(2, $transform);
+withRefValue(3, $transform);
+withRefValue(4, $transform);
+
+echo "\n\n\nRemove current element of an unreferenced array, using &\$value.";
+$transform = 'unset($a[$k]);';
+withRefValue(1, $transform);
+withRefValue(2, $transform);
+withRefValue(3, $transform);
+withRefValue(4, $transform);
+
+echo "\n\n\nAdding elements to the end of an unreferenced array, using &\$value.";
+$transform = 'array_push($a, "new.$counter");';
+withRefValue(1, $transform);
+withRefValue(2, $transform);
+withRefValue(3, $transform);
+withRefValue(4, $transform);
+
+echo "\n\n\nAdding elements to the start of an unreferenced array, using &\$value.";
+$transform = 'array_unshift($a, "new.$counter");';
+withRefValue(1, $transform);
+withRefValue(2, $transform);
+withRefValue(3, $transform);
+withRefValue(4, $transform);
+
+?>
+--EXPECTF--
+
+Popping elements off end of an unreferenced array, using &$value.
+---( Array with 1 element(s): )---
+--> State of array before loop:
+array(1) {
+ [0]=>
+ string(3) "v.0"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 2 element(s): )---
+--> State of array before loop:
+array(2) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=0; $v=v.0
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 3 element(s): )---
+--> State of array before loop:
+array(3) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+--> State of array after loop:
+array(1) {
+ [0]=>
+ string(3) "v.0"
+}
+
+---( Array with 4 element(s): )---
+--> State of array before loop:
+array(4) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(3) "v.3"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=0; $v=v.0
+ iteration 3: $k=0; $v=v.0
+--> State of array after loop:
+array(0) {
+}
+
+
+
+Shift elements off start of an unreferenced array, using &$value.
+---( Array with 1 element(s): )---
+--> State of array before loop:
+array(1) {
+ [0]=>
+ string(3) "v.0"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 2 element(s): )---
+--> State of array before loop:
+array(2) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=0; $v=v.1
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 3 element(s): )---
+--> State of array before loop:
+array(3) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=0; $v=v.1
+ iteration 2: $k=0; $v=v.2
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 4 element(s): )---
+--> State of array before loop:
+array(4) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(3) "v.3"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=0; $v=v.1
+ iteration 2: $k=0; $v=v.2
+ iteration 3: $k=0; $v=v.3
+--> State of array after loop:
+array(0) {
+}
+
+
+
+Remove current element of an unreferenced array, using &$value.
+---( Array with 1 element(s): )---
+--> State of array before loop:
+array(1) {
+ [0]=>
+ string(3) "v.0"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 2 element(s): )---
+--> State of array before loop:
+array(2) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 3 element(s): )---
+--> State of array before loop:
+array(3) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=v.2
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 4 element(s): )---
+--> State of array before loop:
+array(4) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(3) "v.3"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=v.2
+ iteration 3: $k=3; $v=v.3
+--> State of array after loop:
+array(0) {
+}
+
+
+
+Adding elements to the end of an unreferenced array, using &$value.
+---( Array with 1 element(s): )---
+--> State of array before loop:
+array(1) {
+ [0]=>
+ string(3) "v.0"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+--> State of array after loop:
+array(2) {
+ [0]=>
+ &string(3) "v.0"
+ [1]=>
+ string(5) "new.0"
+}
+
+---( Array with 2 element(s): )---
+--> State of array before loop:
+array(2) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=new.0
+ iteration 3: $k=3; $v=new.1
+ iteration 4: $k=4; $v=new.2
+ iteration 5: $k=5; $v=new.3
+ ** Stuck in a loop! **
+--> State of array after loop:
+array(8) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(5) "new.0"
+ [3]=>
+ string(5) "new.1"
+ [4]=>
+ string(5) "new.2"
+ [5]=>
+ &string(5) "new.3"
+ [6]=>
+ string(5) "new.4"
+ [7]=>
+ string(5) "new.5"
+}
+
+---( Array with 3 element(s): )---
+--> State of array before loop:
+array(3) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=v.2
+ iteration 3: $k=3; $v=new.0
+ iteration 4: $k=4; $v=new.1
+ iteration 5: $k=5; $v=new.2
+ ** Stuck in a loop! **
+--> State of array after loop:
+array(9) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(5) "new.0"
+ [4]=>
+ string(5) "new.1"
+ [5]=>
+ &string(5) "new.2"
+ [6]=>
+ string(5) "new.3"
+ [7]=>
+ string(5) "new.4"
+ [8]=>
+ string(5) "new.5"
+}
+
+---( Array with 4 element(s): )---
+--> State of array before loop:
+array(4) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(3) "v.3"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=v.2
+ iteration 3: $k=3; $v=v.3
+ iteration 4: $k=4; $v=new.0
+ iteration 5: $k=5; $v=new.1
+ ** Stuck in a loop! **
+--> State of array after loop:
+array(10) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(3) "v.3"
+ [4]=>
+ string(5) "new.0"
+ [5]=>
+ &string(5) "new.1"
+ [6]=>
+ string(5) "new.2"
+ [7]=>
+ string(5) "new.3"
+ [8]=>
+ string(5) "new.4"
+ [9]=>
+ string(5) "new.5"
+}
+
+
+
+Adding elements to the start of an unreferenced array, using &$value.
+---( Array with 1 element(s): )---
+--> State of array before loop:
+array(1) {
+ [0]=>
+ string(3) "v.0"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+--> State of array after loop:
+array(2) {
+ [0]=>
+ string(5) "new.0"
+ [1]=>
+ &string(3) "v.0"
+}
+
+---( Array with 2 element(s): )---
+--> State of array before loop:
+array(2) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=0; $v=new.0
+ iteration 2: $k=0; $v=new.1
+ iteration 3: $k=0; $v=new.2
+ iteration 4: $k=0; $v=new.3
+ iteration 5: $k=0; $v=new.4
+ ** Stuck in a loop! **
+--> State of array after loop:
+array(8) {
+ [0]=>
+ string(5) "new.5"
+ [1]=>
+ &string(5) "new.4"
+ [2]=>
+ string(5) "new.3"
+ [3]=>
+ string(5) "new.2"
+ [4]=>
+ string(5) "new.1"
+ [5]=>
+ string(5) "new.0"
+ [6]=>
+ string(3) "v.0"
+ [7]=>
+ string(3) "v.1"
+}
+
+---( Array with 3 element(s): )---
+--> State of array before loop:
+array(3) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=0; $v=new.0
+ iteration 2: $k=0; $v=new.1
+ iteration 3: $k=0; $v=new.2
+ iteration 4: $k=0; $v=new.3
+ iteration 5: $k=0; $v=new.4
+ ** Stuck in a loop! **
+--> State of array after loop:
+array(9) {
+ [0]=>
+ string(5) "new.5"
+ [1]=>
+ &string(5) "new.4"
+ [2]=>
+ string(5) "new.3"
+ [3]=>
+ string(5) "new.2"
+ [4]=>
+ string(5) "new.1"
+ [5]=>
+ string(5) "new.0"
+ [6]=>
+ string(3) "v.0"
+ [7]=>
+ string(3) "v.1"
+ [8]=>
+ string(3) "v.2"
+}
+
+---( Array with 4 element(s): )---
+--> State of array before loop:
+array(4) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(3) "v.3"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=0; $v=new.0
+ iteration 2: $k=0; $v=new.1
+ iteration 3: $k=0; $v=new.2
+ iteration 4: $k=0; $v=new.3
+ iteration 5: $k=0; $v=new.4
+ ** Stuck in a loop! **
+--> State of array after loop:
+array(10) {
+ [0]=>
+ string(5) "new.5"
+ [1]=>
+ &string(5) "new.4"
+ [2]=>
+ string(5) "new.3"
+ [3]=>
+ string(5) "new.2"
+ [4]=>
+ string(5) "new.1"
+ [5]=>
+ string(5) "new.0"
+ [6]=>
+ string(3) "v.0"
+ [7]=>
+ string(3) "v.1"
+ [8]=>
+ string(3) "v.2"
+ [9]=>
+ string(3) "v.3"
+}
diff --git a/tests/lang/foreachLoop.014.phpt b/tests/lang/foreachLoop.014.phpt new file mode 100644 index 0000000..ab3c657 --- /dev/null +++ b/tests/lang/foreachLoop.014.phpt @@ -0,0 +1,556 @@ +--TEST--
+Directly modifying a REFERENCED array when foreach'ing over it.
+--FILE--
+<?php
+
+define('MAX_LOOPS',5);
+
+function withRefValue($elements, $transform) {
+ echo "\n---( Array with $elements element(s): )---\n";
+ //Build array:
+ for ($i=0; $i<$elements; $i++) {
+ $a[] = "v.$i";
+ }
+ $counter=0;
+
+ $ref = &$a;
+
+ echo "--> State of referenced array before loop:\n";
+ var_dump($a);
+
+ echo "--> Do loop:\n";
+ foreach ($a as $k=>$v) {
+ echo " iteration $counter: \$k=$k; \$v=$v\n";
+ eval($transform);
+ $counter++;
+ if ($counter>MAX_LOOPS) {
+ echo " ** Stuck in a loop! **\n";
+ break;
+ }
+ }
+
+ echo "--> State of array after loop:\n";
+ var_dump($a);
+}
+
+
+echo "\nPopping elements off end of a referenced array";
+$transform = 'array_pop($a);';
+withRefValue(1, $transform);
+withRefValue(2, $transform);
+withRefValue(3, $transform);
+withRefValue(4, $transform);
+
+echo "\n\n\nShift elements off start of a referenced array";
+$transform = 'array_shift($a);';
+withRefValue(1, $transform);
+withRefValue(2, $transform);
+withRefValue(3, $transform);
+withRefValue(4, $transform);
+
+echo "\n\n\nRemove current element of a referenced array";
+$transform = 'unset($a[$k]);';
+withRefValue(1, $transform);
+withRefValue(2, $transform);
+withRefValue(3, $transform);
+withRefValue(4, $transform);
+
+echo "\n\n\nAdding elements to the end of a referenced array";
+$transform = 'array_push($a, "new.$counter");';
+withRefValue(1, $transform);
+withRefValue(2, $transform);
+withRefValue(3, $transform);
+withRefValue(4, $transform);
+
+echo "\n\n\nAdding elements to the start of a referenced array";
+$transform = 'array_unshift($a, "new.$counter");';
+withRefValue(1, $transform);
+withRefValue(2, $transform);
+withRefValue(3, $transform);
+withRefValue(4, $transform);
+
+?>
+--EXPECTF--
+Popping elements off end of a referenced array
+---( Array with 1 element(s): )---
+--> State of referenced array before loop:
+array(1) {
+ [0]=>
+ string(3) "v.0"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 2 element(s): )---
+--> State of referenced array before loop:
+array(2) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=0; $v=v.0
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 3 element(s): )---
+--> State of referenced array before loop:
+array(3) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+--> State of array after loop:
+array(1) {
+ [0]=>
+ string(3) "v.0"
+}
+
+---( Array with 4 element(s): )---
+--> State of referenced array before loop:
+array(4) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(3) "v.3"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=0; $v=v.0
+ iteration 3: $k=0; $v=v.0
+--> State of array after loop:
+array(0) {
+}
+
+
+
+Shift elements off start of a referenced array
+---( Array with 1 element(s): )---
+--> State of referenced array before loop:
+array(1) {
+ [0]=>
+ string(3) "v.0"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 2 element(s): )---
+--> State of referenced array before loop:
+array(2) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=0; $v=v.1
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 3 element(s): )---
+--> State of referenced array before loop:
+array(3) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=0; $v=v.1
+ iteration 2: $k=0; $v=v.2
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 4 element(s): )---
+--> State of referenced array before loop:
+array(4) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(3) "v.3"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=0; $v=v.1
+ iteration 2: $k=0; $v=v.2
+ iteration 3: $k=0; $v=v.3
+--> State of array after loop:
+array(0) {
+}
+
+
+
+Remove current element of a referenced array
+---( Array with 1 element(s): )---
+--> State of referenced array before loop:
+array(1) {
+ [0]=>
+ string(3) "v.0"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 2 element(s): )---
+--> State of referenced array before loop:
+array(2) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 3 element(s): )---
+--> State of referenced array before loop:
+array(3) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=v.2
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 4 element(s): )---
+--> State of referenced array before loop:
+array(4) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(3) "v.3"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=v.2
+ iteration 3: $k=3; $v=v.3
+--> State of array after loop:
+array(0) {
+}
+
+
+
+Adding elements to the end of a referenced array
+---( Array with 1 element(s): )---
+--> State of referenced array before loop:
+array(1) {
+ [0]=>
+ string(3) "v.0"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+--> State of array after loop:
+array(2) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(5) "new.0"
+}
+
+---( Array with 2 element(s): )---
+--> State of referenced array before loop:
+array(2) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=new.0
+ iteration 3: $k=3; $v=new.1
+ iteration 4: $k=4; $v=new.2
+ iteration 5: $k=5; $v=new.3
+ ** Stuck in a loop! **
+--> State of array after loop:
+array(8) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(5) "new.0"
+ [3]=>
+ string(5) "new.1"
+ [4]=>
+ string(5) "new.2"
+ [5]=>
+ string(5) "new.3"
+ [6]=>
+ string(5) "new.4"
+ [7]=>
+ string(5) "new.5"
+}
+
+---( Array with 3 element(s): )---
+--> State of referenced array before loop:
+array(3) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=v.2
+ iteration 3: $k=3; $v=new.0
+ iteration 4: $k=4; $v=new.1
+ iteration 5: $k=5; $v=new.2
+ ** Stuck in a loop! **
+--> State of array after loop:
+array(9) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(5) "new.0"
+ [4]=>
+ string(5) "new.1"
+ [5]=>
+ string(5) "new.2"
+ [6]=>
+ string(5) "new.3"
+ [7]=>
+ string(5) "new.4"
+ [8]=>
+ string(5) "new.5"
+}
+
+---( Array with 4 element(s): )---
+--> State of referenced array before loop:
+array(4) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(3) "v.3"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=v.2
+ iteration 3: $k=3; $v=v.3
+ iteration 4: $k=4; $v=new.0
+ iteration 5: $k=5; $v=new.1
+ ** Stuck in a loop! **
+--> State of array after loop:
+array(10) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(3) "v.3"
+ [4]=>
+ string(5) "new.0"
+ [5]=>
+ string(5) "new.1"
+ [6]=>
+ string(5) "new.2"
+ [7]=>
+ string(5) "new.3"
+ [8]=>
+ string(5) "new.4"
+ [9]=>
+ string(5) "new.5"
+}
+
+
+
+Adding elements to the start of a referenced array
+---( Array with 1 element(s): )---
+--> State of referenced array before loop:
+array(1) {
+ [0]=>
+ string(3) "v.0"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+--> State of array after loop:
+array(2) {
+ [0]=>
+ string(5) "new.0"
+ [1]=>
+ string(3) "v.0"
+}
+
+---( Array with 2 element(s): )---
+--> State of referenced array before loop:
+array(2) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=0; $v=new.0
+ iteration 2: $k=0; $v=new.1
+ iteration 3: $k=0; $v=new.2
+ iteration 4: $k=0; $v=new.3
+ iteration 5: $k=0; $v=new.4
+ ** Stuck in a loop! **
+--> State of array after loop:
+array(8) {
+ [0]=>
+ string(5) "new.5"
+ [1]=>
+ string(5) "new.4"
+ [2]=>
+ string(5) "new.3"
+ [3]=>
+ string(5) "new.2"
+ [4]=>
+ string(5) "new.1"
+ [5]=>
+ string(5) "new.0"
+ [6]=>
+ string(3) "v.0"
+ [7]=>
+ string(3) "v.1"
+}
+
+---( Array with 3 element(s): )---
+--> State of referenced array before loop:
+array(3) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=0; $v=new.0
+ iteration 2: $k=0; $v=new.1
+ iteration 3: $k=0; $v=new.2
+ iteration 4: $k=0; $v=new.3
+ iteration 5: $k=0; $v=new.4
+ ** Stuck in a loop! **
+--> State of array after loop:
+array(9) {
+ [0]=>
+ string(5) "new.5"
+ [1]=>
+ string(5) "new.4"
+ [2]=>
+ string(5) "new.3"
+ [3]=>
+ string(5) "new.2"
+ [4]=>
+ string(5) "new.1"
+ [5]=>
+ string(5) "new.0"
+ [6]=>
+ string(3) "v.0"
+ [7]=>
+ string(3) "v.1"
+ [8]=>
+ string(3) "v.2"
+}
+
+---( Array with 4 element(s): )---
+--> State of referenced array before loop:
+array(4) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(3) "v.3"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=0; $v=new.0
+ iteration 2: $k=0; $v=new.1
+ iteration 3: $k=0; $v=new.2
+ iteration 4: $k=0; $v=new.3
+ iteration 5: $k=0; $v=new.4
+ ** Stuck in a loop! **
+--> State of array after loop:
+array(10) {
+ [0]=>
+ string(5) "new.5"
+ [1]=>
+ string(5) "new.4"
+ [2]=>
+ string(5) "new.3"
+ [3]=>
+ string(5) "new.2"
+ [4]=>
+ string(5) "new.1"
+ [5]=>
+ string(5) "new.0"
+ [6]=>
+ string(3) "v.0"
+ [7]=>
+ string(3) "v.1"
+ [8]=>
+ string(3) "v.2"
+ [9]=>
+ string(3) "v.3"
+}
\ No newline at end of file diff --git a/tests/lang/foreachLoop.015.phpt b/tests/lang/foreachLoop.015.phpt new file mode 100644 index 0000000..dfba159 --- /dev/null +++ b/tests/lang/foreachLoop.015.phpt @@ -0,0 +1,557 @@ +--TEST--
+Directly modifying a REFERENCED array when foreach'ing over it while using &$value syntax.
+--FILE--
+<?php
+
+define('MAX_LOOPS',5);
+
+function withRefValue($elements, $transform) {
+ echo "\n---( Array with $elements element(s): )---\n";
+ //Build array:
+ for ($i=0; $i<$elements; $i++) {
+ $a[] = "v.$i";
+ }
+ $counter=0;
+
+ $ref = &$a;
+
+ echo "--> State of referenced array before loop:\n";
+ var_dump($a);
+
+ echo "--> Do loop:\n";
+ foreach ($a as $k=>&$v) {
+ echo " iteration $counter: \$k=$k; \$v=$v\n";
+ eval($transform);
+ $counter++;
+ if ($counter>MAX_LOOPS) {
+ echo " ** Stuck in a loop! **\n";
+ break;
+ }
+ }
+
+ echo "--> State of array after loop:\n";
+ var_dump($a);
+}
+
+
+echo "\nPopping elements off end of a referenced array, using &\$value";
+$transform = 'array_pop($a);';
+withRefValue(1, $transform);
+withRefValue(2, $transform);
+withRefValue(3, $transform);
+withRefValue(4, $transform);
+
+echo "\n\n\nShift elements off start of a referenced array, using &\$value";
+$transform = 'array_shift($a);';
+withRefValue(1, $transform);
+withRefValue(2, $transform);
+withRefValue(3, $transform);
+withRefValue(4, $transform);
+
+echo "\n\n\nRemove current element of a referenced array, using &\$value";
+$transform = 'unset($a[$k]);';
+withRefValue(1, $transform);
+withRefValue(2, $transform);
+withRefValue(3, $transform);
+withRefValue(4, $transform);
+
+echo "\n\n\nAdding elements to the end of a referenced array, using &\$value";
+$transform = 'array_push($a, "new.$counter");';
+withRefValue(1, $transform);
+withRefValue(2, $transform);
+withRefValue(3, $transform);
+withRefValue(4, $transform);
+
+echo "\n\n\nAdding elements to the start of a referenced array, using &\$value";
+$transform = 'array_unshift($a, "new.$counter");';
+withRefValue(1, $transform);
+withRefValue(2, $transform);
+withRefValue(3, $transform);
+withRefValue(4, $transform);
+
+?>
+--EXPECTF--
+
+Popping elements off end of a referenced array, using &$value
+---( Array with 1 element(s): )---
+--> State of referenced array before loop:
+array(1) {
+ [0]=>
+ string(3) "v.0"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 2 element(s): )---
+--> State of referenced array before loop:
+array(2) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=0; $v=v.0
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 3 element(s): )---
+--> State of referenced array before loop:
+array(3) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+--> State of array after loop:
+array(1) {
+ [0]=>
+ string(3) "v.0"
+}
+
+---( Array with 4 element(s): )---
+--> State of referenced array before loop:
+array(4) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(3) "v.3"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=0; $v=v.0
+ iteration 3: $k=0; $v=v.0
+--> State of array after loop:
+array(0) {
+}
+
+
+
+Shift elements off start of a referenced array, using &$value
+---( Array with 1 element(s): )---
+--> State of referenced array before loop:
+array(1) {
+ [0]=>
+ string(3) "v.0"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 2 element(s): )---
+--> State of referenced array before loop:
+array(2) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=0; $v=v.1
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 3 element(s): )---
+--> State of referenced array before loop:
+array(3) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=0; $v=v.1
+ iteration 2: $k=0; $v=v.2
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 4 element(s): )---
+--> State of referenced array before loop:
+array(4) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(3) "v.3"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=0; $v=v.1
+ iteration 2: $k=0; $v=v.2
+ iteration 3: $k=0; $v=v.3
+--> State of array after loop:
+array(0) {
+}
+
+
+
+Remove current element of a referenced array, using &$value
+---( Array with 1 element(s): )---
+--> State of referenced array before loop:
+array(1) {
+ [0]=>
+ string(3) "v.0"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 2 element(s): )---
+--> State of referenced array before loop:
+array(2) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 3 element(s): )---
+--> State of referenced array before loop:
+array(3) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=v.2
+--> State of array after loop:
+array(0) {
+}
+
+---( Array with 4 element(s): )---
+--> State of referenced array before loop:
+array(4) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(3) "v.3"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=v.2
+ iteration 3: $k=3; $v=v.3
+--> State of array after loop:
+array(0) {
+}
+
+
+
+Adding elements to the end of a referenced array, using &$value
+---( Array with 1 element(s): )---
+--> State of referenced array before loop:
+array(1) {
+ [0]=>
+ string(3) "v.0"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+--> State of array after loop:
+array(2) {
+ [0]=>
+ &string(3) "v.0"
+ [1]=>
+ string(5) "new.0"
+}
+
+---( Array with 2 element(s): )---
+--> State of referenced array before loop:
+array(2) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=new.0
+ iteration 3: $k=3; $v=new.1
+ iteration 4: $k=4; $v=new.2
+ iteration 5: $k=5; $v=new.3
+ ** Stuck in a loop! **
+--> State of array after loop:
+array(8) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(5) "new.0"
+ [3]=>
+ string(5) "new.1"
+ [4]=>
+ string(5) "new.2"
+ [5]=>
+ &string(5) "new.3"
+ [6]=>
+ string(5) "new.4"
+ [7]=>
+ string(5) "new.5"
+}
+
+---( Array with 3 element(s): )---
+--> State of referenced array before loop:
+array(3) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=v.2
+ iteration 3: $k=3; $v=new.0
+ iteration 4: $k=4; $v=new.1
+ iteration 5: $k=5; $v=new.2
+ ** Stuck in a loop! **
+--> State of array after loop:
+array(9) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(5) "new.0"
+ [4]=>
+ string(5) "new.1"
+ [5]=>
+ &string(5) "new.2"
+ [6]=>
+ string(5) "new.3"
+ [7]=>
+ string(5) "new.4"
+ [8]=>
+ string(5) "new.5"
+}
+
+---( Array with 4 element(s): )---
+--> State of referenced array before loop:
+array(4) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(3) "v.3"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=1; $v=v.1
+ iteration 2: $k=2; $v=v.2
+ iteration 3: $k=3; $v=v.3
+ iteration 4: $k=4; $v=new.0
+ iteration 5: $k=5; $v=new.1
+ ** Stuck in a loop! **
+--> State of array after loop:
+array(10) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(3) "v.3"
+ [4]=>
+ string(5) "new.0"
+ [5]=>
+ &string(5) "new.1"
+ [6]=>
+ string(5) "new.2"
+ [7]=>
+ string(5) "new.3"
+ [8]=>
+ string(5) "new.4"
+ [9]=>
+ string(5) "new.5"
+}
+
+
+
+Adding elements to the start of a referenced array, using &$value
+---( Array with 1 element(s): )---
+--> State of referenced array before loop:
+array(1) {
+ [0]=>
+ string(3) "v.0"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+--> State of array after loop:
+array(2) {
+ [0]=>
+ string(5) "new.0"
+ [1]=>
+ &string(3) "v.0"
+}
+
+---( Array with 2 element(s): )---
+--> State of referenced array before loop:
+array(2) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=0; $v=new.0
+ iteration 2: $k=0; $v=new.1
+ iteration 3: $k=0; $v=new.2
+ iteration 4: $k=0; $v=new.3
+ iteration 5: $k=0; $v=new.4
+ ** Stuck in a loop! **
+--> State of array after loop:
+array(8) {
+ [0]=>
+ string(5) "new.5"
+ [1]=>
+ &string(5) "new.4"
+ [2]=>
+ string(5) "new.3"
+ [3]=>
+ string(5) "new.2"
+ [4]=>
+ string(5) "new.1"
+ [5]=>
+ string(5) "new.0"
+ [6]=>
+ string(3) "v.0"
+ [7]=>
+ string(3) "v.1"
+}
+
+---( Array with 3 element(s): )---
+--> State of referenced array before loop:
+array(3) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=0; $v=new.0
+ iteration 2: $k=0; $v=new.1
+ iteration 3: $k=0; $v=new.2
+ iteration 4: $k=0; $v=new.3
+ iteration 5: $k=0; $v=new.4
+ ** Stuck in a loop! **
+--> State of array after loop:
+array(9) {
+ [0]=>
+ string(5) "new.5"
+ [1]=>
+ &string(5) "new.4"
+ [2]=>
+ string(5) "new.3"
+ [3]=>
+ string(5) "new.2"
+ [4]=>
+ string(5) "new.1"
+ [5]=>
+ string(5) "new.0"
+ [6]=>
+ string(3) "v.0"
+ [7]=>
+ string(3) "v.1"
+ [8]=>
+ string(3) "v.2"
+}
+
+---( Array with 4 element(s): )---
+--> State of referenced array before loop:
+array(4) {
+ [0]=>
+ string(3) "v.0"
+ [1]=>
+ string(3) "v.1"
+ [2]=>
+ string(3) "v.2"
+ [3]=>
+ string(3) "v.3"
+}
+--> Do loop:
+ iteration 0: $k=0; $v=v.0
+ iteration 1: $k=0; $v=new.0
+ iteration 2: $k=0; $v=new.1
+ iteration 3: $k=0; $v=new.2
+ iteration 4: $k=0; $v=new.3
+ iteration 5: $k=0; $v=new.4
+ ** Stuck in a loop! **
+--> State of array after loop:
+array(10) {
+ [0]=>
+ string(5) "new.5"
+ [1]=>
+ &string(5) "new.4"
+ [2]=>
+ string(5) "new.3"
+ [3]=>
+ string(5) "new.2"
+ [4]=>
+ string(5) "new.1"
+ [5]=>
+ string(5) "new.0"
+ [6]=>
+ string(3) "v.0"
+ [7]=>
+ string(3) "v.1"
+ [8]=>
+ string(3) "v.2"
+ [9]=>
+ string(3) "v.3"
+}
diff --git a/tests/lang/foreachLoop.016.phpt b/tests/lang/foreachLoop.016.phpt new file mode 100644 index 0000000..d570aba --- /dev/null +++ b/tests/lang/foreachLoop.016.phpt @@ -0,0 +1,206 @@ +--TEST--
+Ensure foreach splits the iterated entity from its cow reference set, for all sorts of iterated entities.
+--FILE--
+<?php
+ error_reporting(E_ALL & ~E_STRICT);
+
+ echo "\n" . '$a' . "\n";
+ $b = $a = array('original');
+ foreach($a as $k=>&$v) {
+ $v = 'changed';
+ }
+ var_dump($b);
+ unset($a, $b);
+
+ echo "\n" . '${\'a\'}' . "\n";
+ $b = $a = array('original');
+ foreach(${'a'} as $k=>&$v) {
+ $v = 'changed';
+ }
+ var_dump($b);
+ unset($a, $b);
+
+ echo "\n" . '$$a' . "\n";
+ $a = 'blah';
+ $$a = array('original');
+ $b = $$a;
+ foreach($$a as $k=>&$v) {
+ $v = 'changed';
+ }
+ var_dump($b);
+ unset($a, $b);
+
+ echo "\n" . '$a[0]' . "\n";
+ $b = $a[0] = array('original');
+ foreach($a[0] as $k=>&$v) {
+ $v = 'changed';
+ }
+ var_dump($b);
+ unset($a, $b);
+
+ echo "\n" . '$a[0][0]' . "\n";
+ $b = $a[0][0] = array('original');
+ foreach($a[0][0] as $k=>&$v) {
+ $v = 'changed';
+ }
+ var_dump($b);
+ unset($a, $b);
+
+ echo "\n" . '$a->b' . "\n";
+ $b = $a->b = array('original');
+ foreach($a->b as $k=>&$v) {
+ $v = 'changed';
+ }
+ var_dump($b);
+ unset($a, $b);
+
+ echo "\n" . '$a->b->c' . "\n";
+ $b = $a->b->c = array('original');
+ foreach($a->b as $k=>&$v) {
+ $v = 'changed';
+ }
+ var_dump($b);
+ unset($a, $b);
+
+ echo "\n" . '$a->b[0]' . "\n";
+ $b = $a->b[0] = array('original');
+ foreach($a->b[0] as $k=>&$v) {
+ $v = 'changed';
+ }
+ var_dump($b);
+ unset($a, $b);
+
+ echo "\n" . '$a->b[0][0]' . "\n";
+ $b = $a->b[0][0] = array('original');
+ foreach($a->b[0][0] as $k=>&$v) {
+ $v = 'changed';
+ }
+ var_dump($b);
+ unset($a, $b);
+
+ echo "\n" . '$a->b[0]->c' . "\n";
+ $b = $a->b[0]->c = array('original');
+ foreach($a->b[0]->c as $k=>&$v) {
+ $v = 'changed';
+ }
+ var_dump($b);
+ unset($a, $b);
+
+ class C {
+ public static $a;
+ }
+
+ echo "\n" . 'C::$a' . "\n";
+ C::$a = array('original');
+ $b = C::$a;
+ foreach(C::$a as $k=>&$v) {
+ $v = 'changed';
+ }
+ var_dump($b);
+ unset($a, $b);
+
+ echo "\n" . 'C::$a[0]' . "\n";
+ C::$a[0] = array('original');
+ $b = C::$a[0];
+ foreach(C::$a[0] as $k=>&$v) {
+ $v = 'changed';
+ }
+ var_dump($b);
+ unset(C::$a[0], $b);
+
+ echo "\n" . 'C::$a[0]->b' . "\n";
+ C::$a[0]->b = array('original');
+ $b = C::$a[0]->b;
+ foreach(C::$a[0]->b as $k=>&$v) {
+ $v = 'changed';
+ }
+ var_dump($b);
+ unset(C::$a[0]->b, $b);
+?>
+--EXPECTF--
+
+$a
+array(1) {
+ [0]=>
+ string(8) "original"
+}
+
+${'a'}
+array(1) {
+ [0]=>
+ string(8) "original"
+}
+
+$$a
+array(1) {
+ [0]=>
+ string(8) "original"
+}
+
+$a[0]
+array(1) {
+ [0]=>
+ string(8) "original"
+}
+
+$a[0][0]
+array(1) {
+ [0]=>
+ string(8) "original"
+}
+
+$a->b
+
+Warning: Creating default object from empty value in %s on line %d
+array(1) {
+ [0]=>
+ string(8) "original"
+}
+
+$a->b->c
+
+Warning: Creating default object from empty value in %s on line %d
+array(1) {
+ [0]=>
+ string(8) "original"
+}
+
+$a->b[0]
+array(1) {
+ [0]=>
+ string(8) "original"
+}
+
+$a->b[0][0]
+array(1) {
+ [0]=>
+ string(8) "original"
+}
+
+$a->b[0]->c
+
+Warning: Creating default object from empty value in %s on line %d
+array(1) {
+ [0]=>
+ string(8) "original"
+}
+
+C::$a
+array(1) {
+ [0]=>
+ string(8) "original"
+}
+
+C::$a[0]
+array(1) {
+ [0]=>
+ string(8) "original"
+}
+
+C::$a[0]->b
+
+Warning: Creating default object from empty value in %s on line %d
+array(1) {
+ [0]=>
+ string(8) "original"
+}
diff --git a/tests/lang/foreachLoop.017.phpt b/tests/lang/foreachLoop.017.phpt new file mode 100644 index 0000000..3d2618e --- /dev/null +++ b/tests/lang/foreachLoop.017.phpt @@ -0,0 +1,11 @@ +--TEST--
+Ensure foreach works with arrays with Binary keys.
+--FILE--
+<?php
+$a = array ( "\x90" => 10 );
+foreach ($a as $val=>$key) echo $key;
+echo "\nDone\n";
+?>
+--EXPECTF--
+10
+Done
\ No newline at end of file diff --git a/tests/lang/foreachLoopIterator.001.phpt b/tests/lang/foreachLoopIterator.001.phpt new file mode 100644 index 0000000..c049cb7 --- /dev/null +++ b/tests/lang/foreachLoopIterator.001.phpt @@ -0,0 +1,134 @@ +--TEST-- +foreach with Iterator. +--FILE-- +<?php + +class MealIterator implements Iterator { + private $pos=0; + private $myContent=array("breakfast", "lunch", "dinner"); + + public function valid() { + global $indent; + echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; + return $this->pos<3; + } + + public function next() { + global $indent; + echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; + return $this->myContent[$this->pos++]; + } + + public function rewind() { + global $indent; + echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; + $this->pos=0; + } + + public function current() { + global $indent; + echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; + return $this->myContent[$this->pos]; + } + + public function key() { + global $indent; + echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; + return "meal " . $this->pos; + } + +} + +$f = new MealIterator; +var_dump($f); + +echo "-----( Simple iteration: )-----\n"; +foreach ($f as $k=>$v) { + echo "$k => $v\n"; +} + +$f->rewind(); + +$indent = " "; + +echo "\n\n\n-----( Nested iteration: )-----\n"; +$count=1; +foreach ($f as $k=>$v) { + echo "\nTop level " . $count++ . ": \n"; + echo "$k => $v\n"; + $indent = " "; + foreach ($f as $k=>$v) { + echo " $k => $v\n"; + } + $indent = " "; + +} + +?> +===DONE=== +--EXPECTF-- +object(MealIterator)#%d (2) { + ["pos":"MealIterator":private]=> + int(0) + ["myContent":"MealIterator":private]=> + array(3) { + [0]=> + string(9) "breakfast" + [1]=> + string(5) "lunch" + [2]=> + string(6) "dinner" + } +} +-----( Simple iteration: )----- +--> MealIterator::rewind (0) +--> MealIterator::valid (0) +--> MealIterator::current (0) +--> MealIterator::key (0) +meal 0 => breakfast +--> MealIterator::next (0) +--> MealIterator::valid (1) +--> MealIterator::current (1) +--> MealIterator::key (1) +meal 1 => lunch +--> MealIterator::next (1) +--> MealIterator::valid (2) +--> MealIterator::current (2) +--> MealIterator::key (2) +meal 2 => dinner +--> MealIterator::next (2) +--> MealIterator::valid (3) +--> MealIterator::rewind (3) + + + +-----( Nested iteration: )----- + --> MealIterator::rewind (0) + --> MealIterator::valid (0) + --> MealIterator::current (0) + --> MealIterator::key (0) + +Top level 1: +meal 0 => breakfast + --> MealIterator::rewind (0) + --> MealIterator::valid (0) + --> MealIterator::current (0) + --> MealIterator::key (0) + meal 0 => breakfast + --> MealIterator::next (0) + --> MealIterator::valid (1) + --> MealIterator::current (1) + --> MealIterator::key (1) + meal 1 => lunch + --> MealIterator::next (1) + --> MealIterator::valid (2) + --> MealIterator::current (2) + --> MealIterator::key (2) + meal 2 => dinner + --> MealIterator::next (2) + --> MealIterator::valid (3) + --> MealIterator::next (3) + +Notice: Undefined offset: 3 in %s on line %d + --> MealIterator::valid (4) +===DONE===
\ No newline at end of file diff --git a/tests/lang/foreachLoopIterator.002.phpt b/tests/lang/foreachLoopIterator.002.phpt new file mode 100644 index 0000000..f40e09b --- /dev/null +++ b/tests/lang/foreachLoopIterator.002.phpt @@ -0,0 +1,24 @@ +--TEST-- +foreach with iterator and &$value reference +--FILE-- +<?php + +class MyIterator implements Iterator { + public function valid() { return true; } + public function next() { } + public function rewind() { } + public function current() { } + public function key() { } +} + +$f = new MyIterator; +echo "-----( Try to iterate with &\$value: )-----\n"; +foreach ($f as $k=>&$v) { + echo "$k => $v\n"; +} + +?> +--EXPECTF-- +-----( Try to iterate with &$value: )----- + +Fatal error: An iterator cannot be used with foreach by reference in %s on line 13
\ No newline at end of file diff --git a/tests/lang/foreachLoopIteratorAggregate.001.phpt b/tests/lang/foreachLoopIteratorAggregate.001.phpt new file mode 100644 index 0000000..b20d3ea --- /dev/null +++ b/tests/lang/foreachLoopIteratorAggregate.001.phpt @@ -0,0 +1,270 @@ +--TEST-- +foreach with iteratorAggregate +--FILE-- +<?php +class EnglishMealIterator implements Iterator { + private $pos=0; + private $myContent=array("breakfast", "dinner", "tea"); + + public function valid() { + global $indent; + echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; + return $this->pos < count($this->myContent); + } + + public function next() { + global $indent; + echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; + $this->pos++; + } + + public function rewind() { + global $indent; + echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; + $this->pos=0; + } + + public function current() { + global $indent; + echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; + return $this->myContent[$this->pos]; + } + + public function key() { + global $indent; + echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; + return "meal " . $this->pos; + } + +} + +class FrenchMealIterator implements Iterator { + private $pos=0; + private $myContent=array("petit dejeuner", "dejeuner", "gouter", "dinner"); + + public function valid() { + global $indent; + echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; + return $this->pos < count($this->myContent); + } + + public function next() { + global $indent; + echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; + $this->pos++; + } + + public function rewind() { + global $indent; + echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; + $this->pos=0; + } + + public function current() { + global $indent; + echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; + return $this->myContent[$this->pos]; + } + + public function key() { + global $indent; + echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; + return "meal " . $this->pos; + } + +} + + +Class EuropeanMeals implements IteratorAggregate { + + private $storedEnglishMealIterator; + private $storedFrenchMealIterator; + + public function __construct() { + $this->storedEnglishMealIterator = new EnglishMealIterator; + $this->storedFrenchMealIterator = new FrenchMealIterator; + } + + public function getIterator() { + global $indent; + echo "$indent--> " . __METHOD__ . "\n"; + + //Alternate between English and French meals + static $i = 0; + if ($i++%2 == 0) { + return $this->storedEnglishMealIterator; + } else { + return $this->storedFrenchMealIterator; + } + } + +} + +$f = new EuropeanMeals; +var_dump($f); + +echo "-----( Simple iteration 1: )-----\n"; +foreach ($f as $k=>$v) { + echo "$k => $v\n"; +} +echo "-----( Simple iteration 2: )-----\n"; +foreach ($f as $k=>$v) { + echo "$k => $v\n"; +} + + +$indent = " "; +echo "\n\n\n-----( Nested iteration: )-----\n"; +$count=1; +foreach ($f as $k=>$v) { + echo "\nTop level " . $count++ . ": \n"; + echo "$k => $v\n"; + $indent = " "; + foreach ($f as $k=>$v) { + echo " $k => $v\n"; + } + $indent = " "; +} + + +?> +===DONE=== +--EXPECTF-- +object(EuropeanMeals)#%d (2) { + ["storedEnglishMealIterator":"EuropeanMeals":private]=> + object(EnglishMealIterator)#%d (2) { + ["pos":"EnglishMealIterator":private]=> + int(0) + ["myContent":"EnglishMealIterator":private]=> + array(3) { + [0]=> + string(9) "breakfast" + [1]=> + string(6) "dinner" + [2]=> + string(3) "tea" + } + } + ["storedFrenchMealIterator":"EuropeanMeals":private]=> + object(FrenchMealIterator)#%d (2) { + ["pos":"FrenchMealIterator":private]=> + int(0) + ["myContent":"FrenchMealIterator":private]=> + array(4) { + [0]=> + string(14) "petit dejeuner" + [1]=> + string(8) "dejeuner" + [2]=> + string(6) "gouter" + [3]=> + string(6) "dinner" + } + } +} +-----( Simple iteration 1: )----- +--> EuropeanMeals::getIterator +--> EnglishMealIterator::rewind (0) +--> EnglishMealIterator::valid (0) +--> EnglishMealIterator::current (0) +--> EnglishMealIterator::key (0) +meal 0 => breakfast +--> EnglishMealIterator::next (0) +--> EnglishMealIterator::valid (1) +--> EnglishMealIterator::current (1) +--> EnglishMealIterator::key (1) +meal 1 => dinner +--> EnglishMealIterator::next (1) +--> EnglishMealIterator::valid (2) +--> EnglishMealIterator::current (2) +--> EnglishMealIterator::key (2) +meal 2 => tea +--> EnglishMealIterator::next (2) +--> EnglishMealIterator::valid (3) +-----( Simple iteration 2: )----- +--> EuropeanMeals::getIterator +--> FrenchMealIterator::rewind (0) +--> FrenchMealIterator::valid (0) +--> FrenchMealIterator::current (0) +--> FrenchMealIterator::key (0) +meal 0 => petit dejeuner +--> FrenchMealIterator::next (0) +--> FrenchMealIterator::valid (1) +--> FrenchMealIterator::current (1) +--> FrenchMealIterator::key (1) +meal 1 => dejeuner +--> FrenchMealIterator::next (1) +--> FrenchMealIterator::valid (2) +--> FrenchMealIterator::current (2) +--> FrenchMealIterator::key (2) +meal 2 => gouter +--> FrenchMealIterator::next (2) +--> FrenchMealIterator::valid (3) +--> FrenchMealIterator::current (3) +--> FrenchMealIterator::key (3) +meal 3 => dinner +--> FrenchMealIterator::next (3) +--> FrenchMealIterator::valid (4) + + + +-----( Nested iteration: )----- + --> EuropeanMeals::getIterator + --> EnglishMealIterator::rewind (3) + --> EnglishMealIterator::valid (0) + --> EnglishMealIterator::current (0) + --> EnglishMealIterator::key (0) + +Top level 1: +meal 0 => breakfast + --> EuropeanMeals::getIterator + --> FrenchMealIterator::rewind (4) + --> FrenchMealIterator::valid (0) + --> FrenchMealIterator::current (0) + --> FrenchMealIterator::key (0) + meal 0 => petit dejeuner + --> FrenchMealIterator::next (0) + --> FrenchMealIterator::valid (1) + --> FrenchMealIterator::current (1) + --> FrenchMealIterator::key (1) + meal 1 => dejeuner + --> FrenchMealIterator::next (1) + --> FrenchMealIterator::valid (2) + --> FrenchMealIterator::current (2) + --> FrenchMealIterator::key (2) + meal 2 => gouter + --> FrenchMealIterator::next (2) + --> FrenchMealIterator::valid (3) + --> FrenchMealIterator::current (3) + --> FrenchMealIterator::key (3) + meal 3 => dinner + --> FrenchMealIterator::next (3) + --> FrenchMealIterator::valid (4) + --> EnglishMealIterator::next (0) + --> EnglishMealIterator::valid (1) + --> EnglishMealIterator::current (1) + --> EnglishMealIterator::key (1) + +Top level 2: +meal 1 => dinner + --> EuropeanMeals::getIterator + --> EnglishMealIterator::rewind (1) + --> EnglishMealIterator::valid (0) + --> EnglishMealIterator::current (0) + --> EnglishMealIterator::key (0) + meal 0 => breakfast + --> EnglishMealIterator::next (0) + --> EnglishMealIterator::valid (1) + --> EnglishMealIterator::current (1) + --> EnglishMealIterator::key (1) + meal 1 => dinner + --> EnglishMealIterator::next (1) + --> EnglishMealIterator::valid (2) + --> EnglishMealIterator::current (2) + --> EnglishMealIterator::key (2) + meal 2 => tea + --> EnglishMealIterator::next (2) + --> EnglishMealIterator::valid (3) + --> EnglishMealIterator::next (3) + --> EnglishMealIterator::valid (4) +===DONE===
\ No newline at end of file diff --git a/tests/lang/foreachLoopIteratorAggregate.002.phpt b/tests/lang/foreachLoopIteratorAggregate.002.phpt new file mode 100644 index 0000000..eef4302 --- /dev/null +++ b/tests/lang/foreachLoopIteratorAggregate.002.phpt @@ -0,0 +1,53 @@ +--TEST-- +IteratorAggregate::getIterator bad return type +--FILE-- +<?php + +class bad1 implements IteratorAggregate { + function getIterator() { + return null; + } +} + +class bad2 implements IteratorAggregate { + function getIterator() { + return new stdClass; + } +} + +class bad3 implements IteratorAggregate { + function getIterator() { + return 1; + } +} + +class bad4 implements IteratorAggregate { + function getIterator() { + return array(1,2,3); + } +} + + +function f($className) { + try { + foreach (new $className as $k=>$v) { + echo "$k => $v\n"; + } + } catch (Exception $e) { + echo $e->getLine() . ": " . $e->getMessage() ."\n"; + } +} + +f("bad1"); +f("bad2"); +f("bad3"); +f("bad4"); + +?> +===DONE=== +--EXPECTF-- +30: Objects returned by bad1::getIterator() must be traversable or implement interface Iterator +30: Objects returned by bad2::getIterator() must be traversable or implement interface Iterator +30: Objects returned by bad3::getIterator() must be traversable or implement interface Iterator +30: Objects returned by bad4::getIterator() must be traversable or implement interface Iterator +===DONE===
\ No newline at end of file diff --git a/tests/lang/foreachLoopIteratorAggregate.003.phpt b/tests/lang/foreachLoopIteratorAggregate.003.phpt new file mode 100644 index 0000000..0a0e23c --- /dev/null +++ b/tests/lang/foreachLoopIteratorAggregate.003.phpt @@ -0,0 +1,133 @@ +--TEST-- +foreach with nested iteratorAggregates +--FILE-- +<?php +class EnglishMealIterator implements Iterator { + private $pos=0; + private $myContent=array("breakfast", "dinner", "tea"); + + public function valid() { + global $indent; + echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; + return $this->pos<3; + } + + public function next() { + global $indent; + echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; + return $this->myContent[$this->pos++]; + } + + public function rewind() { + global $indent; + echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; + $this->pos=0; + } + + public function current() { + global $indent; + echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; + return $this->myContent[$this->pos]; + } + + public function key() { + global $indent; + echo "$indent--> " . __METHOD__ . " ($this->pos)\n"; + return "meal " . $this->pos; + } + +} + +class A1 implements IteratorAggregate { + function getIterator() { + return new EnglishMealIterator; + } +} + +class A2 implements IteratorAggregate { + function getIterator() { + return new A1; + } +} + +class A3 implements IteratorAggregate { + function getIterator() { + return new A2; + } +} + +echo "\n-----( A1: )-----\n"; +foreach (new A1 as $k=>$v) { + echo "$k => $v\n"; +} + +echo "\n-----( A2: )-----\n"; +foreach (new A2 as $k=>$v) { + echo "$k => $v\n"; +} + +echo "\n-----( A3: )-----\n"; +foreach (new A3 as $k=>$v) { + echo "$k => $v\n"; +} + +?> +===DONE=== +--EXPECTF-- +-----( A1: )----- +--> EnglishMealIterator::rewind (0) +--> EnglishMealIterator::valid (0) +--> EnglishMealIterator::current (0) +--> EnglishMealIterator::key (0) +meal 0 => breakfast +--> EnglishMealIterator::next (0) +--> EnglishMealIterator::valid (1) +--> EnglishMealIterator::current (1) +--> EnglishMealIterator::key (1) +meal 1 => dinner +--> EnglishMealIterator::next (1) +--> EnglishMealIterator::valid (2) +--> EnglishMealIterator::current (2) +--> EnglishMealIterator::key (2) +meal 2 => tea +--> EnglishMealIterator::next (2) +--> EnglishMealIterator::valid (3) + +-----( A2: )----- +--> EnglishMealIterator::rewind (0) +--> EnglishMealIterator::valid (0) +--> EnglishMealIterator::current (0) +--> EnglishMealIterator::key (0) +meal 0 => breakfast +--> EnglishMealIterator::next (0) +--> EnglishMealIterator::valid (1) +--> EnglishMealIterator::current (1) +--> EnglishMealIterator::key (1) +meal 1 => dinner +--> EnglishMealIterator::next (1) +--> EnglishMealIterator::valid (2) +--> EnglishMealIterator::current (2) +--> EnglishMealIterator::key (2) +meal 2 => tea +--> EnglishMealIterator::next (2) +--> EnglishMealIterator::valid (3) + +-----( A3: )----- +--> EnglishMealIterator::rewind (0) +--> EnglishMealIterator::valid (0) +--> EnglishMealIterator::current (0) +--> EnglishMealIterator::key (0) +meal 0 => breakfast +--> EnglishMealIterator::next (0) +--> EnglishMealIterator::valid (1) +--> EnglishMealIterator::current (1) +--> EnglishMealIterator::key (1) +meal 1 => dinner +--> EnglishMealIterator::next (1) +--> EnglishMealIterator::valid (2) +--> EnglishMealIterator::current (2) +--> EnglishMealIterator::key (2) +meal 2 => tea +--> EnglishMealIterator::next (2) +--> EnglishMealIterator::valid (3) +===DONE=== diff --git a/tests/lang/foreachLoopIteratorAggregate.004.phpt b/tests/lang/foreachLoopIteratorAggregate.004.phpt new file mode 100644 index 0000000..9a1e612 --- /dev/null +++ b/tests/lang/foreachLoopIteratorAggregate.004.phpt @@ -0,0 +1,104 @@ +--TEST-- +Duplicate of zend test tests/classes/iterators_002.phpt without expected output from destructor +--FILE-- +<?php +class c_iter implements Iterator { + + private $obj; + private $num = 0; + + function __construct($obj) { + echo __METHOD__ . "\n"; + $this->obj = $obj; + } + function rewind() { + echo __METHOD__ . "\n"; + $this->num = 0; + } + function valid() { + $more = $this->num < $this->obj->max; + echo __METHOD__ . ' = ' .($more ? 'true' : 'false') . "\n"; + return $more; + } + function current() { + echo __METHOD__ . "\n"; + return $this->num; + } + function next() { + echo __METHOD__ . "\n"; + $this->num++; + } + function key() { + echo __METHOD__ . "\n"; + switch($this->num) { + case 0: return "1st"; + case 1: return "2nd"; + case 2: return "3rd"; + default: return "???"; + } + } + function __destruct() { + } +} + +class c implements IteratorAggregate { + + public $max = 3; + + function getIterator() { + echo __METHOD__ . "\n"; + return new c_iter($this); + } + function __destruct() { + } +} + +$t = new c(); + +foreach($t as $k => $v) { + foreach($t as $w) { + echo "double:$v:$w\n"; + break; + } +} + +unset($t); + +?> +===DONE=== +--EXPECT-- +c::getIterator +c_iter::__construct +c_iter::rewind +c_iter::valid = true +c_iter::current +c_iter::key +c::getIterator +c_iter::__construct +c_iter::rewind +c_iter::valid = true +c_iter::current +double:0:0 +c_iter::next +c_iter::valid = true +c_iter::current +c_iter::key +c::getIterator +c_iter::__construct +c_iter::rewind +c_iter::valid = true +c_iter::current +double:1:0 +c_iter::next +c_iter::valid = true +c_iter::current +c_iter::key +c::getIterator +c_iter::__construct +c_iter::rewind +c_iter::valid = true +c_iter::current +double:2:0 +c_iter::next +c_iter::valid = false +===DONE=== diff --git a/tests/lang/foreachLoopObjects.001.phpt b/tests/lang/foreachLoopObjects.001.phpt new file mode 100644 index 0000000..e6047b7 --- /dev/null +++ b/tests/lang/foreachLoopObjects.001.phpt @@ -0,0 +1,69 @@ +--TEST-- +Foreach loop on objects - basic loop with just value and key => value. +--FILE-- +<?php + +class C { + public $a = "Original a"; + public $b = "Original b"; + public $c = "Original c"; + protected $d = "Original d"; + private $e = "Original e"; + +} + +echo "\n\nSimple loop.\n"; +$obj = new C; +foreach ($obj as $v) { + var_dump($v); +} +foreach ($obj as $k => $v) { + var_dump($k, $v); +} +echo "\nCheck key and value after the loop.\n"; +var_dump($k, $v); + + +echo "\n\nObject instantiated inside loop.\n"; +foreach (new C as $v) { + var_dump($v); +} +foreach (new C as $k => $v) { + var_dump($k, $v); +} +echo "\nCheck key and value after the loop.\n"; +var_dump($k, $v); +?> +--EXPECTF-- + + +Simple loop. +string(10) "Original a" +string(10) "Original b" +string(10) "Original c" +string(1) "a" +string(10) "Original a" +string(1) "b" +string(10) "Original b" +string(1) "c" +string(10) "Original c" + +Check key and value after the loop. +string(1) "c" +string(10) "Original c" + + +Object instantiated inside loop. +string(10) "Original a" +string(10) "Original b" +string(10) "Original c" +string(1) "a" +string(10) "Original a" +string(1) "b" +string(10) "Original b" +string(1) "c" +string(10) "Original c" + +Check key and value after the loop. +string(1) "c" +string(10) "Original c"
\ No newline at end of file diff --git a/tests/lang/foreachLoopObjects.002.phpt b/tests/lang/foreachLoopObjects.002.phpt new file mode 100644 index 0000000..0b06f2b --- /dev/null +++ b/tests/lang/foreachLoopObjects.002.phpt @@ -0,0 +1,587 @@ +--TEST-- +Foreach loop tests - visibility. +--FILE-- +<?php + +class C { + public $a = "Original a"; + public $b = "Original b"; + public $c = "Original c"; + protected $d = "Original d"; + private $e = "Original e"; + + function doForEachC() { + echo "in C::doForEachC\n"; + foreach ($this as $k=>&$v) { + var_dump($v); + $v="changed.$k"; + } + } + + static function doForEach($obj) { + echo "in C::doForEach\n"; + foreach ($obj as $k=>&$v) { + var_dump($v); + $v="changed.$k"; + } + } + + function doForEachOnThis() { + echo "in C::doForEachOnThis\n"; + foreach ($this as $k=>&$v) { + var_dump($v); + $v="changed.$k"; + } + } + +} + +class D extends C { + + private $f = "Original f"; + protected $g = "Original g"; + + static function doForEach($obj) { + echo "in D::doForEach\n"; + foreach ($obj as $k=>&$v) { + var_dump($v); + $v="changed.$k"; + } + } + + function doForEachOnThis() { + echo "in D::doForEachOnThis\n"; + foreach ($this as $k=>&$v) { + var_dump($v); + $v="changed.$k"; + } + } +} + +class E extends D { + public $a = "Overridden a"; + public $b = "Overridden b"; + public $c = "Overridden c"; + protected $d = "Overridden d"; + private $e = "Overridden e"; + + static function doForEach($obj) { + echo "in E::doForEach\n"; + foreach ($obj as $k=>&$v) { + var_dump($v); + $v="changed.$k"; + } + } + + function doForEachOnThis() { + echo "in E::doForEachOnThis\n"; + foreach ($this as $k=>&$v) { + var_dump($v); + $v="changed.$k"; + } + } +} + +echo "\n\nIterate over various generations from within overridden methods:\n"; +echo "\n--> Using instance of C:\n"; +$myC = new C; +$myC->doForEachOnThis(); +var_dump($myC); +echo "\n--> Using instance of D:\n"; +$myD = new D; +$myD->doForEachOnThis(); +var_dump($myD); +echo "\n--> Using instance of E:\n"; +$myE = new E; +$myE->doForEachOnThis(); +var_dump($myE); + +echo "\n\nIterate over various generations from within an inherited method:\n"; +echo "\n--> Using instance of C:\n"; +$myC = new C; +$myC->doForEachC(); +var_dump($myC); +echo "\n--> Using instance of D:\n"; +$myD = new D; +$myD->doForEachC(); +var_dump($myD); +echo "\n--> Using instance of E:\n"; +$myE = new E; +$myE->doForEachC(); +var_dump($myE); + +echo "\n\nIterate over various generations from within an overridden static method:\n"; +echo "\n--> Using instance of C:\n"; +$myC = new C; +C::doForEach($myC); +var_dump($myC); +$myC = new C; +D::doForEach($myC); +var_dump($myC); +$myC = new C; +E::doForEach($myC); +var_dump($myC); +echo "\n--> Using instance of D:\n"; +$myD = new D; +C::doForEach($myD); +var_dump($myD); +$myD = new D; +D::doForEach($myD); +var_dump($myD); +$myD = new D; +E::doForEach($myD); +var_dump($myD); +echo "\n--> Using instance of E:\n"; +$myE = new E; +C::doForEach($myE); +var_dump($myE); +$myE = new E; +D::doForEach($myE); +var_dump($myE); +$myE = new E; +E::doForEach($myE); +var_dump($myE); + + +echo "\n\nIterate over various generations from outside the object:\n"; +echo "\n--> Using instance of C:\n"; +$myC = new C; +foreach ($myC as $k=>&$v) { + var_dump($v); + $v="changed.$k"; +} +var_dump($myC); +echo "\n--> Using instance of D:\n"; +$myD = new D; +foreach ($myD as $k=>&$v) { + var_dump($v); + $v="changed.$k"; +} +var_dump($myD); +echo "\n--> Using instance of E:\n"; +$myE = new E; +foreach ($myE as $k=>&$v) { + var_dump($v); + $v="changed.$k"; +} +var_dump($myE); +?> +===DONE=== +--EXPECTF-- +Iterate over various generations from within overridden methods: + +--> Using instance of C: +in C::doForEachOnThis +string(10) "Original a" +string(10) "Original b" +string(10) "Original c" +string(10) "Original d" +string(10) "Original e" +object(C)#%d (5) { + ["a"]=> + string(9) "changed.a" + ["b"]=> + string(9) "changed.b" + ["c"]=> + string(9) "changed.c" + ["d":protected]=> + string(9) "changed.d" + ["e":"C":private]=> + string(9) "changed.e" +} + +--> Using instance of D: +in D::doForEachOnThis +string(10) "Original f" +string(10) "Original g" +string(10) "Original a" +string(10) "Original b" +string(10) "Original c" +string(10) "Original d" +object(D)#%d (7) { + ["f":"D":private]=> + string(9) "changed.f" + ["g":protected]=> + string(9) "changed.g" + ["a"]=> + string(9) "changed.a" + ["b"]=> + string(9) "changed.b" + ["c"]=> + string(9) "changed.c" + ["d":protected]=> + string(9) "changed.d" + ["e":"C":private]=> + string(10) "Original e" +} + +--> Using instance of E: +in E::doForEachOnThis +string(12) "Overridden a" +string(12) "Overridden b" +string(12) "Overridden c" +string(12) "Overridden d" +string(12) "Overridden e" +string(10) "Original g" +object(E)#%d (8) { + ["a"]=> + string(9) "changed.a" + ["b"]=> + string(9) "changed.b" + ["c"]=> + string(9) "changed.c" + ["d":protected]=> + string(9) "changed.d" + ["e":"E":private]=> + string(9) "changed.e" + ["f":"D":private]=> + string(10) "Original f" + ["g":protected]=> + string(9) "changed.g" + ["e":"C":private]=> + string(10) "Original e" +} + + +Iterate over various generations from within an inherited method: + +--> Using instance of C: +in C::doForEachC +string(10) "Original a" +string(10) "Original b" +string(10) "Original c" +string(10) "Original d" +string(10) "Original e" +object(C)#%d (5) { + ["a"]=> + string(9) "changed.a" + ["b"]=> + string(9) "changed.b" + ["c"]=> + string(9) "changed.c" + ["d":protected]=> + string(9) "changed.d" + ["e":"C":private]=> + string(9) "changed.e" +} + +--> Using instance of D: +in C::doForEachC +string(10) "Original g" +string(10) "Original a" +string(10) "Original b" +string(10) "Original c" +string(10) "Original d" +string(10) "Original e" +object(D)#%d (7) { + ["f":"D":private]=> + string(10) "Original f" + ["g":protected]=> + string(9) "changed.g" + ["a"]=> + string(9) "changed.a" + ["b"]=> + string(9) "changed.b" + ["c"]=> + string(9) "changed.c" + ["d":protected]=> + string(9) "changed.d" + ["e":"C":private]=> + string(9) "changed.e" +} + +--> Using instance of E: +in C::doForEachC +string(12) "Overridden a" +string(12) "Overridden b" +string(12) "Overridden c" +string(12) "Overridden d" +string(10) "Original g" +string(10) "Original e" +object(E)#%d (8) { + ["a"]=> + string(9) "changed.a" + ["b"]=> + string(9) "changed.b" + ["c"]=> + string(9) "changed.c" + ["d":protected]=> + string(9) "changed.d" + ["e":"E":private]=> + string(12) "Overridden e" + ["f":"D":private]=> + string(10) "Original f" + ["g":protected]=> + string(9) "changed.g" + ["e":"C":private]=> + string(9) "changed.e" +} + + +Iterate over various generations from within an overridden static method: + +--> Using instance of C: +in C::doForEach +string(10) "Original a" +string(10) "Original b" +string(10) "Original c" +string(10) "Original d" +string(10) "Original e" +object(C)#%d (5) { + ["a"]=> + string(9) "changed.a" + ["b"]=> + string(9) "changed.b" + ["c"]=> + string(9) "changed.c" + ["d":protected]=> + string(9) "changed.d" + ["e":"C":private]=> + string(9) "changed.e" +} +in D::doForEach +string(10) "Original a" +string(10) "Original b" +string(10) "Original c" +string(10) "Original d" +object(C)#%d (5) { + ["a"]=> + string(9) "changed.a" + ["b"]=> + string(9) "changed.b" + ["c"]=> + string(9) "changed.c" + ["d":protected]=> + string(9) "changed.d" + ["e":"C":private]=> + string(10) "Original e" +} +in E::doForEach +string(10) "Original a" +string(10) "Original b" +string(10) "Original c" +string(10) "Original d" +object(C)#%d (5) { + ["a"]=> + string(9) "changed.a" + ["b"]=> + string(9) "changed.b" + ["c"]=> + string(9) "changed.c" + ["d":protected]=> + string(9) "changed.d" + ["e":"C":private]=> + string(10) "Original e" +} + +--> Using instance of D: +in C::doForEach +string(10) "Original g" +string(10) "Original a" +string(10) "Original b" +string(10) "Original c" +string(10) "Original d" +string(10) "Original e" +object(D)#%d (7) { + ["f":"D":private]=> + string(10) "Original f" + ["g":protected]=> + string(9) "changed.g" + ["a"]=> + string(9) "changed.a" + ["b"]=> + string(9) "changed.b" + ["c"]=> + string(9) "changed.c" + ["d":protected]=> + string(9) "changed.d" + ["e":"C":private]=> + string(9) "changed.e" +} +in D::doForEach +string(10) "Original f" +string(10) "Original g" +string(10) "Original a" +string(10) "Original b" +string(10) "Original c" +string(10) "Original d" +object(D)#%d (7) { + ["f":"D":private]=> + string(9) "changed.f" + ["g":protected]=> + string(9) "changed.g" + ["a"]=> + string(9) "changed.a" + ["b"]=> + string(9) "changed.b" + ["c"]=> + string(9) "changed.c" + ["d":protected]=> + string(9) "changed.d" + ["e":"C":private]=> + string(10) "Original e" +} +in E::doForEach +string(10) "Original g" +string(10) "Original a" +string(10) "Original b" +string(10) "Original c" +string(10) "Original d" +object(D)#%d (7) { + ["f":"D":private]=> + string(10) "Original f" + ["g":protected]=> + string(9) "changed.g" + ["a"]=> + string(9) "changed.a" + ["b"]=> + string(9) "changed.b" + ["c"]=> + string(9) "changed.c" + ["d":protected]=> + string(9) "changed.d" + ["e":"C":private]=> + string(10) "Original e" +} + +--> Using instance of E: +in C::doForEach +string(12) "Overridden a" +string(12) "Overridden b" +string(12) "Overridden c" +string(12) "Overridden d" +string(10) "Original g" +string(10) "Original e" +object(E)#%d (8) { + ["a"]=> + string(9) "changed.a" + ["b"]=> + string(9) "changed.b" + ["c"]=> + string(9) "changed.c" + ["d":protected]=> + string(9) "changed.d" + ["e":"E":private]=> + string(12) "Overridden e" + ["f":"D":private]=> + string(10) "Original f" + ["g":protected]=> + string(9) "changed.g" + ["e":"C":private]=> + string(9) "changed.e" +} +in D::doForEach +string(12) "Overridden a" +string(12) "Overridden b" +string(12) "Overridden c" +string(12) "Overridden d" +string(10) "Original f" +string(10) "Original g" +object(E)#%d (8) { + ["a"]=> + string(9) "changed.a" + ["b"]=> + string(9) "changed.b" + ["c"]=> + string(9) "changed.c" + ["d":protected]=> + string(9) "changed.d" + ["e":"E":private]=> + string(12) "Overridden e" + ["f":"D":private]=> + string(9) "changed.f" + ["g":protected]=> + string(9) "changed.g" + ["e":"C":private]=> + string(10) "Original e" +} +in E::doForEach +string(12) "Overridden a" +string(12) "Overridden b" +string(12) "Overridden c" +string(12) "Overridden d" +string(12) "Overridden e" +string(10) "Original g" +object(E)#%d (8) { + ["a"]=> + string(9) "changed.a" + ["b"]=> + string(9) "changed.b" + ["c"]=> + string(9) "changed.c" + ["d":protected]=> + string(9) "changed.d" + ["e":"E":private]=> + string(9) "changed.e" + ["f":"D":private]=> + string(10) "Original f" + ["g":protected]=> + string(9) "changed.g" + ["e":"C":private]=> + string(10) "Original e" +} + + +Iterate over various generations from outside the object: + +--> Using instance of C: +string(10) "Original a" +string(10) "Original b" +string(10) "Original c" +object(C)#%d (5) { + ["a"]=> + string(9) "changed.a" + ["b"]=> + string(9) "changed.b" + ["c"]=> + &string(9) "changed.c" + ["d":protected]=> + string(10) "Original d" + ["e":"C":private]=> + string(10) "Original e" +} + +--> Using instance of D: +string(10) "Original a" +string(10) "Original b" +string(10) "Original c" +object(D)#%d (7) { + ["f":"D":private]=> + string(10) "Original f" + ["g":protected]=> + string(10) "Original g" + ["a"]=> + string(9) "changed.a" + ["b"]=> + string(9) "changed.b" + ["c"]=> + &string(9) "changed.c" + ["d":protected]=> + string(10) "Original d" + ["e":"C":private]=> + string(10) "Original e" +} + +--> Using instance of E: +string(12) "Overridden a" +string(12) "Overridden b" +string(12) "Overridden c" +object(E)#%d (8) { + ["a"]=> + string(9) "changed.a" + ["b"]=> + string(9) "changed.b" + ["c"]=> + &string(9) "changed.c" + ["d":protected]=> + string(12) "Overridden d" + ["e":"E":private]=> + string(12) "Overridden e" + ["f":"D":private]=> + string(10) "Original f" + ["g":protected]=> + string(10) "Original g" + ["e":"C":private]=> + string(10) "Original e" +} +===DONE===
\ No newline at end of file diff --git a/tests/lang/foreachLoopObjects.003.phpt b/tests/lang/foreachLoopObjects.003.phpt new file mode 100644 index 0000000..e3747bf --- /dev/null +++ b/tests/lang/foreachLoopObjects.003.phpt @@ -0,0 +1,250 @@ +--TEST-- +Foreach loop tests - modifying the object during the loop. +--FILE-- +<?php + +class C { + public $a = "Original a"; + public $b = "Original b"; + public $c = "Original c"; + protected $d = "Original d"; + private $e = "Original e"; +} + +echo "\nDirectly changing object values.\n"; +$obj = new C; +foreach ($obj as $k=>$v) { + $obj->$k="changed.$k"; + var_dump($v); +} +var_dump($obj); + +echo "\nModifying the foreach \$value.\n"; +$obj = new C; +foreach ($obj as $k=>$v) { + $v="changed.$k"; +} +var_dump($obj); + + +echo "\nModifying the foreach &\$value.\n"; +$obj = new C; +foreach ($obj as $k=>&$v) { + $v="changed.$k"; +} +var_dump($obj); + +echo "\nAdding properties to an an object.\n"; +$obj = new C; +$counter=0; +foreach ($obj as $v) { + $newPropName = "new$counter"; + $obj->$newPropName = "Added property $counter"; + if ($counter++>10) { + echo "Loop detected\n"; + break; + } + var_dump($v); +} +var_dump($obj); + +echo "\nAdding properties to an an object, using &\$value.\n"; +$obj = new C; +$counter=0; +foreach ($obj as &$v) { + $newPropName = "new$counter"; + $obj->$newPropName = "Added property $counter"; + if ($counter++>10) { + echo "Loop detected\n"; + break; + } + var_dump($v); +} +var_dump($obj); + +echo "\nRemoving properties from an object.\n"; +$obj = new C; +foreach ($obj as $v) { + unset($obj->a); + unset($obj->b); + unset($obj->c); + var_dump($v); +} +var_dump($obj); + +echo "\nRemoving properties from an object, using &\$value.\n"; +$obj = new C; +foreach ($obj as &$v) { + unset($obj->a); + unset($obj->b); + unset($obj->c); + var_dump($v); +} +var_dump($obj); + +?> +===DONE=== +--EXPECTF-- +Directly changing object values. +string(10) "Original a" +string(10) "Original b" +string(10) "Original c" +object(C)#%d (5) { + ["a"]=> + string(9) "changed.a" + ["b"]=> + string(9) "changed.b" + ["c"]=> + string(9) "changed.c" + ["d":protected]=> + string(10) "Original d" + ["e":"C":private]=> + string(10) "Original e" +} + +Modifying the foreach $value. +object(C)#%d (5) { + ["a"]=> + string(10) "Original a" + ["b"]=> + string(10) "Original b" + ["c"]=> + string(10) "Original c" + ["d":protected]=> + string(10) "Original d" + ["e":"C":private]=> + string(10) "Original e" +} + +Modifying the foreach &$value. +object(C)#%d (5) { + ["a"]=> + string(9) "changed.a" + ["b"]=> + string(9) "changed.b" + ["c"]=> + &string(9) "changed.c" + ["d":protected]=> + string(10) "Original d" + ["e":"C":private]=> + string(10) "Original e" +} + +Adding properties to an an object. +string(10) "Original a" +string(10) "Original b" +string(10) "Original c" +string(16) "Added property 0" +string(16) "Added property 1" +string(16) "Added property 2" +string(16) "Added property 3" +string(16) "Added property 4" +string(16) "Added property 5" +string(16) "Added property 6" +string(16) "Added property 7" +Loop detected +object(C)#%d (17) { + ["a"]=> + string(10) "Original a" + ["b"]=> + string(10) "Original b" + ["c"]=> + string(10) "Original c" + ["d":protected]=> + string(10) "Original d" + ["e":"C":private]=> + string(10) "Original e" + ["new0"]=> + string(16) "Added property 0" + ["new1"]=> + string(16) "Added property 1" + ["new2"]=> + string(16) "Added property 2" + ["new3"]=> + string(16) "Added property 3" + ["new4"]=> + string(16) "Added property 4" + ["new5"]=> + string(16) "Added property 5" + ["new6"]=> + string(16) "Added property 6" + ["new7"]=> + string(16) "Added property 7" + ["new8"]=> + string(16) "Added property 8" + ["new9"]=> + string(16) "Added property 9" + ["new10"]=> + string(17) "Added property 10" + ["new11"]=> + string(17) "Added property 11" +} + +Adding properties to an an object, using &$value. +string(10) "Original a" +string(10) "Original b" +string(10) "Original c" +string(16) "Added property 0" +string(16) "Added property 1" +string(16) "Added property 2" +string(16) "Added property 3" +string(16) "Added property 4" +string(16) "Added property 5" +string(16) "Added property 6" +string(16) "Added property 7" +Loop detected +object(C)#%d (17) { + ["a"]=> + string(10) "Original a" + ["b"]=> + string(10) "Original b" + ["c"]=> + string(10) "Original c" + ["d":protected]=> + string(10) "Original d" + ["e":"C":private]=> + string(10) "Original e" + ["new0"]=> + string(16) "Added property 0" + ["new1"]=> + string(16) "Added property 1" + ["new2"]=> + string(16) "Added property 2" + ["new3"]=> + string(16) "Added property 3" + ["new4"]=> + string(16) "Added property 4" + ["new5"]=> + string(16) "Added property 5" + ["new6"]=> + string(16) "Added property 6" + ["new7"]=> + string(16) "Added property 7" + ["new8"]=> + &string(16) "Added property 8" + ["new9"]=> + string(16) "Added property 9" + ["new10"]=> + string(17) "Added property 10" + ["new11"]=> + string(17) "Added property 11" +} + +Removing properties from an object. +string(10) "Original a" +object(C)#%d (2) { + ["d":protected]=> + string(10) "Original d" + ["e":"C":private]=> + string(10) "Original e" +} + +Removing properties from an object, using &$value. +string(10) "Original a" +object(C)#%d (2) { + ["d":protected]=> + string(10) "Original d" + ["e":"C":private]=> + string(10) "Original e" +} +===DONE===
\ No newline at end of file diff --git a/tests/lang/foreachLoopObjects.004.phpt b/tests/lang/foreachLoopObjects.004.phpt new file mode 100644 index 0000000..a158ac6 --- /dev/null +++ b/tests/lang/foreachLoopObjects.004.phpt @@ -0,0 +1,55 @@ +--TEST-- +Foreach loop tests - Removing the current element from an iterated object. +--FILE-- +<?php + +class C { + public $a = "Original a"; + public $b = "Original b"; + public $c = "Original c"; + public $d = "Original d"; + public $e = "Original e"; +} + +echo "\nRemoving the current element from an iterated object.\n"; +$obj = new C; +$count=0; +foreach ($obj as $v) { + if ($v==$obj->b) { + unset($obj->b); + } + var_dump($v); + if (++$count>10) { + echo "Loop detected.\n"; + break; + } +} +var_dump($obj); + + +?> +===DONE=== +--EXPECTF-- +Removing the current element from an iterated object. +string(10) "Original a" +string(10) "Original b" + +Notice: Undefined property: C::$b in %s on line %d +string(10) "Original c" + +Notice: Undefined property: C::$b in %s on line %d +string(10) "Original d" + +Notice: Undefined property: C::$b in %s on line %d +string(10) "Original e" +object(C)#%d (4) { + ["a"]=> + string(10) "Original a" + ["c"]=> + string(10) "Original c" + ["d"]=> + string(10) "Original d" + ["e"]=> + string(10) "Original e" +} +===DONE===
\ No newline at end of file diff --git a/tests/lang/foreachLoopObjects.005.phpt b/tests/lang/foreachLoopObjects.005.phpt new file mode 100644 index 0000000..1692bcd --- /dev/null +++ b/tests/lang/foreachLoopObjects.005.phpt @@ -0,0 +1,78 @@ +--TEST-- +Foreach loop tests - removing properties before and after the current property during the loop. +--FILE-- +<?php + +class C { + public $a = "Original a"; + public $b = "Original b"; + public $c = "Original c"; + public $d = "Original d"; + public $e = "Original e"; +} + +echo "\nRemoving properties before the current element from an iterated object.\n"; +$obj = new C; +$count=0; +foreach ($obj as $v) { + if ($v==$obj->a) { + unset($obj->c); + } + var_dump($v); + if (++$count>10) { + echo "Loop detected.\n"; + break; + } +} +var_dump($obj); + +echo "\nRemoving properties before the current element from an iterated object.\n"; +$obj = new C; +foreach ($obj as $v) { + if ($v==$obj->b) { + unset($obj->a); + } + var_dump($v); + if (++$count>10) { + echo "Loop detected.\n"; + break; + } +} +var_dump($obj); + + +?> +--EXPECTF-- + +Removing properties before the current element from an iterated object. +string(10) "Original a" +string(10) "Original b" +string(10) "Original d" +string(10) "Original e" +object(C)#%d (4) { + ["a"]=> + string(10) "Original a" + ["b"]=> + string(10) "Original b" + ["d"]=> + string(10) "Original d" + ["e"]=> + string(10) "Original e" +} + +Removing properties before the current element from an iterated object. +string(10) "Original a" +string(10) "Original b" +string(10) "Original c" +string(10) "Original d" +string(10) "Original e" +object(C)#%d (4) { + ["b"]=> + string(10) "Original b" + ["c"]=> + string(10) "Original c" + ["d"]=> + string(10) "Original d" + ["e"]=> + string(10) "Original e" +} diff --git a/tests/lang/foreachLoopObjects.006.phpt b/tests/lang/foreachLoopObjects.006.phpt new file mode 100644 index 0000000..8218b44 --- /dev/null +++ b/tests/lang/foreachLoopObjects.006.phpt @@ -0,0 +1,147 @@ +--TEST-- +Foreach loop tests - substituting the entire iterated entity during the loop. +--FILE-- +<?php + +class C { + public $a = "Original a"; + public $b = "Original b"; + public $c = "Original c"; + public $d = "Original d"; + public $e = "Original e"; +} + +echo "\nSubstituting the iterated object for a different object.\n"; +$obj = new C; +$obj2 = new stdclass; +$obj2->a = "new a"; +$obj2->b = "new b"; +$obj2->c = "new c"; +$obj2->d = "new d"; +$obj2->e = "new e"; +$obj2->f = "new f"; +$ref = &$obj; +$count=0; +foreach ($obj as $v) { + var_dump($v); + if ($v==$obj->b) { + $ref=$obj2; + } + if (++$count>10) { + echo "Loop detected.\n"; + break; + } +} +var_dump($obj); + +echo "\nSubstituting the iterated object for an array.\n"; +$obj = new C; +$a = array(1,2,3,4,5,6,7,8); +$ref = &$obj; +$count=0; +foreach ($obj as $v) { + var_dump($v); + if ($v==="Original b") { + $ref=$a; + } + if (++$count>10) { + echo "Loop detected.\n"; + break; + } +} +var_dump($obj); + +echo "\nSubstituting the iterated array for an object.\n"; +$a = array(1,2,3,4,5,6,7,8); +$obj = new C; +$ref = &$a; +$count=0; +foreach ($a as $v) { + var_dump($v); + if ($v===2) { + $ref=$obj; + } + if (++$count>10) { + echo "Loop detected.\n"; + break; + } +} +var_dump($obj); + +?> +--EXPECTF-- + +Substituting the iterated object for a different object. +string(10) "Original a" +string(10) "Original b" +string(5) "new a" +string(5) "new b" +string(5) "new c" +string(5) "new d" +string(5) "new e" +string(5) "new f" +object(stdClass)#%d (6) { + ["a"]=> + string(5) "new a" + ["b"]=> + string(5) "new b" + ["c"]=> + string(5) "new c" + ["d"]=> + string(5) "new d" + ["e"]=> + string(5) "new e" + ["f"]=> + string(5) "new f" +} + +Substituting the iterated object for an array. +string(10) "Original a" +string(10) "Original b" +int(1) +int(2) +int(3) +int(4) +int(5) +int(6) +int(7) +int(8) +array(8) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) + [5]=> + int(6) + [6]=> + int(7) + [7]=> + int(8) +} + +Substituting the iterated array for an object. +int(1) +int(2) +string(10) "Original a" +string(10) "Original b" +string(10) "Original c" +string(10) "Original d" +string(10) "Original e" +object(C)#%d (5) { + ["a"]=> + string(10) "Original a" + ["b"]=> + string(10) "Original b" + ["c"]=> + string(10) "Original c" + ["d"]=> + string(10) "Original d" + ["e"]=> + string(10) "Original e" +} diff --git a/tests/lang/foreach_with_object_001.phpt b/tests/lang/foreach_with_object_001.phpt new file mode 100644 index 0000000..598b844 --- /dev/null +++ b/tests/lang/foreach_with_object_001.phpt @@ -0,0 +1,25 @@ +--TEST-- +foreach() with foreach($o->mthd()->arr) +--FILE-- +<?php +class Test { + public $a = array(1,2,3,4,5); // removed, crash too + function c() { + return new Test(); + } + +} +$obj = new Test(); +foreach ($obj->c()->a as $value) { + print "$value\n"; +} + +?> +===DONE=== +--EXPECT-- +1 +2 +3 +4 +5 +===DONE=== diff --git a/tests/lang/foreach_with_references_001.phpt b/tests/lang/foreach_with_references_001.phpt new file mode 100644 index 0000000..eb52bb8 --- /dev/null +++ b/tests/lang/foreach_with_references_001.phpt @@ -0,0 +1,32 @@ +--TEST-- +foreach() with references +--FILE-- +<?php + +$arr = array(1 => "one", 2 => "two", 3 => "three"); + +foreach($arr as $key => $val) { + $val = $key; +} + +print_r($arr); + +foreach($arr as $key => &$val) { + $val = $key; +} + +print_r($arr); + +--EXPECT-- +Array +( + [1] => one + [2] => two + [3] => three +) +Array +( + [1] => 1 + [2] => 2 + [3] => 3 +) diff --git a/tests/lang/func_get_arg.001.phpt b/tests/lang/func_get_arg.001.phpt new file mode 100644 index 0000000..b1bbb18 --- /dev/null +++ b/tests/lang/func_get_arg.001.phpt @@ -0,0 +1,15 @@ +--TEST-- +func_get_arg test +--FILE-- +<?php + +function foo($a) +{ + $a=5; + echo func_get_arg(0); +} +foo(2); +echo "\n"; +?> +--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 0000000..6ab4f95 --- /dev/null +++ b/tests/lang/func_get_arg.002.phpt @@ -0,0 +1,19 @@ +--TEST-- +func_get_arg with variable number of args +--FILE-- +<?php + +function foo($a) +{ + $b = func_get_arg(1); + var_dump($b); + $b++; + var_dump(func_get_arg(1)); + +} +foo(2, 3); +echo "\n"; +?> +--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 0000000..4ef9967 --- /dev/null +++ b/tests/lang/func_get_arg.003.phpt @@ -0,0 +1,11 @@ +--TEST-- +func_get_arg outside of a function declaration +--FILE-- +<?php + +var_dump (func_get_arg(0)); + +?> +--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 0000000..6931df0 --- /dev/null +++ b/tests/lang/func_get_arg.004.phpt @@ -0,0 +1,16 @@ +--TEST-- +func_get_arg on non-existent arg +--FILE-- +<?php + +function foo($a) +{ + var_dump(func_get_arg(2)); +} +foo(2, 3); +echo "\n"; + +?> +--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 0000000..e1ae78e --- /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-- +<?php +function refVal($x) { + global $a; + $a = 'changed.a'; + var_dump($x); + var_dump(func_get_arg(0)); +} + +$a = "original.a"; +$ref =& $a; +refVal($a); +?> +--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 0000000..5dd0ed6 --- /dev/null +++ b/tests/lang/func_get_arg_variation.phpt @@ -0,0 +1,28 @@ +--TEST-- +func_get_arg test +--FILE-- +<?php + +function foo($a) +{ + $a=5; + echo func_get_arg(); + echo func_get_arg(2,2); + echo func_get_arg("hello"); + echo func_get_arg(-1); + echo func_get_arg(2); +} +foo(2); +echo "\n"; +?> +--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 0000000..740a0a2 --- /dev/null +++ b/tests/lang/func_get_args.001.phpt @@ -0,0 +1,15 @@ +--TEST-- +func_get_args with no args +--FILE-- +<?php + +function foo() +{ + var_dump(func_get_args()); +} +foo(); + +?> +--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 0000000..0a886c2 --- /dev/null +++ b/tests/lang/func_get_args.002.phpt @@ -0,0 +1,22 @@ +--TEST-- +func_get_args with variable number of args +--FILE-- +<?php + +function foo($a) +{ + var_dump(func_get_args()); +} +foo(1, 2, 3); + +?> +--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 0000000..44faf7e --- /dev/null +++ b/tests/lang/func_get_args.003.phpt @@ -0,0 +1,11 @@ +--TEST-- +func_get_args() outside of a function declaration +--FILE-- +<?php + +var_dump(func_get_args()); + +?> +--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 0000000..84e3ebe --- /dev/null +++ b/tests/lang/func_get_args.004.phpt @@ -0,0 +1,67 @@ +--TEST-- +Pass same variable by ref and by value. +--FILE-- +<?php +function valRef($x, &$y) { + var_dump($x, $y); + var_dump(func_get_args()); + $x = 'changed.x'; + $y = 'changed.y'; + var_dump(func_get_args()); +} + +function refVal(&$x, $y) { + var_dump($x, $y); + var_dump(func_get_args()); + $x = 'changed.x'; + $y = 'changed.y'; + var_dump(func_get_args()); +} + + +echo "\n\n-- Val, Ref --\n"; +$a = 'original.a'; +valRef($a, $a); +var_dump($a); + +echo "\n\n-- Ref, Val --\n"; +$b = 'original.b'; +refVal($b, $b); +var_dump($b); +?> +--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 0000000..c281557 --- /dev/null +++ b/tests/lang/func_num_args.001.phpt @@ -0,0 +1,14 @@ +--TEST-- +func_num_args with no args +--FILE-- +<?php + +function foo() +{ + var_dump(func_num_args()); +} +foo(); + +?> +--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 0000000..bfb8f7c --- /dev/null +++ b/tests/lang/func_num_args.002.phpt @@ -0,0 +1,14 @@ +--TEST-- +func_num_args with variable number of args +--FILE-- +<?php + +function foo($a) +{ + var_dump(func_num_args()); +} +foo(1, 2, 3); + +?> +--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 0000000..7cf1229 --- /dev/null +++ b/tests/lang/func_num_args.003.phpt @@ -0,0 +1,12 @@ +--TEST-- +func_num_args() outside of a function declaration +--FILE-- +<?php + +var_dump(func_num_args()); + +?> +--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 0000000..8bdc6f0 --- /dev/null +++ b/tests/lang/func_num_args.004.phpt @@ -0,0 +1,48 @@ +--TEST-- +Pass same variable by ref and by value. +--FILE-- +<?php +function valRef($x, &$y) { + var_dump($x, $y); + var_dump(func_num_args()); + $x = 'changed.x'; + $y = 'changed.y'; + var_dump(func_num_args()); +} + +function refVal(&$x, $y) { + var_dump($x, $y); + var_dump(func_num_args()); + $x = 'changed.x'; + $y = 'changed.y'; + var_dump(func_num_args()); +} + + +echo "\n\n-- Val, Ref --\n"; +$a = 'original.a'; +valRef($a, $a); +var_dump($a); + +echo "\n\n-- Ref, Val --\n"; +$b = 'original.b'; +refVal($b, $b); +var_dump($b); +?> +--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/inc.inc b/tests/lang/inc.inc new file mode 100644 index 0000000..64b30af --- /dev/null +++ b/tests/lang/inc.inc @@ -0,0 +1,3 @@ +<?php +echo "Included!\n"; +?> diff --git a/tests/lang/inc_throw.inc b/tests/lang/inc_throw.inc new file mode 100644 index 0000000..1f032f7 --- /dev/null +++ b/tests/lang/inc_throw.inc @@ -0,0 +1,5 @@ +<?php + +throw new Exception(); + +?> diff --git a/tests/lang/include_files/echo.inc b/tests/lang/include_files/echo.inc new file mode 100644 index 0000000..60714f6 --- /dev/null +++ b/tests/lang/include_files/echo.inc @@ -0,0 +1,3 @@ +<?php +echo "Included!\n"; +?>
\ No newline at end of file diff --git a/tests/lang/include_files/eval.inc b/tests/lang/include_files/eval.inc new file mode 100644 index 0000000..16da862 --- /dev/null +++ b/tests/lang/include_files/eval.inc @@ -0,0 +1,3 @@ +<?php +eval("require_once 'echo.inc';"); +?>
\ No newline at end of file diff --git a/tests/lang/include_files/function.inc b/tests/lang/include_files/function.inc new file mode 100644 index 0000000..528f46c --- /dev/null +++ b/tests/lang/include_files/function.inc @@ -0,0 +1,3 @@ +<?php +function test() { require_once 'echo.inc'; } +?> diff --git a/tests/lang/include_variation1.phpt b/tests/lang/include_variation1.phpt new file mode 100644 index 0000000..cf99ba9 --- /dev/null +++ b/tests/lang/include_variation1.phpt @@ -0,0 +1,8 @@ +--TEST-- +include() a file from the current script directory +--FILE-- +<?php +include("inc.inc"); +?> +--EXPECT-- +Included! diff --git a/tests/lang/include_variation2.phpt b/tests/lang/include_variation2.phpt new file mode 100644 index 0000000..051ed71 --- /dev/null +++ b/tests/lang/include_variation2.phpt @@ -0,0 +1,9 @@ +--TEST-- +Including a file in the current script directory from an included function +--FILE-- +<?php +require_once 'include_files/function.inc'; +test(); +?> +--EXPECT-- +Included! diff --git a/tests/lang/include_variation3.phpt b/tests/lang/include_variation3.phpt new file mode 100644 index 0000000..1fa80c5 --- /dev/null +++ b/tests/lang/include_variation3.phpt @@ -0,0 +1,8 @@ +--TEST-- +Including a file in the current script directory from eval'd code +--FILE-- +<?php +require_once 'include_files/eval.inc'; +?> +--EXPECT-- +Included!
\ No newline at end of file diff --git a/tests/lang/operators/add_basiclong_64bit.phpt b/tests/lang/operators/add_basiclong_64bit.phpt new file mode 100644 index 0000000..cae8f4f --- /dev/null +++ b/tests/lang/operators/add_basiclong_64bit.phpt @@ -0,0 +1,582 @@ +--TEST--
+Test + operator : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+$otherVals = array(0, 1, -1, 7, 9, 65, -44, MAX_32Bit, MAX_64Bit);
+
+error_reporting(E_ERROR);
+
+foreach ($longVals as $longVal) {
+ foreach($otherVals as $otherVal) {
+ echo "--- testing: $longVal + $otherVal ---\n";
+ var_dump($longVal+$otherVal);
+ }
+}
+
+foreach ($otherVals as $otherVal) {
+ foreach($longVals as $longVal) {
+ echo "--- testing: $otherVal + $longVal ---\n";
+ var_dump($otherVal+$longVal);
+ }
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 + 0 --- +int(9223372036854775807) +--- testing: 9223372036854775807 + 1 --- +float(9.2233720368548E+18) +--- testing: 9223372036854775807 + -1 --- +int(9223372036854775806) +--- testing: 9223372036854775807 + 7 --- +float(9.2233720368548E+18) +--- testing: 9223372036854775807 + 9 --- +float(9.2233720368548E+18) +--- testing: 9223372036854775807 + 65 --- +float(9.2233720368548E+18) +--- testing: 9223372036854775807 + -44 --- +int(9223372036854775763) +--- testing: 9223372036854775807 + 2147483647 --- +float(9.2233720390023E+18) +--- testing: 9223372036854775807 + 9223372036854775807 --- +float(1.844674407371E+19) +--- testing: -9223372036854775808 + 0 --- +int(-9223372036854775808) +--- testing: -9223372036854775808 + 1 --- +int(-9223372036854775807) +--- testing: -9223372036854775808 + -1 --- +float(-9.2233720368548E+18) +--- testing: -9223372036854775808 + 7 --- +int(-9223372036854775801) +--- testing: -9223372036854775808 + 9 --- +int(-9223372036854775799) +--- testing: -9223372036854775808 + 65 --- +int(-9223372036854775743) +--- testing: -9223372036854775808 + -44 --- +float(-9.2233720368548E+18) +--- testing: -9223372036854775808 + 2147483647 --- +int(-9223372034707292161) +--- testing: -9223372036854775808 + 9223372036854775807 --- +int(-1) +--- testing: 2147483647 + 0 --- +int(2147483647) +--- testing: 2147483647 + 1 --- +int(2147483648) +--- testing: 2147483647 + -1 --- +int(2147483646) +--- testing: 2147483647 + 7 --- +int(2147483654) +--- testing: 2147483647 + 9 --- +int(2147483656) +--- testing: 2147483647 + 65 --- +int(2147483712) +--- testing: 2147483647 + -44 --- +int(2147483603) +--- testing: 2147483647 + 2147483647 --- +int(4294967294) +--- testing: 2147483647 + 9223372036854775807 --- +float(9.2233720390023E+18) +--- testing: -2147483648 + 0 --- +int(-2147483648) +--- testing: -2147483648 + 1 --- +int(-2147483647) +--- testing: -2147483648 + -1 --- +int(-2147483649) +--- testing: -2147483648 + 7 --- +int(-2147483641) +--- testing: -2147483648 + 9 --- +int(-2147483639) +--- testing: -2147483648 + 65 --- +int(-2147483583) +--- testing: -2147483648 + -44 --- +int(-2147483692) +--- testing: -2147483648 + 2147483647 --- +int(-1) +--- testing: -2147483648 + 9223372036854775807 --- +int(9223372034707292159) +--- testing: 9223372034707292160 + 0 --- +int(9223372034707292160) +--- testing: 9223372034707292160 + 1 --- +int(9223372034707292161) +--- testing: 9223372034707292160 + -1 --- +int(9223372034707292159) +--- testing: 9223372034707292160 + 7 --- +int(9223372034707292167) +--- testing: 9223372034707292160 + 9 --- +int(9223372034707292169) +--- testing: 9223372034707292160 + 65 --- +int(9223372034707292225) +--- testing: 9223372034707292160 + -44 --- +int(9223372034707292116) +--- testing: 9223372034707292160 + 2147483647 --- +int(9223372036854775807) +--- testing: 9223372034707292160 + 9223372036854775807 --- +float(1.8446744071562E+19) +--- testing: -9223372034707292160 + 0 --- +int(-9223372034707292160) +--- testing: -9223372034707292160 + 1 --- +int(-9223372034707292159) +--- testing: -9223372034707292160 + -1 --- +int(-9223372034707292161) +--- testing: -9223372034707292160 + 7 --- +int(-9223372034707292153) +--- testing: -9223372034707292160 + 9 --- +int(-9223372034707292151) +--- testing: -9223372034707292160 + 65 --- +int(-9223372034707292095) +--- testing: -9223372034707292160 + -44 --- +int(-9223372034707292204) +--- testing: -9223372034707292160 + 2147483647 --- +int(-9223372032559808513) +--- testing: -9223372034707292160 + 9223372036854775807 --- +int(2147483647) +--- testing: 2147483648 + 0 --- +int(2147483648) +--- testing: 2147483648 + 1 --- +int(2147483649) +--- testing: 2147483648 + -1 --- +int(2147483647) +--- testing: 2147483648 + 7 --- +int(2147483655) +--- testing: 2147483648 + 9 --- +int(2147483657) +--- testing: 2147483648 + 65 --- +int(2147483713) +--- testing: 2147483648 + -44 --- +int(2147483604) +--- testing: 2147483648 + 2147483647 --- +int(4294967295) +--- testing: 2147483648 + 9223372036854775807 --- +float(9.2233720390023E+18) +--- testing: -2147483649 + 0 --- +int(-2147483649) +--- testing: -2147483649 + 1 --- +int(-2147483648) +--- testing: -2147483649 + -1 --- +int(-2147483650) +--- testing: -2147483649 + 7 --- +int(-2147483642) +--- testing: -2147483649 + 9 --- +int(-2147483640) +--- testing: -2147483649 + 65 --- +int(-2147483584) +--- testing: -2147483649 + -44 --- +int(-2147483693) +--- testing: -2147483649 + 2147483647 --- +int(-2) +--- testing: -2147483649 + 9223372036854775807 --- +int(9223372034707292158) +--- testing: 4294967294 + 0 --- +int(4294967294) +--- testing: 4294967294 + 1 --- +int(4294967295) +--- testing: 4294967294 + -1 --- +int(4294967293) +--- testing: 4294967294 + 7 --- +int(4294967301) +--- testing: 4294967294 + 9 --- +int(4294967303) +--- testing: 4294967294 + 65 --- +int(4294967359) +--- testing: 4294967294 + -44 --- +int(4294967250) +--- testing: 4294967294 + 2147483647 --- +int(6442450941) +--- testing: 4294967294 + 9223372036854775807 --- +float(9.2233720411497E+18) +--- testing: 4294967295 + 0 --- +int(4294967295) +--- testing: 4294967295 + 1 --- +int(4294967296) +--- testing: 4294967295 + -1 --- +int(4294967294) +--- testing: 4294967295 + 7 --- +int(4294967302) +--- testing: 4294967295 + 9 --- +int(4294967304) +--- testing: 4294967295 + 65 --- +int(4294967360) +--- testing: 4294967295 + -44 --- +int(4294967251) +--- testing: 4294967295 + 2147483647 --- +int(6442450942) +--- testing: 4294967295 + 9223372036854775807 --- +float(9.2233720411497E+18) +--- testing: 4294967293 + 0 --- +int(4294967293) +--- testing: 4294967293 + 1 --- +int(4294967294) +--- testing: 4294967293 + -1 --- +int(4294967292) +--- testing: 4294967293 + 7 --- +int(4294967300) +--- testing: 4294967293 + 9 --- +int(4294967302) +--- testing: 4294967293 + 65 --- +int(4294967358) +--- testing: 4294967293 + -44 --- +int(4294967249) +--- testing: 4294967293 + 2147483647 --- +int(6442450940) +--- testing: 4294967293 + 9223372036854775807 --- +float(9.2233720411497E+18) +--- testing: 9223372036854775806 + 0 --- +int(9223372036854775806) +--- testing: 9223372036854775806 + 1 --- +int(9223372036854775807) +--- testing: 9223372036854775806 + -1 --- +int(9223372036854775805) +--- testing: 9223372036854775806 + 7 --- +float(9.2233720368548E+18) +--- testing: 9223372036854775806 + 9 --- +float(9.2233720368548E+18) +--- testing: 9223372036854775806 + 65 --- +float(9.2233720368548E+18) +--- testing: 9223372036854775806 + -44 --- +int(9223372036854775762) +--- testing: 9223372036854775806 + 2147483647 --- +float(9.2233720390023E+18) +--- testing: 9223372036854775806 + 9223372036854775807 --- +float(1.844674407371E+19) +--- testing: 9.2233720368548E+18 + 0 --- +float(9.2233720368548E+18) +--- testing: 9.2233720368548E+18 + 1 --- +float(9.2233720368548E+18) +--- testing: 9.2233720368548E+18 + -1 --- +float(9.2233720368548E+18) +--- testing: 9.2233720368548E+18 + 7 --- +float(9.2233720368548E+18) +--- testing: 9.2233720368548E+18 + 9 --- +float(9.2233720368548E+18) +--- testing: 9.2233720368548E+18 + 65 --- +float(9.2233720368548E+18) +--- testing: 9.2233720368548E+18 + -44 --- +float(9.2233720368548E+18) +--- testing: 9.2233720368548E+18 + 2147483647 --- +float(9.2233720390023E+18) +--- testing: 9.2233720368548E+18 + 9223372036854775807 --- +float(1.844674407371E+19) +--- testing: -9223372036854775807 + 0 --- +int(-9223372036854775807) +--- testing: -9223372036854775807 + 1 --- +int(-9223372036854775806) +--- testing: -9223372036854775807 + -1 --- +int(-9223372036854775808) +--- testing: -9223372036854775807 + 7 --- +int(-9223372036854775800) +--- testing: -9223372036854775807 + 9 --- +int(-9223372036854775798) +--- testing: -9223372036854775807 + 65 --- +int(-9223372036854775742) +--- testing: -9223372036854775807 + -44 --- +float(-9.2233720368548E+18) +--- testing: -9223372036854775807 + 2147483647 --- +int(-9223372034707292160) +--- testing: -9223372036854775807 + 9223372036854775807 --- +int(0) +--- testing: -9.2233720368548E+18 + 0 --- +float(-9.2233720368548E+18) +--- testing: -9.2233720368548E+18 + 1 --- +float(-9.2233720368548E+18) +--- testing: -9.2233720368548E+18 + -1 --- +float(-9.2233720368548E+18) +--- testing: -9.2233720368548E+18 + 7 --- +float(-9.2233720368548E+18) +--- testing: -9.2233720368548E+18 + 9 --- +float(-9.2233720368548E+18) +--- testing: -9.2233720368548E+18 + 65 --- +float(-9.2233720368548E+18) +--- testing: -9.2233720368548E+18 + -44 --- +float(-9.2233720368548E+18) +--- testing: -9.2233720368548E+18 + 2147483647 --- +float(-9.2233720347073E+18) +--- testing: -9.2233720368548E+18 + 9223372036854775807 --- +float(0) +--- testing: 0 + 9223372036854775807 --- +int(9223372036854775807) +--- testing: 0 + -9223372036854775808 --- +int(-9223372036854775808) +--- testing: 0 + 2147483647 --- +int(2147483647) +--- testing: 0 + -2147483648 --- +int(-2147483648) +--- testing: 0 + 9223372034707292160 --- +int(9223372034707292160) +--- testing: 0 + -9223372034707292160 --- +int(-9223372034707292160) +--- testing: 0 + 2147483648 --- +int(2147483648) +--- testing: 0 + -2147483649 --- +int(-2147483649) +--- testing: 0 + 4294967294 --- +int(4294967294) +--- testing: 0 + 4294967295 --- +int(4294967295) +--- testing: 0 + 4294967293 --- +int(4294967293) +--- testing: 0 + 9223372036854775806 --- +int(9223372036854775806) +--- testing: 0 + 9.2233720368548E+18 --- +float(9.2233720368548E+18) +--- testing: 0 + -9223372036854775807 --- +int(-9223372036854775807) +--- testing: 0 + -9.2233720368548E+18 --- +float(-9.2233720368548E+18) +--- testing: 1 + 9223372036854775807 --- +float(9.2233720368548E+18) +--- testing: 1 + -9223372036854775808 --- +int(-9223372036854775807) +--- testing: 1 + 2147483647 --- +int(2147483648) +--- testing: 1 + -2147483648 --- +int(-2147483647) +--- testing: 1 + 9223372034707292160 --- +int(9223372034707292161) +--- testing: 1 + -9223372034707292160 --- +int(-9223372034707292159) +--- testing: 1 + 2147483648 --- +int(2147483649) +--- testing: 1 + -2147483649 --- +int(-2147483648) +--- testing: 1 + 4294967294 --- +int(4294967295) +--- testing: 1 + 4294967295 --- +int(4294967296) +--- testing: 1 + 4294967293 --- +int(4294967294) +--- testing: 1 + 9223372036854775806 --- +int(9223372036854775807) +--- testing: 1 + 9.2233720368548E+18 --- +float(9.2233720368548E+18) +--- testing: 1 + -9223372036854775807 --- +int(-9223372036854775806) +--- testing: 1 + -9.2233720368548E+18 --- +float(-9.2233720368548E+18) +--- testing: -1 + 9223372036854775807 --- +int(9223372036854775806) +--- testing: -1 + -9223372036854775808 --- +float(-9.2233720368548E+18) +--- testing: -1 + 2147483647 --- +int(2147483646) +--- testing: -1 + -2147483648 --- +int(-2147483649) +--- testing: -1 + 9223372034707292160 --- +int(9223372034707292159) +--- testing: -1 + -9223372034707292160 --- +int(-9223372034707292161) +--- testing: -1 + 2147483648 --- +int(2147483647) +--- testing: -1 + -2147483649 --- +int(-2147483650) +--- testing: -1 + 4294967294 --- +int(4294967293) +--- testing: -1 + 4294967295 --- +int(4294967294) +--- testing: -1 + 4294967293 --- +int(4294967292) +--- testing: -1 + 9223372036854775806 --- +int(9223372036854775805) +--- testing: -1 + 9.2233720368548E+18 --- +float(9.2233720368548E+18) +--- testing: -1 + -9223372036854775807 --- +int(-9223372036854775808) +--- testing: -1 + -9.2233720368548E+18 --- +float(-9.2233720368548E+18) +--- testing: 7 + 9223372036854775807 --- +float(9.2233720368548E+18) +--- testing: 7 + -9223372036854775808 --- +int(-9223372036854775801) +--- testing: 7 + 2147483647 --- +int(2147483654) +--- testing: 7 + -2147483648 --- +int(-2147483641) +--- testing: 7 + 9223372034707292160 --- +int(9223372034707292167) +--- testing: 7 + -9223372034707292160 --- +int(-9223372034707292153) +--- testing: 7 + 2147483648 --- +int(2147483655) +--- testing: 7 + -2147483649 --- +int(-2147483642) +--- testing: 7 + 4294967294 --- +int(4294967301) +--- testing: 7 + 4294967295 --- +int(4294967302) +--- testing: 7 + 4294967293 --- +int(4294967300) +--- testing: 7 + 9223372036854775806 --- +float(9.2233720368548E+18) +--- testing: 7 + 9.2233720368548E+18 --- +float(9.2233720368548E+18) +--- testing: 7 + -9223372036854775807 --- +int(-9223372036854775800) +--- testing: 7 + -9.2233720368548E+18 --- +float(-9.2233720368548E+18) +--- testing: 9 + 9223372036854775807 --- +float(9.2233720368548E+18) +--- testing: 9 + -9223372036854775808 --- +int(-9223372036854775799) +--- testing: 9 + 2147483647 --- +int(2147483656) +--- testing: 9 + -2147483648 --- +int(-2147483639) +--- testing: 9 + 9223372034707292160 --- +int(9223372034707292169) +--- testing: 9 + -9223372034707292160 --- +int(-9223372034707292151) +--- testing: 9 + 2147483648 --- +int(2147483657) +--- testing: 9 + -2147483649 --- +int(-2147483640) +--- testing: 9 + 4294967294 --- +int(4294967303) +--- testing: 9 + 4294967295 --- +int(4294967304) +--- testing: 9 + 4294967293 --- +int(4294967302) +--- testing: 9 + 9223372036854775806 --- +float(9.2233720368548E+18) +--- testing: 9 + 9.2233720368548E+18 --- +float(9.2233720368548E+18) +--- testing: 9 + -9223372036854775807 --- +int(-9223372036854775798) +--- testing: 9 + -9.2233720368548E+18 --- +float(-9.2233720368548E+18) +--- testing: 65 + 9223372036854775807 --- +float(9.2233720368548E+18) +--- testing: 65 + -9223372036854775808 --- +int(-9223372036854775743) +--- testing: 65 + 2147483647 --- +int(2147483712) +--- testing: 65 + -2147483648 --- +int(-2147483583) +--- testing: 65 + 9223372034707292160 --- +int(9223372034707292225) +--- testing: 65 + -9223372034707292160 --- +int(-9223372034707292095) +--- testing: 65 + 2147483648 --- +int(2147483713) +--- testing: 65 + -2147483649 --- +int(-2147483584) +--- testing: 65 + 4294967294 --- +int(4294967359) +--- testing: 65 + 4294967295 --- +int(4294967360) +--- testing: 65 + 4294967293 --- +int(4294967358) +--- testing: 65 + 9223372036854775806 --- +float(9.2233720368548E+18) +--- testing: 65 + 9.2233720368548E+18 --- +float(9.2233720368548E+18) +--- testing: 65 + -9223372036854775807 --- +int(-9223372036854775742) +--- testing: 65 + -9.2233720368548E+18 --- +float(-9.2233720368548E+18) +--- testing: -44 + 9223372036854775807 --- +int(9223372036854775763) +--- testing: -44 + -9223372036854775808 --- +float(-9.2233720368548E+18) +--- testing: -44 + 2147483647 --- +int(2147483603) +--- testing: -44 + -2147483648 --- +int(-2147483692) +--- testing: -44 + 9223372034707292160 --- +int(9223372034707292116) +--- testing: -44 + -9223372034707292160 --- +int(-9223372034707292204) +--- testing: -44 + 2147483648 --- +int(2147483604) +--- testing: -44 + -2147483649 --- +int(-2147483693) +--- testing: -44 + 4294967294 --- +int(4294967250) +--- testing: -44 + 4294967295 --- +int(4294967251) +--- testing: -44 + 4294967293 --- +int(4294967249) +--- testing: -44 + 9223372036854775806 --- +int(9223372036854775762) +--- testing: -44 + 9.2233720368548E+18 --- +float(9.2233720368548E+18) +--- testing: -44 + -9223372036854775807 --- +float(-9.2233720368548E+18) +--- testing: -44 + -9.2233720368548E+18 --- +float(-9.2233720368548E+18) +--- testing: 2147483647 + 9223372036854775807 --- +float(9.2233720390023E+18) +--- testing: 2147483647 + -9223372036854775808 --- +int(-9223372034707292161) +--- testing: 2147483647 + 2147483647 --- +int(4294967294) +--- testing: 2147483647 + -2147483648 --- +int(-1) +--- testing: 2147483647 + 9223372034707292160 --- +int(9223372036854775807) +--- testing: 2147483647 + -9223372034707292160 --- +int(-9223372032559808513) +--- testing: 2147483647 + 2147483648 --- +int(4294967295) +--- testing: 2147483647 + -2147483649 --- +int(-2) +--- testing: 2147483647 + 4294967294 --- +int(6442450941) +--- testing: 2147483647 + 4294967295 --- +int(6442450942) +--- testing: 2147483647 + 4294967293 --- +int(6442450940) +--- testing: 2147483647 + 9223372036854775806 --- +float(9.2233720390023E+18) +--- testing: 2147483647 + 9.2233720368548E+18 --- +float(9.2233720390023E+18) +--- testing: 2147483647 + -9223372036854775807 --- +int(-9223372034707292160) +--- testing: 2147483647 + -9.2233720368548E+18 --- +float(-9.2233720347073E+18) +--- testing: 9223372036854775807 + 9223372036854775807 --- +float(1.844674407371E+19) +--- testing: 9223372036854775807 + -9223372036854775808 --- +int(-1) +--- testing: 9223372036854775807 + 2147483647 --- +float(9.2233720390023E+18) +--- testing: 9223372036854775807 + -2147483648 --- +int(9223372034707292159) +--- testing: 9223372036854775807 + 9223372034707292160 --- +float(1.8446744071562E+19) +--- testing: 9223372036854775807 + -9223372034707292160 --- +int(2147483647) +--- testing: 9223372036854775807 + 2147483648 --- +float(9.2233720390023E+18) +--- testing: 9223372036854775807 + -2147483649 --- +int(9223372034707292158) +--- testing: 9223372036854775807 + 4294967294 --- +float(9.2233720411497E+18) +--- testing: 9223372036854775807 + 4294967295 --- +float(9.2233720411497E+18) +--- testing: 9223372036854775807 + 4294967293 --- +float(9.2233720411497E+18) +--- testing: 9223372036854775807 + 9223372036854775806 --- +float(1.844674407371E+19) +--- testing: 9223372036854775807 + 9.2233720368548E+18 --- +float(1.844674407371E+19) +--- testing: 9223372036854775807 + -9223372036854775807 --- +int(0) +--- testing: 9223372036854775807 + -9.2233720368548E+18 --- +float(0)
+===DONE===
diff --git a/tests/lang/operators/add_variationStr.phpt b/tests/lang/operators/add_variationStr.phpt new file mode 100644 index 0000000..264c5c1 --- /dev/null +++ b/tests/lang/operators/add_variationStr.phpt @@ -0,0 +1,416 @@ +--TEST--
+Test + operator : various numbers as strings
+--FILE--
+<?php
+
+$strVals = array(
+ "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",
+ "a5.9"
+);
+
+error_reporting(E_ERROR);
+
+foreach ($strVals as $strVal) {
+ foreach($strVals as $otherVal) {
+ echo "--- testing: '$strVal' + '$otherVal' ---\n";
+ var_dump($strVal+$otherVal);
+ }
+}
+
+
+?>
+===DONE===
+--EXPECT--
+--- testing: '0' + '0' --- +int(0) +--- testing: '0' + '65' --- +int(65) +--- testing: '0' + '-44' --- +int(-44) +--- testing: '0' + '1.2' --- +float(1.2) +--- testing: '0' + '-7.7' --- +float(-7.7) +--- testing: '0' + 'abc' --- +int(0) +--- testing: '0' + '123abc' --- +int(123) +--- testing: '0' + '123e5' --- +float(12300000) +--- testing: '0' + '123e5xyz' --- +float(12300000) +--- testing: '0' + ' 123abc' --- +int(123) +--- testing: '0' + '123 abc' --- +int(123) +--- testing: '0' + '123abc ' --- +int(123) +--- testing: '0' + '3.4a' --- +float(3.4) +--- testing: '0' + 'a5.9' --- +int(0) +--- testing: '65' + '0' --- +int(65) +--- testing: '65' + '65' --- +int(130) +--- testing: '65' + '-44' --- +int(21) +--- testing: '65' + '1.2' --- +float(66.2) +--- testing: '65' + '-7.7' --- +float(57.3) +--- testing: '65' + 'abc' --- +int(65) +--- testing: '65' + '123abc' --- +int(188) +--- testing: '65' + '123e5' --- +float(12300065) +--- testing: '65' + '123e5xyz' --- +float(12300065) +--- testing: '65' + ' 123abc' --- +int(188) +--- testing: '65' + '123 abc' --- +int(188) +--- testing: '65' + '123abc ' --- +int(188) +--- testing: '65' + '3.4a' --- +float(68.4) +--- testing: '65' + 'a5.9' --- +int(65) +--- testing: '-44' + '0' --- +int(-44) +--- testing: '-44' + '65' --- +int(21) +--- testing: '-44' + '-44' --- +int(-88) +--- testing: '-44' + '1.2' --- +float(-42.8) +--- testing: '-44' + '-7.7' --- +float(-51.7) +--- testing: '-44' + 'abc' --- +int(-44) +--- testing: '-44' + '123abc' --- +int(79) +--- testing: '-44' + '123e5' --- +float(12299956) +--- testing: '-44' + '123e5xyz' --- +float(12299956) +--- testing: '-44' + ' 123abc' --- +int(79) +--- testing: '-44' + '123 abc' --- +int(79) +--- testing: '-44' + '123abc ' --- +int(79) +--- testing: '-44' + '3.4a' --- +float(-40.6) +--- testing: '-44' + 'a5.9' --- +int(-44) +--- testing: '1.2' + '0' --- +float(1.2) +--- testing: '1.2' + '65' --- +float(66.2) +--- testing: '1.2' + '-44' --- +float(-42.8) +--- testing: '1.2' + '1.2' --- +float(2.4) +--- testing: '1.2' + '-7.7' --- +float(-6.5) +--- testing: '1.2' + 'abc' --- +float(1.2) +--- testing: '1.2' + '123abc' --- +float(124.2) +--- testing: '1.2' + '123e5' --- +float(12300001.2) +--- testing: '1.2' + '123e5xyz' --- +float(12300001.2) +--- testing: '1.2' + ' 123abc' --- +float(124.2) +--- testing: '1.2' + '123 abc' --- +float(124.2) +--- testing: '1.2' + '123abc ' --- +float(124.2) +--- testing: '1.2' + '3.4a' --- +float(4.6) +--- testing: '1.2' + 'a5.9' --- +float(1.2) +--- testing: '-7.7' + '0' --- +float(-7.7) +--- testing: '-7.7' + '65' --- +float(57.3) +--- testing: '-7.7' + '-44' --- +float(-51.7) +--- testing: '-7.7' + '1.2' --- +float(-6.5) +--- testing: '-7.7' + '-7.7' --- +float(-15.4) +--- testing: '-7.7' + 'abc' --- +float(-7.7) +--- testing: '-7.7' + '123abc' --- +float(115.3) +--- testing: '-7.7' + '123e5' --- +float(12299992.3) +--- testing: '-7.7' + '123e5xyz' --- +float(12299992.3) +--- testing: '-7.7' + ' 123abc' --- +float(115.3) +--- testing: '-7.7' + '123 abc' --- +float(115.3) +--- testing: '-7.7' + '123abc ' --- +float(115.3) +--- testing: '-7.7' + '3.4a' --- +float(-4.3) +--- testing: '-7.7' + 'a5.9' --- +float(-7.7) +--- testing: 'abc' + '0' --- +int(0) +--- testing: 'abc' + '65' --- +int(65) +--- testing: 'abc' + '-44' --- +int(-44) +--- testing: 'abc' + '1.2' --- +float(1.2) +--- testing: 'abc' + '-7.7' --- +float(-7.7) +--- testing: 'abc' + 'abc' --- +int(0) +--- testing: 'abc' + '123abc' --- +int(123) +--- testing: 'abc' + '123e5' --- +float(12300000) +--- testing: 'abc' + '123e5xyz' --- +float(12300000) +--- testing: 'abc' + ' 123abc' --- +int(123) +--- testing: 'abc' + '123 abc' --- +int(123) +--- testing: 'abc' + '123abc ' --- +int(123) +--- testing: 'abc' + '3.4a' --- +float(3.4) +--- testing: 'abc' + 'a5.9' --- +int(0) +--- testing: '123abc' + '0' --- +int(123) +--- testing: '123abc' + '65' --- +int(188) +--- testing: '123abc' + '-44' --- +int(79) +--- testing: '123abc' + '1.2' --- +float(124.2) +--- testing: '123abc' + '-7.7' --- +float(115.3) +--- testing: '123abc' + 'abc' --- +int(123) +--- testing: '123abc' + '123abc' --- +int(246) +--- testing: '123abc' + '123e5' --- +float(12300123) +--- testing: '123abc' + '123e5xyz' --- +float(12300123) +--- testing: '123abc' + ' 123abc' --- +int(246) +--- testing: '123abc' + '123 abc' --- +int(246) +--- testing: '123abc' + '123abc ' --- +int(246) +--- testing: '123abc' + '3.4a' --- +float(126.4) +--- testing: '123abc' + 'a5.9' --- +int(123) +--- testing: '123e5' + '0' --- +float(12300000) +--- testing: '123e5' + '65' --- +float(12300065) +--- testing: '123e5' + '-44' --- +float(12299956) +--- testing: '123e5' + '1.2' --- +float(12300001.2) +--- testing: '123e5' + '-7.7' --- +float(12299992.3) +--- testing: '123e5' + 'abc' --- +float(12300000) +--- testing: '123e5' + '123abc' --- +float(12300123) +--- testing: '123e5' + '123e5' --- +float(24600000) +--- testing: '123e5' + '123e5xyz' --- +float(24600000) +--- testing: '123e5' + ' 123abc' --- +float(12300123) +--- testing: '123e5' + '123 abc' --- +float(12300123) +--- testing: '123e5' + '123abc ' --- +float(12300123) +--- testing: '123e5' + '3.4a' --- +float(12300003.4) +--- testing: '123e5' + 'a5.9' --- +float(12300000) +--- testing: '123e5xyz' + '0' --- +float(12300000) +--- testing: '123e5xyz' + '65' --- +float(12300065) +--- testing: '123e5xyz' + '-44' --- +float(12299956) +--- testing: '123e5xyz' + '1.2' --- +float(12300001.2) +--- testing: '123e5xyz' + '-7.7' --- +float(12299992.3) +--- testing: '123e5xyz' + 'abc' --- +float(12300000) +--- testing: '123e5xyz' + '123abc' --- +float(12300123) +--- testing: '123e5xyz' + '123e5' --- +float(24600000) +--- testing: '123e5xyz' + '123e5xyz' --- +float(24600000) +--- testing: '123e5xyz' + ' 123abc' --- +float(12300123) +--- testing: '123e5xyz' + '123 abc' --- +float(12300123) +--- testing: '123e5xyz' + '123abc ' --- +float(12300123) +--- testing: '123e5xyz' + '3.4a' --- +float(12300003.4) +--- testing: '123e5xyz' + 'a5.9' --- +float(12300000) +--- testing: ' 123abc' + '0' --- +int(123) +--- testing: ' 123abc' + '65' --- +int(188) +--- testing: ' 123abc' + '-44' --- +int(79) +--- testing: ' 123abc' + '1.2' --- +float(124.2) +--- testing: ' 123abc' + '-7.7' --- +float(115.3) +--- testing: ' 123abc' + 'abc' --- +int(123) +--- testing: ' 123abc' + '123abc' --- +int(246) +--- testing: ' 123abc' + '123e5' --- +float(12300123) +--- testing: ' 123abc' + '123e5xyz' --- +float(12300123) +--- testing: ' 123abc' + ' 123abc' --- +int(246) +--- testing: ' 123abc' + '123 abc' --- +int(246) +--- testing: ' 123abc' + '123abc ' --- +int(246) +--- testing: ' 123abc' + '3.4a' --- +float(126.4) +--- testing: ' 123abc' + 'a5.9' --- +int(123) +--- testing: '123 abc' + '0' --- +int(123) +--- testing: '123 abc' + '65' --- +int(188) +--- testing: '123 abc' + '-44' --- +int(79) +--- testing: '123 abc' + '1.2' --- +float(124.2) +--- testing: '123 abc' + '-7.7' --- +float(115.3) +--- testing: '123 abc' + 'abc' --- +int(123) +--- testing: '123 abc' + '123abc' --- +int(246) +--- testing: '123 abc' + '123e5' --- +float(12300123) +--- testing: '123 abc' + '123e5xyz' --- +float(12300123) +--- testing: '123 abc' + ' 123abc' --- +int(246) +--- testing: '123 abc' + '123 abc' --- +int(246) +--- testing: '123 abc' + '123abc ' --- +int(246) +--- testing: '123 abc' + '3.4a' --- +float(126.4) +--- testing: '123 abc' + 'a5.9' --- +int(123) +--- testing: '123abc ' + '0' --- +int(123) +--- testing: '123abc ' + '65' --- +int(188) +--- testing: '123abc ' + '-44' --- +int(79) +--- testing: '123abc ' + '1.2' --- +float(124.2) +--- testing: '123abc ' + '-7.7' --- +float(115.3) +--- testing: '123abc ' + 'abc' --- +int(123) +--- testing: '123abc ' + '123abc' --- +int(246) +--- testing: '123abc ' + '123e5' --- +float(12300123) +--- testing: '123abc ' + '123e5xyz' --- +float(12300123) +--- testing: '123abc ' + ' 123abc' --- +int(246) +--- testing: '123abc ' + '123 abc' --- +int(246) +--- testing: '123abc ' + '123abc ' --- +int(246) +--- testing: '123abc ' + '3.4a' --- +float(126.4) +--- testing: '123abc ' + 'a5.9' --- +int(123) +--- testing: '3.4a' + '0' --- +float(3.4) +--- testing: '3.4a' + '65' --- +float(68.4) +--- testing: '3.4a' + '-44' --- +float(-40.6) +--- testing: '3.4a' + '1.2' --- +float(4.6) +--- testing: '3.4a' + '-7.7' --- +float(-4.3) +--- testing: '3.4a' + 'abc' --- +float(3.4) +--- testing: '3.4a' + '123abc' --- +float(126.4) +--- testing: '3.4a' + '123e5' --- +float(12300003.4) +--- testing: '3.4a' + '123e5xyz' --- +float(12300003.4) +--- testing: '3.4a' + ' 123abc' --- +float(126.4) +--- testing: '3.4a' + '123 abc' --- +float(126.4) +--- testing: '3.4a' + '123abc ' --- +float(126.4) +--- testing: '3.4a' + '3.4a' --- +float(6.8) +--- testing: '3.4a' + 'a5.9' --- +float(3.4) +--- testing: 'a5.9' + '0' --- +int(0) +--- testing: 'a5.9' + '65' --- +int(65) +--- testing: 'a5.9' + '-44' --- +int(-44) +--- testing: 'a5.9' + '1.2' --- +float(1.2) +--- testing: 'a5.9' + '-7.7' --- +float(-7.7) +--- testing: 'a5.9' + 'abc' --- +int(0) +--- testing: 'a5.9' + '123abc' --- +int(123) +--- testing: 'a5.9' + '123e5' --- +float(12300000) +--- testing: 'a5.9' + '123e5xyz' --- +float(12300000) +--- testing: 'a5.9' + ' 123abc' --- +int(123) +--- testing: 'a5.9' + '123 abc' --- +int(123) +--- testing: 'a5.9' + '123abc ' --- +int(123) +--- testing: 'a5.9' + '3.4a' --- +float(3.4) +--- testing: 'a5.9' + 'a5.9' --- +int(0)
+===DONE===
diff --git a/tests/lang/operators/bitwiseAnd_basiclong_64bit.phpt b/tests/lang/operators/bitwiseAnd_basiclong_64bit.phpt new file mode 100644 index 0000000..f463e5d --- /dev/null +++ b/tests/lang/operators/bitwiseAnd_basiclong_64bit.phpt @@ -0,0 +1,582 @@ +--TEST-- +Test & operator : 64bit long tests +--SKIPIF-- +<?php +if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); +?> +--FILE-- +<?php + +define("MAX_64Bit", 9223372036854775807); +define("MAX_32Bit", 2147483647); +define("MIN_64Bit", -9223372036854775807 - 1); +define("MIN_32Bit", -2147483647 - 1); + +$longVals = array( + MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit, + MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1, + MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1 +); + +$otherVals = array(0, 1, -1, 7, 9, 65, -44, MAX_32Bit, MAX_64Bit); + +error_reporting(E_ERROR); + +foreach ($longVals as $longVal) { + foreach($otherVals as $otherVal) { + echo "--- testing: $longVal & $otherVal ---\n"; + var_dump($longVal&$otherVal); + } +} + +foreach ($otherVals as $otherVal) { + foreach($longVals as $longVal) { + echo "--- testing: $otherVal & $longVal ---\n"; + var_dump($otherVal&$longVal); + } +} + +?> +===DONE=== +--EXPECT-- +--- testing: 9223372036854775807 & 0 --- +int(0) +--- testing: 9223372036854775807 & 1 --- +int(1) +--- testing: 9223372036854775807 & -1 --- +int(9223372036854775807) +--- testing: 9223372036854775807 & 7 --- +int(7) +--- testing: 9223372036854775807 & 9 --- +int(9) +--- testing: 9223372036854775807 & 65 --- +int(65) +--- testing: 9223372036854775807 & -44 --- +int(9223372036854775764) +--- testing: 9223372036854775807 & 2147483647 --- +int(2147483647) +--- testing: 9223372036854775807 & 9223372036854775807 --- +int(9223372036854775807) +--- testing: -9223372036854775808 & 0 --- +int(0) +--- testing: -9223372036854775808 & 1 --- +int(0) +--- testing: -9223372036854775808 & -1 --- +int(-9223372036854775808) +--- testing: -9223372036854775808 & 7 --- +int(0) +--- testing: -9223372036854775808 & 9 --- +int(0) +--- testing: -9223372036854775808 & 65 --- +int(0) +--- testing: -9223372036854775808 & -44 --- +int(-9223372036854775808) +--- testing: -9223372036854775808 & 2147483647 --- +int(0) +--- testing: -9223372036854775808 & 9223372036854775807 --- +int(0) +--- testing: 2147483647 & 0 --- +int(0) +--- testing: 2147483647 & 1 --- +int(1) +--- testing: 2147483647 & -1 --- +int(2147483647) +--- testing: 2147483647 & 7 --- +int(7) +--- testing: 2147483647 & 9 --- +int(9) +--- testing: 2147483647 & 65 --- +int(65) +--- testing: 2147483647 & -44 --- +int(2147483604) +--- testing: 2147483647 & 2147483647 --- +int(2147483647) +--- testing: 2147483647 & 9223372036854775807 --- +int(2147483647) +--- testing: -2147483648 & 0 --- +int(0) +--- testing: -2147483648 & 1 --- +int(0) +--- testing: -2147483648 & -1 --- +int(-2147483648) +--- testing: -2147483648 & 7 --- +int(0) +--- testing: -2147483648 & 9 --- +int(0) +--- testing: -2147483648 & 65 --- +int(0) +--- testing: -2147483648 & -44 --- +int(-2147483648) +--- testing: -2147483648 & 2147483647 --- +int(0) +--- testing: -2147483648 & 9223372036854775807 --- +int(9223372034707292160) +--- testing: 9223372034707292160 & 0 --- +int(0) +--- testing: 9223372034707292160 & 1 --- +int(0) +--- testing: 9223372034707292160 & -1 --- +int(9223372034707292160) +--- testing: 9223372034707292160 & 7 --- +int(0) +--- testing: 9223372034707292160 & 9 --- +int(0) +--- testing: 9223372034707292160 & 65 --- +int(0) +--- testing: 9223372034707292160 & -44 --- +int(9223372034707292160) +--- testing: 9223372034707292160 & 2147483647 --- +int(0) +--- testing: 9223372034707292160 & 9223372036854775807 --- +int(9223372034707292160) +--- testing: -9223372034707292160 & 0 --- +int(0) +--- testing: -9223372034707292160 & 1 --- +int(0) +--- testing: -9223372034707292160 & -1 --- +int(-9223372034707292160) +--- testing: -9223372034707292160 & 7 --- +int(0) +--- testing: -9223372034707292160 & 9 --- +int(0) +--- testing: -9223372034707292160 & 65 --- +int(0) +--- testing: -9223372034707292160 & -44 --- +int(-9223372034707292160) +--- testing: -9223372034707292160 & 2147483647 --- +int(0) +--- testing: -9223372034707292160 & 9223372036854775807 --- +int(2147483648) +--- testing: 2147483648 & 0 --- +int(0) +--- testing: 2147483648 & 1 --- +int(0) +--- testing: 2147483648 & -1 --- +int(2147483648) +--- testing: 2147483648 & 7 --- +int(0) +--- testing: 2147483648 & 9 --- +int(0) +--- testing: 2147483648 & 65 --- +int(0) +--- testing: 2147483648 & -44 --- +int(2147483648) +--- testing: 2147483648 & 2147483647 --- +int(0) +--- testing: 2147483648 & 9223372036854775807 --- +int(2147483648) +--- testing: -2147483649 & 0 --- +int(0) +--- testing: -2147483649 & 1 --- +int(1) +--- testing: -2147483649 & -1 --- +int(-2147483649) +--- testing: -2147483649 & 7 --- +int(7) +--- testing: -2147483649 & 9 --- +int(9) +--- testing: -2147483649 & 65 --- +int(65) +--- testing: -2147483649 & -44 --- +int(-2147483692) +--- testing: -2147483649 & 2147483647 --- +int(2147483647) +--- testing: -2147483649 & 9223372036854775807 --- +int(9223372034707292159) +--- testing: 4294967294 & 0 --- +int(0) +--- testing: 4294967294 & 1 --- +int(0) +--- testing: 4294967294 & -1 --- +int(4294967294) +--- testing: 4294967294 & 7 --- +int(6) +--- testing: 4294967294 & 9 --- +int(8) +--- testing: 4294967294 & 65 --- +int(64) +--- testing: 4294967294 & -44 --- +int(4294967252) +--- testing: 4294967294 & 2147483647 --- +int(2147483646) +--- testing: 4294967294 & 9223372036854775807 --- +int(4294967294) +--- testing: 4294967295 & 0 --- +int(0) +--- testing: 4294967295 & 1 --- +int(1) +--- testing: 4294967295 & -1 --- +int(4294967295) +--- testing: 4294967295 & 7 --- +int(7) +--- testing: 4294967295 & 9 --- +int(9) +--- testing: 4294967295 & 65 --- +int(65) +--- testing: 4294967295 & -44 --- +int(4294967252) +--- testing: 4294967295 & 2147483647 --- +int(2147483647) +--- testing: 4294967295 & 9223372036854775807 --- +int(4294967295) +--- testing: 4294967293 & 0 --- +int(0) +--- testing: 4294967293 & 1 --- +int(1) +--- testing: 4294967293 & -1 --- +int(4294967293) +--- testing: 4294967293 & 7 --- +int(5) +--- testing: 4294967293 & 9 --- +int(9) +--- testing: 4294967293 & 65 --- +int(65) +--- testing: 4294967293 & -44 --- +int(4294967252) +--- testing: 4294967293 & 2147483647 --- +int(2147483645) +--- testing: 4294967293 & 9223372036854775807 --- +int(4294967293) +--- testing: 9223372036854775806 & 0 --- +int(0) +--- testing: 9223372036854775806 & 1 --- +int(0) +--- testing: 9223372036854775806 & -1 --- +int(9223372036854775806) +--- testing: 9223372036854775806 & 7 --- +int(6) +--- testing: 9223372036854775806 & 9 --- +int(8) +--- testing: 9223372036854775806 & 65 --- +int(64) +--- testing: 9223372036854775806 & -44 --- +int(9223372036854775764) +--- testing: 9223372036854775806 & 2147483647 --- +int(2147483646) +--- testing: 9223372036854775806 & 9223372036854775807 --- +int(9223372036854775806) +--- testing: 9.2233720368548E+18 & 0 --- +int(0) +--- testing: 9.2233720368548E+18 & 1 --- +int(0) +--- testing: 9.2233720368548E+18 & -1 --- +int(-9223372036854775808) +--- testing: 9.2233720368548E+18 & 7 --- +int(0) +--- testing: 9.2233720368548E+18 & 9 --- +int(0) +--- testing: 9.2233720368548E+18 & 65 --- +int(0) +--- testing: 9.2233720368548E+18 & -44 --- +int(-9223372036854775808) +--- testing: 9.2233720368548E+18 & 2147483647 --- +int(0) +--- testing: 9.2233720368548E+18 & 9223372036854775807 --- +int(0) +--- testing: -9223372036854775807 & 0 --- +int(0) +--- testing: -9223372036854775807 & 1 --- +int(1) +--- testing: -9223372036854775807 & -1 --- +int(-9223372036854775807) +--- testing: -9223372036854775807 & 7 --- +int(1) +--- testing: -9223372036854775807 & 9 --- +int(1) +--- testing: -9223372036854775807 & 65 --- +int(1) +--- testing: -9223372036854775807 & -44 --- +int(-9223372036854775808) +--- testing: -9223372036854775807 & 2147483647 --- +int(1) +--- testing: -9223372036854775807 & 9223372036854775807 --- +int(1) +--- testing: -9.2233720368548E+18 & 0 --- +int(0) +--- testing: -9.2233720368548E+18 & 1 --- +int(0) +--- testing: -9.2233720368548E+18 & -1 --- +int(-9223372036854775808) +--- testing: -9.2233720368548E+18 & 7 --- +int(0) +--- testing: -9.2233720368548E+18 & 9 --- +int(0) +--- testing: -9.2233720368548E+18 & 65 --- +int(0) +--- testing: -9.2233720368548E+18 & -44 --- +int(-9223372036854775808) +--- testing: -9.2233720368548E+18 & 2147483647 --- +int(0) +--- testing: -9.2233720368548E+18 & 9223372036854775807 --- +int(0) +--- testing: 0 & 9223372036854775807 --- +int(0) +--- testing: 0 & -9223372036854775808 --- +int(0) +--- testing: 0 & 2147483647 --- +int(0) +--- testing: 0 & -2147483648 --- +int(0) +--- testing: 0 & 9223372034707292160 --- +int(0) +--- testing: 0 & -9223372034707292160 --- +int(0) +--- testing: 0 & 2147483648 --- +int(0) +--- testing: 0 & -2147483649 --- +int(0) +--- testing: 0 & 4294967294 --- +int(0) +--- testing: 0 & 4294967295 --- +int(0) +--- testing: 0 & 4294967293 --- +int(0) +--- testing: 0 & 9223372036854775806 --- +int(0) +--- testing: 0 & 9.2233720368548E+18 --- +int(0) +--- testing: 0 & -9223372036854775807 --- +int(0) +--- testing: 0 & -9.2233720368548E+18 --- +int(0) +--- testing: 1 & 9223372036854775807 --- +int(1) +--- testing: 1 & -9223372036854775808 --- +int(0) +--- testing: 1 & 2147483647 --- +int(1) +--- testing: 1 & -2147483648 --- +int(0) +--- testing: 1 & 9223372034707292160 --- +int(0) +--- testing: 1 & -9223372034707292160 --- +int(0) +--- testing: 1 & 2147483648 --- +int(0) +--- testing: 1 & -2147483649 --- +int(1) +--- testing: 1 & 4294967294 --- +int(0) +--- testing: 1 & 4294967295 --- +int(1) +--- testing: 1 & 4294967293 --- +int(1) +--- testing: 1 & 9223372036854775806 --- +int(0) +--- testing: 1 & 9.2233720368548E+18 --- +int(0) +--- testing: 1 & -9223372036854775807 --- +int(1) +--- testing: 1 & -9.2233720368548E+18 --- +int(0) +--- testing: -1 & 9223372036854775807 --- +int(9223372036854775807) +--- testing: -1 & -9223372036854775808 --- +int(-9223372036854775808) +--- testing: -1 & 2147483647 --- +int(2147483647) +--- testing: -1 & -2147483648 --- +int(-2147483648) +--- testing: -1 & 9223372034707292160 --- +int(9223372034707292160) +--- testing: -1 & -9223372034707292160 --- +int(-9223372034707292160) +--- testing: -1 & 2147483648 --- +int(2147483648) +--- testing: -1 & -2147483649 --- +int(-2147483649) +--- testing: -1 & 4294967294 --- +int(4294967294) +--- testing: -1 & 4294967295 --- +int(4294967295) +--- testing: -1 & 4294967293 --- +int(4294967293) +--- testing: -1 & 9223372036854775806 --- +int(9223372036854775806) +--- testing: -1 & 9.2233720368548E+18 --- +int(-9223372036854775808) +--- testing: -1 & -9223372036854775807 --- +int(-9223372036854775807) +--- testing: -1 & -9.2233720368548E+18 --- +int(-9223372036854775808) +--- testing: 7 & 9223372036854775807 --- +int(7) +--- testing: 7 & -9223372036854775808 --- +int(0) +--- testing: 7 & 2147483647 --- +int(7) +--- testing: 7 & -2147483648 --- +int(0) +--- testing: 7 & 9223372034707292160 --- +int(0) +--- testing: 7 & -9223372034707292160 --- +int(0) +--- testing: 7 & 2147483648 --- +int(0) +--- testing: 7 & -2147483649 --- +int(7) +--- testing: 7 & 4294967294 --- +int(6) +--- testing: 7 & 4294967295 --- +int(7) +--- testing: 7 & 4294967293 --- +int(5) +--- testing: 7 & 9223372036854775806 --- +int(6) +--- testing: 7 & 9.2233720368548E+18 --- +int(0) +--- testing: 7 & -9223372036854775807 --- +int(1) +--- testing: 7 & -9.2233720368548E+18 --- +int(0) +--- testing: 9 & 9223372036854775807 --- +int(9) +--- testing: 9 & -9223372036854775808 --- +int(0) +--- testing: 9 & 2147483647 --- +int(9) +--- testing: 9 & -2147483648 --- +int(0) +--- testing: 9 & 9223372034707292160 --- +int(0) +--- testing: 9 & -9223372034707292160 --- +int(0) +--- testing: 9 & 2147483648 --- +int(0) +--- testing: 9 & -2147483649 --- +int(9) +--- testing: 9 & 4294967294 --- +int(8) +--- testing: 9 & 4294967295 --- +int(9) +--- testing: 9 & 4294967293 --- +int(9) +--- testing: 9 & 9223372036854775806 --- +int(8) +--- testing: 9 & 9.2233720368548E+18 --- +int(0) +--- testing: 9 & -9223372036854775807 --- +int(1) +--- testing: 9 & -9.2233720368548E+18 --- +int(0) +--- testing: 65 & 9223372036854775807 --- +int(65) +--- testing: 65 & -9223372036854775808 --- +int(0) +--- testing: 65 & 2147483647 --- +int(65) +--- testing: 65 & -2147483648 --- +int(0) +--- testing: 65 & 9223372034707292160 --- +int(0) +--- testing: 65 & -9223372034707292160 --- +int(0) +--- testing: 65 & 2147483648 --- +int(0) +--- testing: 65 & -2147483649 --- +int(65) +--- testing: 65 & 4294967294 --- +int(64) +--- testing: 65 & 4294967295 --- +int(65) +--- testing: 65 & 4294967293 --- +int(65) +--- testing: 65 & 9223372036854775806 --- +int(64) +--- testing: 65 & 9.2233720368548E+18 --- +int(0) +--- testing: 65 & -9223372036854775807 --- +int(1) +--- testing: 65 & -9.2233720368548E+18 --- +int(0) +--- testing: -44 & 9223372036854775807 --- +int(9223372036854775764) +--- testing: -44 & -9223372036854775808 --- +int(-9223372036854775808) +--- testing: -44 & 2147483647 --- +int(2147483604) +--- testing: -44 & -2147483648 --- +int(-2147483648) +--- testing: -44 & 9223372034707292160 --- +int(9223372034707292160) +--- testing: -44 & -9223372034707292160 --- +int(-9223372034707292160) +--- testing: -44 & 2147483648 --- +int(2147483648) +--- testing: -44 & -2147483649 --- +int(-2147483692) +--- testing: -44 & 4294967294 --- +int(4294967252) +--- testing: -44 & 4294967295 --- +int(4294967252) +--- testing: -44 & 4294967293 --- +int(4294967252) +--- testing: -44 & 9223372036854775806 --- +int(9223372036854775764) +--- testing: -44 & 9.2233720368548E+18 --- +int(-9223372036854775808) +--- testing: -44 & -9223372036854775807 --- +int(-9223372036854775808) +--- testing: -44 & -9.2233720368548E+18 --- +int(-9223372036854775808) +--- testing: 2147483647 & 9223372036854775807 --- +int(2147483647) +--- testing: 2147483647 & -9223372036854775808 --- +int(0) +--- testing: 2147483647 & 2147483647 --- +int(2147483647) +--- testing: 2147483647 & -2147483648 --- +int(0) +--- testing: 2147483647 & 9223372034707292160 --- +int(0) +--- testing: 2147483647 & -9223372034707292160 --- +int(0) +--- testing: 2147483647 & 2147483648 --- +int(0) +--- testing: 2147483647 & -2147483649 --- +int(2147483647) +--- testing: 2147483647 & 4294967294 --- +int(2147483646) +--- testing: 2147483647 & 4294967295 --- +int(2147483647) +--- testing: 2147483647 & 4294967293 --- +int(2147483645) +--- testing: 2147483647 & 9223372036854775806 --- +int(2147483646) +--- testing: 2147483647 & 9.2233720368548E+18 --- +int(0) +--- testing: 2147483647 & -9223372036854775807 --- +int(1) +--- testing: 2147483647 & -9.2233720368548E+18 --- +int(0) +--- testing: 9223372036854775807 & 9223372036854775807 --- +int(9223372036854775807) +--- testing: 9223372036854775807 & -9223372036854775808 --- +int(0) +--- testing: 9223372036854775807 & 2147483647 --- +int(2147483647) +--- testing: 9223372036854775807 & -2147483648 --- +int(9223372034707292160) +--- testing: 9223372036854775807 & 9223372034707292160 --- +int(9223372034707292160) +--- testing: 9223372036854775807 & -9223372034707292160 --- +int(2147483648) +--- testing: 9223372036854775807 & 2147483648 --- +int(2147483648) +--- testing: 9223372036854775807 & -2147483649 --- +int(9223372034707292159) +--- testing: 9223372036854775807 & 4294967294 --- +int(4294967294) +--- testing: 9223372036854775807 & 4294967295 --- +int(4294967295) +--- testing: 9223372036854775807 & 4294967293 --- +int(4294967293) +--- testing: 9223372036854775807 & 9223372036854775806 --- +int(9223372036854775806) +--- testing: 9223372036854775807 & 9.2233720368548E+18 --- +int(0) +--- testing: 9223372036854775807 & -9223372036854775807 --- +int(1) +--- testing: 9223372036854775807 & -9.2233720368548E+18 --- +int(0) +===DONE===
\ No newline at end of file diff --git a/tests/lang/operators/bitwiseAnd_variationStr.phpt b/tests/lang/operators/bitwiseAnd_variationStr.phpt new file mode 100644 index 0000000..2602270 --- /dev/null +++ b/tests/lang/operators/bitwiseAnd_variationStr.phpt @@ -0,0 +1,416 @@ +--TEST--
+Test & operator : various numbers as strings
+--FILE--
+<?php
+
+$strVals = array(
+ "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",
+ "a5.9"
+);
+
+error_reporting(E_ERROR);
+
+foreach ($strVals as $strVal) {
+ foreach($strVals as $otherVal) {
+ echo "--- testing: '$strVal' & '$otherVal' ---\n";
+ var_dump(bin2hex($strVal&$otherVal));
+ }
+}
+
+
+?>
+===DONE===
+--EXPECT--
+--- testing: '0' & '0' --- +string(2) "30" +--- testing: '0' & '65' --- +string(2) "30" +--- testing: '0' & '-44' --- +string(2) "20" +--- testing: '0' & '1.2' --- +string(2) "30" +--- testing: '0' & '-7.7' --- +string(2) "20" +--- testing: '0' & 'abc' --- +string(2) "20" +--- testing: '0' & '123abc' --- +string(2) "30" +--- testing: '0' & '123e5' --- +string(2) "30" +--- testing: '0' & '123e5xyz' --- +string(2) "30" +--- testing: '0' & ' 123abc' --- +string(2) "20" +--- testing: '0' & '123 abc' --- +string(2) "30" +--- testing: '0' & '123abc ' --- +string(2) "30" +--- testing: '0' & '3.4a' --- +string(2) "30" +--- testing: '0' & 'a5.9' --- +string(2) "20" +--- testing: '65' & '0' --- +string(2) "30" +--- testing: '65' & '65' --- +string(4) "3635" +--- testing: '65' & '-44' --- +string(4) "2434" +--- testing: '65' & '1.2' --- +string(4) "3024" +--- testing: '65' & '-7.7' --- +string(4) "2435" +--- testing: '65' & 'abc' --- +string(4) "2020" +--- testing: '65' & '123abc' --- +string(4) "3030" +--- testing: '65' & '123e5' --- +string(4) "3030" +--- testing: '65' & '123e5xyz' --- +string(4) "3030" +--- testing: '65' & ' 123abc' --- +string(4) "2031" +--- testing: '65' & '123 abc' --- +string(4) "3030" +--- testing: '65' & '123abc ' --- +string(4) "3030" +--- testing: '65' & '3.4a' --- +string(4) "3224" +--- testing: '65' & 'a5.9' --- +string(4) "2035" +--- testing: '-44' & '0' --- +string(2) "20" +--- testing: '-44' & '65' --- +string(4) "2434" +--- testing: '-44' & '-44' --- +string(6) "2d3434" +--- testing: '-44' & '1.2' --- +string(6) "212430" +--- testing: '-44' & '-7.7' --- +string(6) "2d3424" +--- testing: '-44' & 'abc' --- +string(6) "212020" +--- testing: '-44' & '123abc' --- +string(6) "213030" +--- testing: '-44' & '123e5' --- +string(6) "213030" +--- testing: '-44' & '123e5xyz' --- +string(6) "213030" +--- testing: '-44' & ' 123abc' --- +string(6) "203030" +--- testing: '-44' & '123 abc' --- +string(6) "213030" +--- testing: '-44' & '123abc ' --- +string(6) "213030" +--- testing: '-44' & '3.4a' --- +string(6) "212434" +--- testing: '-44' & 'a5.9' --- +string(6) "213424" +--- testing: '1.2' & '0' --- +string(2) "30" +--- testing: '1.2' & '65' --- +string(4) "3024" +--- testing: '1.2' & '-44' --- +string(6) "212430" +--- testing: '1.2' & '1.2' --- +string(6) "312e32" +--- testing: '1.2' & '-7.7' --- +string(6) "212622" +--- testing: '1.2' & 'abc' --- +string(6) "212222" +--- testing: '1.2' & '123abc' --- +string(6) "312232" +--- testing: '1.2' & '123e5' --- +string(6) "312232" +--- testing: '1.2' & '123e5xyz' --- +string(6) "312232" +--- testing: '1.2' & ' 123abc' --- +string(6) "202032" +--- testing: '1.2' & '123 abc' --- +string(6) "312232" +--- testing: '1.2' & '123abc ' --- +string(6) "312232" +--- testing: '1.2' & '3.4a' --- +string(6) "312e30" +--- testing: '1.2' & 'a5.9' --- +string(6) "212422" +--- testing: '-7.7' & '0' --- +string(2) "20" +--- testing: '-7.7' & '65' --- +string(4) "2435" +--- testing: '-7.7' & '-44' --- +string(6) "2d3424" +--- testing: '-7.7' & '1.2' --- +string(6) "212622" +--- testing: '-7.7' & '-7.7' --- +string(8) "2d372e37" +--- testing: '-7.7' & 'abc' --- +string(6) "212222" +--- testing: '-7.7' & '123abc' --- +string(8) "21322221" +--- testing: '-7.7' & '123e5' --- +string(8) "21322225" +--- testing: '-7.7' & '123e5xyz' --- +string(8) "21322225" +--- testing: '-7.7' & ' 123abc' --- +string(8) "20312233" +--- testing: '-7.7' & '123 abc' --- +string(8) "21322220" +--- testing: '-7.7' & '123abc ' --- +string(8) "21322221" +--- testing: '-7.7' & '3.4a' --- +string(8) "21262421" +--- testing: '-7.7' & 'a5.9' --- +string(8) "21352e31" +--- testing: 'abc' & '0' --- +string(2) "20" +--- testing: 'abc' & '65' --- +string(4) "2020" +--- testing: 'abc' & '-44' --- +string(6) "212020" +--- testing: 'abc' & '1.2' --- +string(6) "212222" +--- testing: 'abc' & '-7.7' --- +string(6) "212222" +--- testing: 'abc' & 'abc' --- +string(6) "616263" +--- testing: 'abc' & '123abc' --- +string(6) "212223" +--- testing: 'abc' & '123e5' --- +string(6) "212223" +--- testing: 'abc' & '123e5xyz' --- +string(6) "212223" +--- testing: 'abc' & ' 123abc' --- +string(6) "202022" +--- testing: 'abc' & '123 abc' --- +string(6) "212223" +--- testing: 'abc' & '123abc ' --- +string(6) "212223" +--- testing: 'abc' & '3.4a' --- +string(6) "212220" +--- testing: 'abc' & 'a5.9' --- +string(6) "612022" +--- testing: '123abc' & '0' --- +string(2) "30" +--- testing: '123abc' & '65' --- +string(4) "3030" +--- testing: '123abc' & '-44' --- +string(6) "213030" +--- testing: '123abc' & '1.2' --- +string(6) "312232" +--- testing: '123abc' & '-7.7' --- +string(8) "21322221" +--- testing: '123abc' & 'abc' --- +string(6) "212223" +--- testing: '123abc' & '123abc' --- +string(12) "313233616263" +--- testing: '123abc' & '123e5' --- +string(10) "3132336120" +--- testing: '123abc' & '123e5xyz' --- +string(12) "313233612060" +--- testing: '123abc' & ' 123abc' --- +string(12) "203032216062" +--- testing: '123abc' & '123 abc' --- +string(12) "313233206062" +--- testing: '123abc' & '123abc ' --- +string(12) "313233616263" +--- testing: '123abc' & '3.4a' --- +string(8) "31223061" +--- testing: '123abc' & 'a5.9' --- +string(8) "21302221" +--- testing: '123e5' & '0' --- +string(2) "30" +--- testing: '123e5' & '65' --- +string(4) "3030" +--- testing: '123e5' & '-44' --- +string(6) "213030" +--- testing: '123e5' & '1.2' --- +string(6) "312232" +--- testing: '123e5' & '-7.7' --- +string(8) "21322225" +--- testing: '123e5' & 'abc' --- +string(6) "212223" +--- testing: '123e5' & '123abc' --- +string(10) "3132336120" +--- testing: '123e5' & '123e5' --- +string(10) "3132336535" +--- testing: '123e5' & '123e5xyz' --- +string(10) "3132336535" +--- testing: '123e5' & ' 123abc' --- +string(10) "2030322121" +--- testing: '123e5' & '123 abc' --- +string(10) "3132332021" +--- testing: '123e5' & '123abc ' --- +string(10) "3132336120" +--- testing: '123e5' & '3.4a' --- +string(8) "31223061" +--- testing: '123e5' & 'a5.9' --- +string(8) "21302221" +--- testing: '123e5xyz' & '0' --- +string(2) "30" +--- testing: '123e5xyz' & '65' --- +string(4) "3030" +--- testing: '123e5xyz' & '-44' --- +string(6) "213030" +--- testing: '123e5xyz' & '1.2' --- +string(6) "312232" +--- testing: '123e5xyz' & '-7.7' --- +string(8) "21322225" +--- testing: '123e5xyz' & 'abc' --- +string(6) "212223" +--- testing: '123e5xyz' & '123abc' --- +string(12) "313233612060" +--- testing: '123e5xyz' & '123e5' --- +string(10) "3132336535" +--- testing: '123e5xyz' & '123e5xyz' --- +string(16) "313233653578797a" +--- testing: '123e5xyz' & ' 123abc' --- +string(14) "20303221216061" +--- testing: '123e5xyz' & '123 abc' --- +string(14) "31323320216061" +--- testing: '123e5xyz' & '123abc ' --- +string(14) "31323361206020" +--- testing: '123e5xyz' & '3.4a' --- +string(8) "31223061" +--- testing: '123e5xyz' & 'a5.9' --- +string(8) "21302221" +--- testing: ' 123abc' & '0' --- +string(2) "20" +--- testing: ' 123abc' & '65' --- +string(4) "2031" +--- testing: ' 123abc' & '-44' --- +string(6) "203030" +--- testing: ' 123abc' & '1.2' --- +string(6) "202032" +--- testing: ' 123abc' & '-7.7' --- +string(8) "20312233" +--- testing: ' 123abc' & 'abc' --- +string(6) "202022" +--- testing: ' 123abc' & '123abc' --- +string(12) "203032216062" +--- testing: ' 123abc' & '123e5' --- +string(10) "2030322121" +--- testing: ' 123abc' & '123e5xyz' --- +string(14) "20303221216061" +--- testing: ' 123abc' & ' 123abc' --- +string(14) "20313233616263" +--- testing: ' 123abc' & '123 abc' --- +string(14) "20303220616263" +--- testing: ' 123abc' & '123abc ' --- +string(14) "20303221606220" +--- testing: ' 123abc' & '3.4a' --- +string(8) "20203021" +--- testing: ' 123abc' & 'a5.9' --- +string(8) "20312231" +--- testing: '123 abc' & '0' --- +string(2) "30" +--- testing: '123 abc' & '65' --- +string(4) "3030" +--- testing: '123 abc' & '-44' --- +string(6) "213030" +--- testing: '123 abc' & '1.2' --- +string(6) "312232" +--- testing: '123 abc' & '-7.7' --- +string(8) "21322220" +--- testing: '123 abc' & 'abc' --- +string(6) "212223" +--- testing: '123 abc' & '123abc' --- +string(12) "313233206062" +--- testing: '123 abc' & '123e5' --- +string(10) "3132332021" +--- testing: '123 abc' & '123e5xyz' --- +string(14) "31323320216061" +--- testing: '123 abc' & ' 123abc' --- +string(14) "20303220616263" +--- testing: '123 abc' & '123 abc' --- +string(14) "31323320616263" +--- testing: '123 abc' & '123abc ' --- +string(14) "31323320606220" +--- testing: '123 abc' & '3.4a' --- +string(8) "31223020" +--- testing: '123 abc' & 'a5.9' --- +string(8) "21302220" +--- testing: '123abc ' & '0' --- +string(2) "30" +--- testing: '123abc ' & '65' --- +string(4) "3030" +--- testing: '123abc ' & '-44' --- +string(6) "213030" +--- testing: '123abc ' & '1.2' --- +string(6) "312232" +--- testing: '123abc ' & '-7.7' --- +string(8) "21322221" +--- testing: '123abc ' & 'abc' --- +string(6) "212223" +--- testing: '123abc ' & '123abc' --- +string(12) "313233616263" +--- testing: '123abc ' & '123e5' --- +string(10) "3132336120" +--- testing: '123abc ' & '123e5xyz' --- +string(14) "31323361206020" +--- testing: '123abc ' & ' 123abc' --- +string(14) "20303221606220" +--- testing: '123abc ' & '123 abc' --- +string(14) "31323320606220" +--- testing: '123abc ' & '123abc ' --- +string(14) "31323361626320" +--- testing: '123abc ' & '3.4a' --- +string(8) "31223061" +--- testing: '123abc ' & 'a5.9' --- +string(8) "21302221" +--- testing: '3.4a' & '0' --- +string(2) "30" +--- testing: '3.4a' & '65' --- +string(4) "3224" +--- testing: '3.4a' & '-44' --- +string(6) "212434" +--- testing: '3.4a' & '1.2' --- +string(6) "312e30" +--- testing: '3.4a' & '-7.7' --- +string(8) "21262421" +--- testing: '3.4a' & 'abc' --- +string(6) "212220" +--- testing: '3.4a' & '123abc' --- +string(8) "31223061" +--- testing: '3.4a' & '123e5' --- +string(8) "31223061" +--- testing: '3.4a' & '123e5xyz' --- +string(8) "31223061" +--- testing: '3.4a' & ' 123abc' --- +string(8) "20203021" +--- testing: '3.4a' & '123 abc' --- +string(8) "31223020" +--- testing: '3.4a' & '123abc ' --- +string(8) "31223061" +--- testing: '3.4a' & '3.4a' --- +string(8) "332e3461" +--- testing: '3.4a' & 'a5.9' --- +string(8) "21242421" +--- testing: 'a5.9' & '0' --- +string(2) "20" +--- testing: 'a5.9' & '65' --- +string(4) "2035" +--- testing: 'a5.9' & '-44' --- +string(6) "213424" +--- testing: 'a5.9' & '1.2' --- +string(6) "212422" +--- testing: 'a5.9' & '-7.7' --- +string(8) "21352e31" +--- testing: 'a5.9' & 'abc' --- +string(6) "612022" +--- testing: 'a5.9' & '123abc' --- +string(8) "21302221" +--- testing: 'a5.9' & '123e5' --- +string(8) "21302221" +--- testing: 'a5.9' & '123e5xyz' --- +string(8) "21302221" +--- testing: 'a5.9' & ' 123abc' --- +string(8) "20312231" +--- testing: 'a5.9' & '123 abc' --- +string(8) "21302220" +--- testing: 'a5.9' & '123abc ' --- +string(8) "21302221" +--- testing: 'a5.9' & '3.4a' --- +string(8) "21242421" +--- testing: 'a5.9' & 'a5.9' --- +string(8) "61352e39"
+===DONE===
diff --git a/tests/lang/operators/bitwiseNot_basiclong_64bit.phpt b/tests/lang/operators/bitwiseNot_basiclong_64bit.phpt new file mode 100644 index 0000000..227b734 --- /dev/null +++ b/tests/lang/operators/bitwiseNot_basiclong_64bit.phpt @@ -0,0 +1,60 @@ +--TEST-- +Test ~N operator : 64bit long tests +--SKIPIF-- +<?php +if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); +?> +--FILE-- +<?php + +define("MAX_64Bit", 9223372036854775807); +define("MAX_32Bit", 2147483647); +define("MIN_64Bit", -9223372036854775807 - 1); +define("MIN_32Bit", -2147483647 - 1); + +$longVals = array( + MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit, + MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1, + MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1 +); + + +foreach ($longVals as $longVal) { + echo "--- testing: $longVal ---\n"; + var_dump(~$longVal); +} + +?> +===DONE=== +--EXPECT-- +--- testing: 9223372036854775807 --- +int(-9223372036854775808) +--- testing: -9223372036854775808 --- +int(9223372036854775807) +--- testing: 2147483647 --- +int(-2147483648) +--- testing: -2147483648 --- +int(2147483647) +--- testing: 9223372034707292160 --- +int(-9223372034707292161) +--- testing: -9223372034707292160 --- +int(9223372034707292159) +--- testing: 2147483648 --- +int(-2147483649) +--- testing: -2147483649 --- +int(2147483648) +--- testing: 4294967294 --- +int(-4294967295) +--- testing: 4294967295 --- +int(-4294967296) +--- testing: 4294967293 --- +int(-4294967294) +--- testing: 9223372036854775806 --- +int(-9223372036854775807) +--- testing: 9.2233720368548E+18 --- +int(9223372036854775807) +--- testing: -9223372036854775807 --- +int(9223372036854775806) +--- testing: -9.2233720368548E+18 --- +int(9223372036854775807) +===DONE===
\ No newline at end of file diff --git a/tests/lang/operators/bitwiseNot_variationStr.phpt b/tests/lang/operators/bitwiseNot_variationStr.phpt new file mode 100644 index 0000000..3e7b698 --- /dev/null +++ b/tests/lang/operators/bitwiseNot_variationStr.phpt @@ -0,0 +1,48 @@ +--TEST--
+Test ~N operator : various numbers as strings
+--FILE--
+<?php
+
+$strVals = array(
+ "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",
+ "a5.9"
+);
+
+
+foreach ($strVals as $strVal) {
+ echo "--- testing: '$strVal' ---\n";
+ var_dump(bin2hex(~$strVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: '0' --- +string(2) "cf" +--- testing: '65' --- +string(4) "c9ca" +--- testing: '-44' --- +string(6) "d2cbcb" +--- testing: '1.2' --- +string(6) "ced1cd" +--- testing: '-7.7' --- +string(8) "d2c8d1c8" +--- testing: 'abc' --- +string(6) "9e9d9c" +--- testing: '123abc' --- +string(12) "cecdcc9e9d9c" +--- testing: '123e5' --- +string(10) "cecdcc9aca" +--- testing: '123e5xyz' --- +string(16) "cecdcc9aca878685" +--- testing: ' 123abc' --- +string(14) "dfcecdcc9e9d9c" +--- testing: '123 abc' --- +string(14) "cecdccdf9e9d9c" +--- testing: '123abc ' --- +string(14) "cecdcc9e9d9cdf" +--- testing: '3.4a' --- +string(8) "ccd1cb9e" +--- testing: 'a5.9' --- +string(8) "9ecad1c6"
+===DONE===
diff --git a/tests/lang/operators/bitwiseOr_basiclong_64bit.phpt b/tests/lang/operators/bitwiseOr_basiclong_64bit.phpt new file mode 100644 index 0000000..e26d46a --- /dev/null +++ b/tests/lang/operators/bitwiseOr_basiclong_64bit.phpt @@ -0,0 +1,583 @@ +--TEST-- +Test | operator : 64bit long tests +--SKIPIF-- +<?php +if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); +?> +--FILE-- +<?php + +define("MAX_64Bit", 9223372036854775807); +define("MAX_32Bit", 2147483647); +define("MIN_64Bit", -9223372036854775807 - 1); +define("MIN_32Bit", -2147483647 - 1); + +$longVals = array( + MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit, + MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1, + MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1 +); + +$otherVals = array(0, 1, -1, 7, 9, 65, -44, MAX_32Bit, MAX_64Bit); + +error_reporting(E_ERROR); + +foreach ($longVals as $longVal) { + foreach($otherVals as $otherVal) { + echo "--- testing: $longVal | $otherVal ---\n"; + var_dump($longVal|$otherVal); + } +} + +foreach ($otherVals as $otherVal) { + foreach($longVals as $longVal) { + echo "--- testing: $otherVal | $longVal ---\n"; + var_dump($otherVal|$longVal); + } +} + +?> +===DONE=== +--EXPECT-- +--- testing: 9223372036854775807 | 0 --- +int(9223372036854775807) +--- testing: 9223372036854775807 | 1 --- +int(9223372036854775807) +--- testing: 9223372036854775807 | -1 --- +int(-1) +--- testing: 9223372036854775807 | 7 --- +int(9223372036854775807) +--- testing: 9223372036854775807 | 9 --- +int(9223372036854775807) +--- testing: 9223372036854775807 | 65 --- +int(9223372036854775807) +--- testing: 9223372036854775807 | -44 --- +int(-1) +--- testing: 9223372036854775807 | 2147483647 --- +int(9223372036854775807) +--- testing: 9223372036854775807 | 9223372036854775807 --- +int(9223372036854775807) +--- testing: -9223372036854775808 | 0 --- +int(-9223372036854775808) +--- testing: -9223372036854775808 | 1 --- +int(-9223372036854775807) +--- testing: -9223372036854775808 | -1 --- +int(-1) +--- testing: -9223372036854775808 | 7 --- +int(-9223372036854775801) +--- testing: -9223372036854775808 | 9 --- +int(-9223372036854775799) +--- testing: -9223372036854775808 | 65 --- +int(-9223372036854775743) +--- testing: -9223372036854775808 | -44 --- +int(-44) +--- testing: -9223372036854775808 | 2147483647 --- +int(-9223372034707292161) +--- testing: -9223372036854775808 | 9223372036854775807 --- +int(-1) +--- testing: 2147483647 | 0 --- +int(2147483647) +--- testing: 2147483647 | 1 --- +int(2147483647) +--- testing: 2147483647 | -1 --- +int(-1) +--- testing: 2147483647 | 7 --- +int(2147483647) +--- testing: 2147483647 | 9 --- +int(2147483647) +--- testing: 2147483647 | 65 --- +int(2147483647) +--- testing: 2147483647 | -44 --- +int(-1) +--- testing: 2147483647 | 2147483647 --- +int(2147483647) +--- testing: 2147483647 | 9223372036854775807 --- +int(9223372036854775807) +--- testing: -2147483648 | 0 --- +int(-2147483648) +--- testing: -2147483648 | 1 --- +int(-2147483647) +--- testing: -2147483648 | -1 --- +int(-1) +--- testing: -2147483648 | 7 --- +int(-2147483641) +--- testing: -2147483648 | 9 --- +int(-2147483639) +--- testing: -2147483648 | 65 --- +int(-2147483583) +--- testing: -2147483648 | -44 --- +int(-44) +--- testing: -2147483648 | 2147483647 --- +int(-1) +--- testing: -2147483648 | 9223372036854775807 --- +int(-1) +--- testing: 9223372034707292160 | 0 --- +int(9223372034707292160) +--- testing: 9223372034707292160 | 1 --- +int(9223372034707292161) +--- testing: 9223372034707292160 | -1 --- +int(-1) +--- testing: 9223372034707292160 | 7 --- +int(9223372034707292167) +--- testing: 9223372034707292160 | 9 --- +int(9223372034707292169) +--- testing: 9223372034707292160 | 65 --- +int(9223372034707292225) +--- testing: 9223372034707292160 | -44 --- +int(-44) +--- testing: 9223372034707292160 | 2147483647 --- +int(9223372036854775807) +--- testing: 9223372034707292160 | 9223372036854775807 --- +int(9223372036854775807) +--- testing: -9223372034707292160 | 0 --- +int(-9223372034707292160) +--- testing: -9223372034707292160 | 1 --- +int(-9223372034707292159) +--- testing: -9223372034707292160 | -1 --- +int(-1) +--- testing: -9223372034707292160 | 7 --- +int(-9223372034707292153) +--- testing: -9223372034707292160 | 9 --- +int(-9223372034707292151) +--- testing: -9223372034707292160 | 65 --- +int(-9223372034707292095) +--- testing: -9223372034707292160 | -44 --- +int(-44) +--- testing: -9223372034707292160 | 2147483647 --- +int(-9223372032559808513) +--- testing: -9223372034707292160 | 9223372036854775807 --- +int(-1) +--- testing: 2147483648 | 0 --- +int(2147483648) +--- testing: 2147483648 | 1 --- +int(2147483649) +--- testing: 2147483648 | -1 --- +int(-1) +--- testing: 2147483648 | 7 --- +int(2147483655) +--- testing: 2147483648 | 9 --- +int(2147483657) +--- testing: 2147483648 | 65 --- +int(2147483713) +--- testing: 2147483648 | -44 --- +int(-44) +--- testing: 2147483648 | 2147483647 --- +int(4294967295) +--- testing: 2147483648 | 9223372036854775807 --- +int(9223372036854775807) +--- testing: -2147483649 | 0 --- +int(-2147483649) +--- testing: -2147483649 | 1 --- +int(-2147483649) +--- testing: -2147483649 | -1 --- +int(-1) +--- testing: -2147483649 | 7 --- +int(-2147483649) +--- testing: -2147483649 | 9 --- +int(-2147483649) +--- testing: -2147483649 | 65 --- +int(-2147483649) +--- testing: -2147483649 | -44 --- +int(-1) +--- testing: -2147483649 | 2147483647 --- +int(-2147483649) +--- testing: -2147483649 | 9223372036854775807 --- +int(-1) +--- testing: 4294967294 | 0 --- +int(4294967294) +--- testing: 4294967294 | 1 --- +int(4294967295) +--- testing: 4294967294 | -1 --- +int(-1) +--- testing: 4294967294 | 7 --- +int(4294967295) +--- testing: 4294967294 | 9 --- +int(4294967295) +--- testing: 4294967294 | 65 --- +int(4294967295) +--- testing: 4294967294 | -44 --- +int(-2) +--- testing: 4294967294 | 2147483647 --- +int(4294967295) +--- testing: 4294967294 | 9223372036854775807 --- +int(9223372036854775807) +--- testing: 4294967295 | 0 --- +int(4294967295) +--- testing: 4294967295 | 1 --- +int(4294967295) +--- testing: 4294967295 | -1 --- +int(-1) +--- testing: 4294967295 | 7 --- +int(4294967295) +--- testing: 4294967295 | 9 --- +int(4294967295) +--- testing: 4294967295 | 65 --- +int(4294967295) +--- testing: 4294967295 | -44 --- +int(-1) +--- testing: 4294967295 | 2147483647 --- +int(4294967295) +--- testing: 4294967295 | 9223372036854775807 --- +int(9223372036854775807) +--- testing: 4294967293 | 0 --- +int(4294967293) +--- testing: 4294967293 | 1 --- +int(4294967293) +--- testing: 4294967293 | -1 --- +int(-1) +--- testing: 4294967293 | 7 --- +int(4294967295) +--- testing: 4294967293 | 9 --- +int(4294967293) +--- testing: 4294967293 | 65 --- +int(4294967293) +--- testing: 4294967293 | -44 --- +int(-3) +--- testing: 4294967293 | 2147483647 --- +int(4294967295) +--- testing: 4294967293 | 9223372036854775807 --- +int(9223372036854775807) +--- testing: 9223372036854775806 | 0 --- +int(9223372036854775806) +--- testing: 9223372036854775806 | 1 --- +int(9223372036854775807) +--- testing: 9223372036854775806 | -1 --- +int(-1) +--- testing: 9223372036854775806 | 7 --- +int(9223372036854775807) +--- testing: 9223372036854775806 | 9 --- +int(9223372036854775807) +--- testing: 9223372036854775806 | 65 --- +int(9223372036854775807) +--- testing: 9223372036854775806 | -44 --- +int(-2) +--- testing: 9223372036854775806 | 2147483647 --- +int(9223372036854775807) +--- testing: 9223372036854775806 | 9223372036854775807 --- +int(9223372036854775807) +--- testing: 9.2233720368548E+18 | 0 --- +int(-9223372036854775808) +--- testing: 9.2233720368548E+18 | 1 --- +int(-9223372036854775807) +--- testing: 9.2233720368548E+18 | -1 --- +int(-1) +--- testing: 9.2233720368548E+18 | 7 --- +int(-9223372036854775801) +--- testing: 9.2233720368548E+18 | 9 --- +int(-9223372036854775799) +--- testing: 9.2233720368548E+18 | 65 --- +int(-9223372036854775743) +--- testing: 9.2233720368548E+18 | -44 --- +int(-44) +--- testing: 9.2233720368548E+18 | 2147483647 --- +int(-9223372034707292161) +--- testing: 9.2233720368548E+18 | 9223372036854775807 --- +int(-1) +--- testing: -9223372036854775807 | 0 --- +int(-9223372036854775807) +--- testing: -9223372036854775807 | 1 --- +int(-9223372036854775807) +--- testing: -9223372036854775807 | -1 --- +int(-1) +--- testing: -9223372036854775807 | 7 --- +int(-9223372036854775801) +--- testing: -9223372036854775807 | 9 --- +int(-9223372036854775799) +--- testing: -9223372036854775807 | 65 --- +int(-9223372036854775743) +--- testing: -9223372036854775807 | -44 --- +int(-43) +--- testing: -9223372036854775807 | 2147483647 --- +int(-9223372034707292161) +--- testing: -9223372036854775807 | 9223372036854775807 --- +int(-1) +--- testing: -9.2233720368548E+18 | 0 --- +int(-9223372036854775808) +--- testing: -9.2233720368548E+18 | 1 --- +int(-9223372036854775807) +--- testing: -9.2233720368548E+18 | -1 --- +int(-1) +--- testing: -9.2233720368548E+18 | 7 --- +int(-9223372036854775801) +--- testing: -9.2233720368548E+18 | 9 --- +int(-9223372036854775799) +--- testing: -9.2233720368548E+18 | 65 --- +int(-9223372036854775743) +--- testing: -9.2233720368548E+18 | -44 --- +int(-44) +--- testing: -9.2233720368548E+18 | 2147483647 --- +int(-9223372034707292161) +--- testing: -9.2233720368548E+18 | 9223372036854775807 --- +int(-1) +--- testing: 0 | 9223372036854775807 --- +int(9223372036854775807) +--- testing: 0 | -9223372036854775808 --- +int(-9223372036854775808) +--- testing: 0 | 2147483647 --- +int(2147483647) +--- testing: 0 | -2147483648 --- +int(-2147483648) +--- testing: 0 | 9223372034707292160 --- +int(9223372034707292160) +--- testing: 0 | -9223372034707292160 --- +int(-9223372034707292160) +--- testing: 0 | 2147483648 --- +int(2147483648) +--- testing: 0 | -2147483649 --- +int(-2147483649) +--- testing: 0 | 4294967294 --- +int(4294967294) +--- testing: 0 | 4294967295 --- +int(4294967295) +--- testing: 0 | 4294967293 --- +int(4294967293) +--- testing: 0 | 9223372036854775806 --- +int(9223372036854775806) +--- testing: 0 | 9.2233720368548E+18 --- +int(-9223372036854775808) +--- testing: 0 | -9223372036854775807 --- +int(-9223372036854775807) +--- testing: 0 | -9.2233720368548E+18 --- +int(-9223372036854775808) +--- testing: 1 | 9223372036854775807 --- +int(9223372036854775807) +--- testing: 1 | -9223372036854775808 --- +int(-9223372036854775807) +--- testing: 1 | 2147483647 --- +int(2147483647) +--- testing: 1 | -2147483648 --- +int(-2147483647) +--- testing: 1 | 9223372034707292160 --- +int(9223372034707292161) +--- testing: 1 | -9223372034707292160 --- +int(-9223372034707292159) +--- testing: 1 | 2147483648 --- +int(2147483649) +--- testing: 1 | -2147483649 --- +int(-2147483649) +--- testing: 1 | 4294967294 --- +int(4294967295) +--- testing: 1 | 4294967295 --- +int(4294967295) +--- testing: 1 | 4294967293 --- +int(4294967293) +--- testing: 1 | 9223372036854775806 --- +int(9223372036854775807) +--- testing: 1 | 9.2233720368548E+18 --- +int(-9223372036854775807) +--- testing: 1 | -9223372036854775807 --- +int(-9223372036854775807) +--- testing: 1 | -9.2233720368548E+18 --- +int(-9223372036854775807) +--- testing: -1 | 9223372036854775807 --- +int(-1) +--- testing: -1 | -9223372036854775808 --- +int(-1) +--- testing: -1 | 2147483647 --- +int(-1) +--- testing: -1 | -2147483648 --- +int(-1) +--- testing: -1 | 9223372034707292160 --- +int(-1) +--- testing: -1 | -9223372034707292160 --- +int(-1) +--- testing: -1 | 2147483648 --- +int(-1) +--- testing: -1 | -2147483649 --- +int(-1) +--- testing: -1 | 4294967294 --- +int(-1) +--- testing: -1 | 4294967295 --- +int(-1) +--- testing: -1 | 4294967293 --- +int(-1) +--- testing: -1 | 9223372036854775806 --- +int(-1) +--- testing: -1 | 9.2233720368548E+18 --- +int(-1) +--- testing: -1 | -9223372036854775807 --- +int(-1) +--- testing: -1 | -9.2233720368548E+18 --- +int(-1) +--- testing: 7 | 9223372036854775807 --- +int(9223372036854775807) +--- testing: 7 | -9223372036854775808 --- +int(-9223372036854775801) +--- testing: 7 | 2147483647 --- +int(2147483647) +--- testing: 7 | -2147483648 --- +int(-2147483641) +--- testing: 7 | 9223372034707292160 --- +int(9223372034707292167) +--- testing: 7 | -9223372034707292160 --- +int(-9223372034707292153) +--- testing: 7 | 2147483648 --- +int(2147483655) +--- testing: 7 | -2147483649 --- +int(-2147483649) +--- testing: 7 | 4294967294 --- +int(4294967295) +--- testing: 7 | 4294967295 --- +int(4294967295) +--- testing: 7 | 4294967293 --- +int(4294967295) +--- testing: 7 | 9223372036854775806 --- +int(9223372036854775807) +--- testing: 7 | 9.2233720368548E+18 --- +int(-9223372036854775801) +--- testing: 7 | -9223372036854775807 --- +int(-9223372036854775801) +--- testing: 7 | -9.2233720368548E+18 --- +int(-9223372036854775801) +--- testing: 9 | 9223372036854775807 --- +int(9223372036854775807) +--- testing: 9 | -9223372036854775808 --- +int(-9223372036854775799) +--- testing: 9 | 2147483647 --- +int(2147483647) +--- testing: 9 | -2147483648 --- +int(-2147483639) +--- testing: 9 | 9223372034707292160 --- +int(9223372034707292169) +--- testing: 9 | -9223372034707292160 --- +int(-9223372034707292151) +--- testing: 9 | 2147483648 --- +int(2147483657) +--- testing: 9 | -2147483649 --- +int(-2147483649) +--- testing: 9 | 4294967294 --- +int(4294967295) +--- testing: 9 | 4294967295 --- +int(4294967295) +--- testing: 9 | 4294967293 --- +int(4294967293) +--- testing: 9 | 9223372036854775806 --- +int(9223372036854775807) +--- testing: 9 | 9.2233720368548E+18 --- +int(-9223372036854775799) +--- testing: 9 | -9223372036854775807 --- +int(-9223372036854775799) +--- testing: 9 | -9.2233720368548E+18 --- +int(-9223372036854775799) +--- testing: 65 | 9223372036854775807 --- +int(9223372036854775807) +--- testing: 65 | -9223372036854775808 --- +int(-9223372036854775743) +--- testing: 65 | 2147483647 --- +int(2147483647) +--- testing: 65 | -2147483648 --- +int(-2147483583) +--- testing: 65 | 9223372034707292160 --- +int(9223372034707292225) +--- testing: 65 | -9223372034707292160 --- +int(-9223372034707292095) +--- testing: 65 | 2147483648 --- +int(2147483713) +--- testing: 65 | -2147483649 --- +int(-2147483649) +--- testing: 65 | 4294967294 --- +int(4294967295) +--- testing: 65 | 4294967295 --- +int(4294967295) +--- testing: 65 | 4294967293 --- +int(4294967293) +--- testing: 65 | 9223372036854775806 --- +int(9223372036854775807) +--- testing: 65 | 9.2233720368548E+18 --- +int(-9223372036854775743) +--- testing: 65 | -9223372036854775807 --- +int(-9223372036854775743) +--- testing: 65 | -9.2233720368548E+18 --- +int(-9223372036854775743) +--- testing: -44 | 9223372036854775807 --- +int(-1) +--- testing: -44 | -9223372036854775808 --- +int(-44) +--- testing: -44 | 2147483647 --- +int(-1) +--- testing: -44 | -2147483648 --- +int(-44) +--- testing: -44 | 9223372034707292160 --- +int(-44) +--- testing: -44 | -9223372034707292160 --- +int(-44) +--- testing: -44 | 2147483648 --- +int(-44) +--- testing: -44 | -2147483649 --- +int(-1) +--- testing: -44 | 4294967294 --- +int(-2) +--- testing: -44 | 4294967295 --- +int(-1) +--- testing: -44 | 4294967293 --- +int(-3) +--- testing: -44 | 9223372036854775806 --- +int(-2) +--- testing: -44 | 9.2233720368548E+18 --- +int(-44) +--- testing: -44 | -9223372036854775807 --- +int(-43) +--- testing: -44 | -9.2233720368548E+18 --- +int(-44) +--- testing: 2147483647 | 9223372036854775807 --- +int(9223372036854775807) +--- testing: 2147483647 | -9223372036854775808 --- +int(-9223372034707292161) +--- testing: 2147483647 | 2147483647 --- +int(2147483647) +--- testing: 2147483647 | -2147483648 --- +int(-1) +--- testing: 2147483647 | 9223372034707292160 --- +int(9223372036854775807) +--- testing: 2147483647 | -9223372034707292160 --- +int(-9223372032559808513) +--- testing: 2147483647 | 2147483648 --- +int(4294967295) +--- testing: 2147483647 | -2147483649 --- +int(-2147483649) +--- testing: 2147483647 | 4294967294 --- +int(4294967295) +--- testing: 2147483647 | 4294967295 --- +int(4294967295) +--- testing: 2147483647 | 4294967293 --- +int(4294967295) +--- testing: 2147483647 | 9223372036854775806 --- +int(9223372036854775807) +--- testing: 2147483647 | 9.2233720368548E+18 --- +int(-9223372034707292161) +--- testing: 2147483647 | -9223372036854775807 --- +int(-9223372034707292161) +--- testing: 2147483647 | -9.2233720368548E+18 --- +int(-9223372034707292161) +--- testing: 9223372036854775807 | 9223372036854775807 --- +int(9223372036854775807) +--- testing: 9223372036854775807 | -9223372036854775808 --- +int(-1) +--- testing: 9223372036854775807 | 2147483647 --- +int(9223372036854775807) +--- testing: 9223372036854775807 | -2147483648 --- +int(-1) +--- testing: 9223372036854775807 | 9223372034707292160 --- +int(9223372036854775807) +--- testing: 9223372036854775807 | -9223372034707292160 --- +int(-1) +--- testing: 9223372036854775807 | 2147483648 --- +int(9223372036854775807) +--- testing: 9223372036854775807 | -2147483649 --- +int(-1) +--- testing: 9223372036854775807 | 4294967294 --- +int(9223372036854775807) +--- testing: 9223372036854775807 | 4294967295 --- +int(9223372036854775807) +--- testing: 9223372036854775807 | 4294967293 --- +int(9223372036854775807) +--- testing: 9223372036854775807 | 9223372036854775806 --- +int(9223372036854775807) +--- testing: 9223372036854775807 | 9.2233720368548E+18 --- +int(-1) +--- testing: 9223372036854775807 | -9223372036854775807 --- +int(-1) +--- testing: 9223372036854775807 | -9.2233720368548E+18 --- +int(-1) +===DONE=== +
\ No newline at end of file diff --git a/tests/lang/operators/bitwiseOr_variationStr.phpt b/tests/lang/operators/bitwiseOr_variationStr.phpt new file mode 100644 index 0000000..6c31477 --- /dev/null +++ b/tests/lang/operators/bitwiseOr_variationStr.phpt @@ -0,0 +1,416 @@ +--TEST--
+Test | operator : various numbers as strings
+--FILE--
+<?php
+
+$strVals = array(
+ "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",
+ "a5.9"
+);
+
+error_reporting(E_ERROR);
+
+foreach ($strVals as $strVal) {
+ foreach($strVals as $otherVal) {
+ echo "--- testing: '$strVal' | '$otherVal' ---\n";
+ var_dump(bin2hex($strVal|$otherVal));
+ }
+}
+
+
+?>
+===DONE===
+--EXPECT--
+--- testing: '0' | '0' --- +string(2) "30" +--- testing: '0' | '65' --- +string(4) "3635" +--- testing: '0' | '-44' --- +string(6) "3d3434" +--- testing: '0' | '1.2' --- +string(6) "312e32" +--- testing: '0' | '-7.7' --- +string(8) "3d372e37" +--- testing: '0' | 'abc' --- +string(6) "716263" +--- testing: '0' | '123abc' --- +string(12) "313233616263" +--- testing: '0' | '123e5' --- +string(10) "3132336535" +--- testing: '0' | '123e5xyz' --- +string(16) "313233653578797a" +--- testing: '0' | ' 123abc' --- +string(14) "30313233616263" +--- testing: '0' | '123 abc' --- +string(14) "31323320616263" +--- testing: '0' | '123abc ' --- +string(14) "31323361626320" +--- testing: '0' | '3.4a' --- +string(8) "332e3461" +--- testing: '0' | 'a5.9' --- +string(8) "71352e39" +--- testing: '65' | '0' --- +string(4) "3635" +--- testing: '65' | '65' --- +string(4) "3635" +--- testing: '65' | '-44' --- +string(6) "3f3534" +--- testing: '65' | '1.2' --- +string(6) "373f32" +--- testing: '65' | '-7.7' --- +string(8) "3f372e37" +--- testing: '65' | 'abc' --- +string(6) "777763" +--- testing: '65' | '123abc' --- +string(12) "373733616263" +--- testing: '65' | '123e5' --- +string(10) "3737336535" +--- testing: '65' | '123e5xyz' --- +string(16) "373733653578797a" +--- testing: '65' | ' 123abc' --- +string(14) "36353233616263" +--- testing: '65' | '123 abc' --- +string(14) "37373320616263" +--- testing: '65' | '123abc ' --- +string(14) "37373361626320" +--- testing: '65' | '3.4a' --- +string(8) "373f3461" +--- testing: '65' | 'a5.9' --- +string(8) "77352e39" +--- testing: '-44' | '0' --- +string(6) "3d3434" +--- testing: '-44' | '65' --- +string(6) "3f3534" +--- testing: '-44' | '-44' --- +string(6) "2d3434" +--- testing: '-44' | '1.2' --- +string(6) "3d3e36" +--- testing: '-44' | '-7.7' --- +string(8) "2d373e37" +--- testing: '-44' | 'abc' --- +string(6) "6d7677" +--- testing: '-44' | '123abc' --- +string(12) "3d3637616263" +--- testing: '-44' | '123e5' --- +string(10) "3d36376535" +--- testing: '-44' | '123e5xyz' --- +string(16) "3d3637653578797a" +--- testing: '-44' | ' 123abc' --- +string(14) "2d353633616263" +--- testing: '-44' | '123 abc' --- +string(14) "3d363720616263" +--- testing: '-44' | '123abc ' --- +string(14) "3d363761626320" +--- testing: '-44' | '3.4a' --- +string(8) "3f3e3461" +--- testing: '-44' | 'a5.9' --- +string(8) "6d353e39" +--- testing: '1.2' | '0' --- +string(6) "312e32" +--- testing: '1.2' | '65' --- +string(6) "373f32" +--- testing: '1.2' | '-44' --- +string(6) "3d3e36" +--- testing: '1.2' | '1.2' --- +string(6) "312e32" +--- testing: '1.2' | '-7.7' --- +string(8) "3d3f3e37" +--- testing: '1.2' | 'abc' --- +string(6) "716e73" +--- testing: '1.2' | '123abc' --- +string(12) "313e33616263" +--- testing: '1.2' | '123e5' --- +string(10) "313e336535" +--- testing: '1.2' | '123e5xyz' --- +string(16) "313e33653578797a" +--- testing: '1.2' | ' 123abc' --- +string(14) "313f3233616263" +--- testing: '1.2' | '123 abc' --- +string(14) "313e3320616263" +--- testing: '1.2' | '123abc ' --- +string(14) "313e3361626320" +--- testing: '1.2' | '3.4a' --- +string(8) "332e3661" +--- testing: '1.2' | 'a5.9' --- +string(8) "713f3e39" +--- testing: '-7.7' | '0' --- +string(8) "3d372e37" +--- testing: '-7.7' | '65' --- +string(8) "3f372e37" +--- testing: '-7.7' | '-44' --- +string(8) "2d373e37" +--- testing: '-7.7' | '1.2' --- +string(8) "3d3f3e37" +--- testing: '-7.7' | '-7.7' --- +string(8) "2d372e37" +--- testing: '-7.7' | 'abc' --- +string(8) "6d776f37" +--- testing: '-7.7' | '123abc' --- +string(12) "3d373f776263" +--- testing: '-7.7' | '123e5' --- +string(10) "3d373f7735" +--- testing: '-7.7' | '123e5xyz' --- +string(16) "3d373f773578797a" +--- testing: '-7.7' | ' 123abc' --- +string(14) "2d373e37616263" +--- testing: '-7.7' | '123 abc' --- +string(14) "3d373f37616263" +--- testing: '-7.7' | '123abc ' --- +string(14) "3d373f77626320" +--- testing: '-7.7' | '3.4a' --- +string(8) "3f3f3e77" +--- testing: '-7.7' | 'a5.9' --- +string(8) "6d372e3f" +--- testing: 'abc' | '0' --- +string(6) "716263" +--- testing: 'abc' | '65' --- +string(6) "777763" +--- testing: 'abc' | '-44' --- +string(6) "6d7677" +--- testing: 'abc' | '1.2' --- +string(6) "716e73" +--- testing: 'abc' | '-7.7' --- +string(8) "6d776f37" +--- testing: 'abc' | 'abc' --- +string(6) "616263" +--- testing: 'abc' | '123abc' --- +string(12) "717273616263" +--- testing: 'abc' | '123e5' --- +string(10) "7172736535" +--- testing: 'abc' | '123e5xyz' --- +string(16) "717273653578797a" +--- testing: 'abc' | ' 123abc' --- +string(14) "61737333616263" +--- testing: 'abc' | '123 abc' --- +string(14) "71727320616263" +--- testing: 'abc' | '123abc ' --- +string(14) "71727361626320" +--- testing: 'abc' | '3.4a' --- +string(8) "736e7761" +--- testing: 'abc' | 'a5.9' --- +string(8) "61776f39" +--- testing: '123abc' | '0' --- +string(12) "313233616263" +--- testing: '123abc' | '65' --- +string(12) "373733616263" +--- testing: '123abc' | '-44' --- +string(12) "3d3637616263" +--- testing: '123abc' | '1.2' --- +string(12) "313e33616263" +--- testing: '123abc' | '-7.7' --- +string(12) "3d373f776263" +--- testing: '123abc' | 'abc' --- +string(12) "717273616263" +--- testing: '123abc' | '123abc' --- +string(12) "313233616263" +--- testing: '123abc' | '123e5' --- +string(12) "313233657763" +--- testing: '123abc' | '123e5xyz' --- +string(16) "31323365777b797a" +--- testing: '123abc' | ' 123abc' --- +string(14) "31333373636363" +--- testing: '123abc' | '123 abc' --- +string(14) "31323361636363" +--- testing: '123abc' | '123abc ' --- +string(14) "31323361626320" +--- testing: '123abc' | '3.4a' --- +string(12) "333e37616263" +--- testing: '123abc' | 'a5.9' --- +string(12) "71373f796263" +--- testing: '123e5' | '0' --- +string(10) "3132336535" +--- testing: '123e5' | '65' --- +string(10) "3737336535" +--- testing: '123e5' | '-44' --- +string(10) "3d36376535" +--- testing: '123e5' | '1.2' --- +string(10) "313e336535" +--- testing: '123e5' | '-7.7' --- +string(10) "3d373f7735" +--- testing: '123e5' | 'abc' --- +string(10) "7172736535" +--- testing: '123e5' | '123abc' --- +string(12) "313233657763" +--- testing: '123e5' | '123e5' --- +string(10) "3132336535" +--- testing: '123e5' | '123e5xyz' --- +string(16) "313233653578797a" +--- testing: '123e5' | ' 123abc' --- +string(14) "31333377756263" +--- testing: '123e5' | '123 abc' --- +string(14) "31323365756263" +--- testing: '123e5' | '123abc ' --- +string(14) "31323365776320" +--- testing: '123e5' | '3.4a' --- +string(10) "333e376535" +--- testing: '123e5' | 'a5.9' --- +string(10) "71373f7d35" +--- testing: '123e5xyz' | '0' --- +string(16) "313233653578797a" +--- testing: '123e5xyz' | '65' --- +string(16) "373733653578797a" +--- testing: '123e5xyz' | '-44' --- +string(16) "3d3637653578797a" +--- testing: '123e5xyz' | '1.2' --- +string(16) "313e33653578797a" +--- testing: '123e5xyz' | '-7.7' --- +string(16) "3d373f773578797a" +--- testing: '123e5xyz' | 'abc' --- +string(16) "717273653578797a" +--- testing: '123e5xyz' | '123abc' --- +string(16) "31323365777b797a" +--- testing: '123e5xyz' | '123e5' --- +string(16) "313233653578797a" +--- testing: '123e5xyz' | '123e5xyz' --- +string(16) "313233653578797a" +--- testing: '123e5xyz' | ' 123abc' --- +string(16) "31333377757a7b7a" +--- testing: '123e5xyz' | '123 abc' --- +string(16) "31323365757a7b7a" +--- testing: '123e5xyz' | '123abc ' --- +string(16) "31323365777b797a" +--- testing: '123e5xyz' | '3.4a' --- +string(16) "333e37653578797a" +--- testing: '123e5xyz' | 'a5.9' --- +string(16) "71373f7d3578797a" +--- testing: ' 123abc' | '0' --- +string(14) "30313233616263" +--- testing: ' 123abc' | '65' --- +string(14) "36353233616263" +--- testing: ' 123abc' | '-44' --- +string(14) "2d353633616263" +--- testing: ' 123abc' | '1.2' --- +string(14) "313f3233616263" +--- testing: ' 123abc' | '-7.7' --- +string(14) "2d373e37616263" +--- testing: ' 123abc' | 'abc' --- +string(14) "61737333616263" +--- testing: ' 123abc' | '123abc' --- +string(14) "31333373636363" +--- testing: ' 123abc' | '123e5' --- +string(14) "31333377756263" +--- testing: ' 123abc' | '123e5xyz' --- +string(16) "31333377757a7b7a" +--- testing: ' 123abc' | ' 123abc' --- +string(14) "20313233616263" +--- testing: ' 123abc' | '123 abc' --- +string(14) "31333333616263" +--- testing: ' 123abc' | '123abc ' --- +string(14) "31333373636363" +--- testing: ' 123abc' | '3.4a' --- +string(14) "333f3673616263" +--- testing: ' 123abc' | 'a5.9' --- +string(14) "61353e3b616263" +--- testing: '123 abc' | '0' --- +string(14) "31323320616263" +--- testing: '123 abc' | '65' --- +string(14) "37373320616263" +--- testing: '123 abc' | '-44' --- +string(14) "3d363720616263" +--- testing: '123 abc' | '1.2' --- +string(14) "313e3320616263" +--- testing: '123 abc' | '-7.7' --- +string(14) "3d373f37616263" +--- testing: '123 abc' | 'abc' --- +string(14) "71727320616263" +--- testing: '123 abc' | '123abc' --- +string(14) "31323361636363" +--- testing: '123 abc' | '123e5' --- +string(14) "31323365756263" +--- testing: '123 abc' | '123e5xyz' --- +string(16) "31323365757a7b7a" +--- testing: '123 abc' | ' 123abc' --- +string(14) "31333333616263" +--- testing: '123 abc' | '123 abc' --- +string(14) "31323320616263" +--- testing: '123 abc' | '123abc ' --- +string(14) "31323361636363" +--- testing: '123 abc' | '3.4a' --- +string(14) "333e3761616263" +--- testing: '123 abc' | 'a5.9' --- +string(14) "71373f39616263" +--- testing: '123abc ' | '0' --- +string(14) "31323361626320" +--- testing: '123abc ' | '65' --- +string(14) "37373361626320" +--- testing: '123abc ' | '-44' --- +string(14) "3d363761626320" +--- testing: '123abc ' | '1.2' --- +string(14) "313e3361626320" +--- testing: '123abc ' | '-7.7' --- +string(14) "3d373f77626320" +--- testing: '123abc ' | 'abc' --- +string(14) "71727361626320" +--- testing: '123abc ' | '123abc' --- +string(14) "31323361626320" +--- testing: '123abc ' | '123e5' --- +string(14) "31323365776320" +--- testing: '123abc ' | '123e5xyz' --- +string(16) "31323365777b797a" +--- testing: '123abc ' | ' 123abc' --- +string(14) "31333373636363" +--- testing: '123abc ' | '123 abc' --- +string(14) "31323361636363" +--- testing: '123abc ' | '123abc ' --- +string(14) "31323361626320" +--- testing: '123abc ' | '3.4a' --- +string(14) "333e3761626320" +--- testing: '123abc ' | 'a5.9' --- +string(14) "71373f79626320" +--- testing: '3.4a' | '0' --- +string(8) "332e3461" +--- testing: '3.4a' | '65' --- +string(8) "373f3461" +--- testing: '3.4a' | '-44' --- +string(8) "3f3e3461" +--- testing: '3.4a' | '1.2' --- +string(8) "332e3661" +--- testing: '3.4a' | '-7.7' --- +string(8) "3f3f3e77" +--- testing: '3.4a' | 'abc' --- +string(8) "736e7761" +--- testing: '3.4a' | '123abc' --- +string(12) "333e37616263" +--- testing: '3.4a' | '123e5' --- +string(10) "333e376535" +--- testing: '3.4a' | '123e5xyz' --- +string(16) "333e37653578797a" +--- testing: '3.4a' | ' 123abc' --- +string(14) "333f3673616263" +--- testing: '3.4a' | '123 abc' --- +string(14) "333e3761616263" +--- testing: '3.4a' | '123abc ' --- +string(14) "333e3761626320" +--- testing: '3.4a' | '3.4a' --- +string(8) "332e3461" +--- testing: '3.4a' | 'a5.9' --- +string(8) "733f3e79" +--- testing: 'a5.9' | '0' --- +string(8) "71352e39" +--- testing: 'a5.9' | '65' --- +string(8) "77352e39" +--- testing: 'a5.9' | '-44' --- +string(8) "6d353e39" +--- testing: 'a5.9' | '1.2' --- +string(8) "713f3e39" +--- testing: 'a5.9' | '-7.7' --- +string(8) "6d372e3f" +--- testing: 'a5.9' | 'abc' --- +string(8) "61776f39" +--- testing: 'a5.9' | '123abc' --- +string(12) "71373f796263" +--- testing: 'a5.9' | '123e5' --- +string(10) "71373f7d35" +--- testing: 'a5.9' | '123e5xyz' --- +string(16) "71373f7d3578797a" +--- testing: 'a5.9' | ' 123abc' --- +string(14) "61353e3b616263" +--- testing: 'a5.9' | '123 abc' --- +string(14) "71373f39616263" +--- testing: 'a5.9' | '123abc ' --- +string(14) "71373f79626320" +--- testing: 'a5.9' | '3.4a' --- +string(8) "733f3e79" +--- testing: 'a5.9' | 'a5.9' --- +string(8) "61352e39"
+===DONE===
diff --git a/tests/lang/operators/bitwiseShiftLeft_basiclong_64bit.phpt b/tests/lang/operators/bitwiseShiftLeft_basiclong_64bit.phpt new file mode 100644 index 0000000..24da2d0 --- /dev/null +++ b/tests/lang/operators/bitwiseShiftLeft_basiclong_64bit.phpt @@ -0,0 +1,583 @@ +--TEST-- +Test << operator : 64bit long tests +--SKIPIF-- +<?php +if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); +?> +--FILE-- +<?php + +define("MAX_64Bit", 9223372036854775807); +define("MAX_32Bit", 2147483647); +define("MIN_64Bit", -9223372036854775807 - 1); +define("MIN_32Bit", -2147483647 - 1); + +$longVals = array( + MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit, + MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1, + MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1 +); + +$otherVals = array(0, 1, -1, 7, 9, 65, -44, MAX_32Bit, MAX_64Bit); + +error_reporting(E_ERROR); + +foreach ($longVals as $longVal) { + foreach($otherVals as $otherVal) { + echo "--- testing: $longVal << $otherVal ---\n"; + var_dump($longVal<<$otherVal); + } +} + +foreach ($otherVals as $otherVal) { + foreach($longVals as $longVal) { + echo "--- testing: $otherVal << $longVal ---\n"; + var_dump($otherVal<<$longVal); + } +} + +?> +===DONE=== +--EXPECT-- +--- testing: 9223372036854775807 << 0 --- +int(9223372036854775807) +--- testing: 9223372036854775807 << 1 --- +int(-2) +--- testing: 9223372036854775807 << -1 --- +int(-9223372036854775808) +--- testing: 9223372036854775807 << 7 --- +int(-128) +--- testing: 9223372036854775807 << 9 --- +int(-512) +--- testing: 9223372036854775807 << 65 --- +int(-2) +--- testing: 9223372036854775807 << -44 --- +int(-1048576) +--- testing: 9223372036854775807 << 2147483647 --- +int(-9223372036854775808) +--- testing: 9223372036854775807 << 9223372036854775807 --- +int(-9223372036854775808) +--- testing: -9223372036854775808 << 0 --- +int(-9223372036854775808) +--- testing: -9223372036854775808 << 1 --- +int(0) +--- testing: -9223372036854775808 << -1 --- +int(0) +--- testing: -9223372036854775808 << 7 --- +int(0) +--- testing: -9223372036854775808 << 9 --- +int(0) +--- testing: -9223372036854775808 << 65 --- +int(0) +--- testing: -9223372036854775808 << -44 --- +int(0) +--- testing: -9223372036854775808 << 2147483647 --- +int(0) +--- testing: -9223372036854775808 << 9223372036854775807 --- +int(0) +--- testing: 2147483647 << 0 --- +int(2147483647) +--- testing: 2147483647 << 1 --- +int(4294967294) +--- testing: 2147483647 << -1 --- +int(-9223372036854775808) +--- testing: 2147483647 << 7 --- +int(274877906816) +--- testing: 2147483647 << 9 --- +int(1099511627264) +--- testing: 2147483647 << 65 --- +int(4294967294) +--- testing: 2147483647 << -44 --- +int(2251799812636672) +--- testing: 2147483647 << 2147483647 --- +int(-9223372036854775808) +--- testing: 2147483647 << 9223372036854775807 --- +int(-9223372036854775808) +--- testing: -2147483648 << 0 --- +int(-2147483648) +--- testing: -2147483648 << 1 --- +int(-4294967296) +--- testing: -2147483648 << -1 --- +int(0) +--- testing: -2147483648 << 7 --- +int(-274877906944) +--- testing: -2147483648 << 9 --- +int(-1099511627776) +--- testing: -2147483648 << 65 --- +int(-4294967296) +--- testing: -2147483648 << -44 --- +int(-2251799813685248) +--- testing: -2147483648 << 2147483647 --- +int(0) +--- testing: -2147483648 << 9223372036854775807 --- +int(0) +--- testing: 9223372034707292160 << 0 --- +int(9223372034707292160) +--- testing: 9223372034707292160 << 1 --- +int(-4294967296) +--- testing: 9223372034707292160 << -1 --- +int(0) +--- testing: 9223372034707292160 << 7 --- +int(-274877906944) +--- testing: 9223372034707292160 << 9 --- +int(-1099511627776) +--- testing: 9223372034707292160 << 65 --- +int(-4294967296) +--- testing: 9223372034707292160 << -44 --- +int(-2251799813685248) +--- testing: 9223372034707292160 << 2147483647 --- +int(0) +--- testing: 9223372034707292160 << 9223372036854775807 --- +int(0) +--- testing: -9223372034707292160 << 0 --- +int(-9223372034707292160) +--- testing: -9223372034707292160 << 1 --- +int(4294967296) +--- testing: -9223372034707292160 << -1 --- +int(0) +--- testing: -9223372034707292160 << 7 --- +int(274877906944) +--- testing: -9223372034707292160 << 9 --- +int(1099511627776) +--- testing: -9223372034707292160 << 65 --- +int(4294967296) +--- testing: -9223372034707292160 << -44 --- +int(2251799813685248) +--- testing: -9223372034707292160 << 2147483647 --- +int(0) +--- testing: -9223372034707292160 << 9223372036854775807 --- +int(0) +--- testing: 2147483648 << 0 --- +int(2147483648) +--- testing: 2147483648 << 1 --- +int(4294967296) +--- testing: 2147483648 << -1 --- +int(0) +--- testing: 2147483648 << 7 --- +int(274877906944) +--- testing: 2147483648 << 9 --- +int(1099511627776) +--- testing: 2147483648 << 65 --- +int(4294967296) +--- testing: 2147483648 << -44 --- +int(2251799813685248) +--- testing: 2147483648 << 2147483647 --- +int(0) +--- testing: 2147483648 << 9223372036854775807 --- +int(0) +--- testing: -2147483649 << 0 --- +int(-2147483649) +--- testing: -2147483649 << 1 --- +int(-4294967298) +--- testing: -2147483649 << -1 --- +int(-9223372036854775808) +--- testing: -2147483649 << 7 --- +int(-274877907072) +--- testing: -2147483649 << 9 --- +int(-1099511628288) +--- testing: -2147483649 << 65 --- +int(-4294967298) +--- testing: -2147483649 << -44 --- +int(-2251799814733824) +--- testing: -2147483649 << 2147483647 --- +int(-9223372036854775808) +--- testing: -2147483649 << 9223372036854775807 --- +int(-9223372036854775808) +--- testing: 4294967294 << 0 --- +int(4294967294) +--- testing: 4294967294 << 1 --- +int(8589934588) +--- testing: 4294967294 << -1 --- +int(0) +--- testing: 4294967294 << 7 --- +int(549755813632) +--- testing: 4294967294 << 9 --- +int(2199023254528) +--- testing: 4294967294 << 65 --- +int(8589934588) +--- testing: 4294967294 << -44 --- +int(4503599625273344) +--- testing: 4294967294 << 2147483647 --- +int(0) +--- testing: 4294967294 << 9223372036854775807 --- +int(0) +--- testing: 4294967295 << 0 --- +int(4294967295) +--- testing: 4294967295 << 1 --- +int(8589934590) +--- testing: 4294967295 << -1 --- +int(-9223372036854775808) +--- testing: 4294967295 << 7 --- +int(549755813760) +--- testing: 4294967295 << 9 --- +int(2199023255040) +--- testing: 4294967295 << 65 --- +int(8589934590) +--- testing: 4294967295 << -44 --- +int(4503599626321920) +--- testing: 4294967295 << 2147483647 --- +int(-9223372036854775808) +--- testing: 4294967295 << 9223372036854775807 --- +int(-9223372036854775808) +--- testing: 4294967293 << 0 --- +int(4294967293) +--- testing: 4294967293 << 1 --- +int(8589934586) +--- testing: 4294967293 << -1 --- +int(-9223372036854775808) +--- testing: 4294967293 << 7 --- +int(549755813504) +--- testing: 4294967293 << 9 --- +int(2199023254016) +--- testing: 4294967293 << 65 --- +int(8589934586) +--- testing: 4294967293 << -44 --- +int(4503599624224768) +--- testing: 4294967293 << 2147483647 --- +int(-9223372036854775808) +--- testing: 4294967293 << 9223372036854775807 --- +int(-9223372036854775808) +--- testing: 9223372036854775806 << 0 --- +int(9223372036854775806) +--- testing: 9223372036854775806 << 1 --- +int(-4) +--- testing: 9223372036854775806 << -1 --- +int(0) +--- testing: 9223372036854775806 << 7 --- +int(-256) +--- testing: 9223372036854775806 << 9 --- +int(-1024) +--- testing: 9223372036854775806 << 65 --- +int(-4) +--- testing: 9223372036854775806 << -44 --- +int(-2097152) +--- testing: 9223372036854775806 << 2147483647 --- +int(0) +--- testing: 9223372036854775806 << 9223372036854775807 --- +int(0) +--- testing: 9.2233720368548E+18 << 0 --- +int(-9223372036854775808) +--- testing: 9.2233720368548E+18 << 1 --- +int(0) +--- testing: 9.2233720368548E+18 << -1 --- +int(0) +--- testing: 9.2233720368548E+18 << 7 --- +int(0) +--- testing: 9.2233720368548E+18 << 9 --- +int(0) +--- testing: 9.2233720368548E+18 << 65 --- +int(0) +--- testing: 9.2233720368548E+18 << -44 --- +int(0) +--- testing: 9.2233720368548E+18 << 2147483647 --- +int(0) +--- testing: 9.2233720368548E+18 << 9223372036854775807 --- +int(0) +--- testing: -9223372036854775807 << 0 --- +int(-9223372036854775807) +--- testing: -9223372036854775807 << 1 --- +int(2) +--- testing: -9223372036854775807 << -1 --- +int(-9223372036854775808) +--- testing: -9223372036854775807 << 7 --- +int(128) +--- testing: -9223372036854775807 << 9 --- +int(512) +--- testing: -9223372036854775807 << 65 --- +int(2) +--- testing: -9223372036854775807 << -44 --- +int(1048576) +--- testing: -9223372036854775807 << 2147483647 --- +int(-9223372036854775808) +--- testing: -9223372036854775807 << 9223372036854775807 --- +int(-9223372036854775808) +--- testing: -9.2233720368548E+18 << 0 --- +int(-9223372036854775808) +--- testing: -9.2233720368548E+18 << 1 --- +int(0) +--- testing: -9.2233720368548E+18 << -1 --- +int(0) +--- testing: -9.2233720368548E+18 << 7 --- +int(0) +--- testing: -9.2233720368548E+18 << 9 --- +int(0) +--- testing: -9.2233720368548E+18 << 65 --- +int(0) +--- testing: -9.2233720368548E+18 << -44 --- +int(0) +--- testing: -9.2233720368548E+18 << 2147483647 --- +int(0) +--- testing: -9.2233720368548E+18 << 9223372036854775807 --- +int(0) +--- testing: 0 << 9223372036854775807 --- +int(0) +--- testing: 0 << -9223372036854775808 --- +int(0) +--- testing: 0 << 2147483647 --- +int(0) +--- testing: 0 << -2147483648 --- +int(0) +--- testing: 0 << 9223372034707292160 --- +int(0) +--- testing: 0 << -9223372034707292160 --- +int(0) +--- testing: 0 << 2147483648 --- +int(0) +--- testing: 0 << -2147483649 --- +int(0) +--- testing: 0 << 4294967294 --- +int(0) +--- testing: 0 << 4294967295 --- +int(0) +--- testing: 0 << 4294967293 --- +int(0) +--- testing: 0 << 9223372036854775806 --- +int(0) +--- testing: 0 << 9.2233720368548E+18 --- +int(0) +--- testing: 0 << -9223372036854775807 --- +int(0) +--- testing: 0 << -9.2233720368548E+18 --- +int(0) +--- testing: 1 << 9223372036854775807 --- +int(-9223372036854775808) +--- testing: 1 << -9223372036854775808 --- +int(1) +--- testing: 1 << 2147483647 --- +int(-9223372036854775808) +--- testing: 1 << -2147483648 --- +int(1) +--- testing: 1 << 9223372034707292160 --- +int(1) +--- testing: 1 << -9223372034707292160 --- +int(1) +--- testing: 1 << 2147483648 --- +int(1) +--- testing: 1 << -2147483649 --- +int(-9223372036854775808) +--- testing: 1 << 4294967294 --- +int(4611686018427387904) +--- testing: 1 << 4294967295 --- +int(-9223372036854775808) +--- testing: 1 << 4294967293 --- +int(2305843009213693952) +--- testing: 1 << 9223372036854775806 --- +int(4611686018427387904) +--- testing: 1 << 9.2233720368548E+18 --- +int(1) +--- testing: 1 << -9223372036854775807 --- +int(2) +--- testing: 1 << -9.2233720368548E+18 --- +int(1) +--- testing: -1 << 9223372036854775807 --- +int(-9223372036854775808) +--- testing: -1 << -9223372036854775808 --- +int(-1) +--- testing: -1 << 2147483647 --- +int(-9223372036854775808) +--- testing: -1 << -2147483648 --- +int(-1) +--- testing: -1 << 9223372034707292160 --- +int(-1) +--- testing: -1 << -9223372034707292160 --- +int(-1) +--- testing: -1 << 2147483648 --- +int(-1) +--- testing: -1 << -2147483649 --- +int(-9223372036854775808) +--- testing: -1 << 4294967294 --- +int(-4611686018427387904) +--- testing: -1 << 4294967295 --- +int(-9223372036854775808) +--- testing: -1 << 4294967293 --- +int(-2305843009213693952) +--- testing: -1 << 9223372036854775806 --- +int(-4611686018427387904) +--- testing: -1 << 9.2233720368548E+18 --- +int(-1) +--- testing: -1 << -9223372036854775807 --- +int(-2) +--- testing: -1 << -9.2233720368548E+18 --- +int(-1) +--- testing: 7 << 9223372036854775807 --- +int(-9223372036854775808) +--- testing: 7 << -9223372036854775808 --- +int(7) +--- testing: 7 << 2147483647 --- +int(-9223372036854775808) +--- testing: 7 << -2147483648 --- +int(7) +--- testing: 7 << 9223372034707292160 --- +int(7) +--- testing: 7 << -9223372034707292160 --- +int(7) +--- testing: 7 << 2147483648 --- +int(7) +--- testing: 7 << -2147483649 --- +int(-9223372036854775808) +--- testing: 7 << 4294967294 --- +int(-4611686018427387904) +--- testing: 7 << 4294967295 --- +int(-9223372036854775808) +--- testing: 7 << 4294967293 --- +int(-2305843009213693952) +--- testing: 7 << 9223372036854775806 --- +int(-4611686018427387904) +--- testing: 7 << 9.2233720368548E+18 --- +int(7) +--- testing: 7 << -9223372036854775807 --- +int(14) +--- testing: 7 << -9.2233720368548E+18 --- +int(7) +--- testing: 9 << 9223372036854775807 --- +int(-9223372036854775808) +--- testing: 9 << -9223372036854775808 --- +int(9) +--- testing: 9 << 2147483647 --- +int(-9223372036854775808) +--- testing: 9 << -2147483648 --- +int(9) +--- testing: 9 << 9223372034707292160 --- +int(9) +--- testing: 9 << -9223372034707292160 --- +int(9) +--- testing: 9 << 2147483648 --- +int(9) +--- testing: 9 << -2147483649 --- +int(-9223372036854775808) +--- testing: 9 << 4294967294 --- +int(4611686018427387904) +--- testing: 9 << 4294967295 --- +int(-9223372036854775808) +--- testing: 9 << 4294967293 --- +int(2305843009213693952) +--- testing: 9 << 9223372036854775806 --- +int(4611686018427387904) +--- testing: 9 << 9.2233720368548E+18 --- +int(9) +--- testing: 9 << -9223372036854775807 --- +int(18) +--- testing: 9 << -9.2233720368548E+18 --- +int(9) +--- testing: 65 << 9223372036854775807 --- +int(-9223372036854775808) +--- testing: 65 << -9223372036854775808 --- +int(65) +--- testing: 65 << 2147483647 --- +int(-9223372036854775808) +--- testing: 65 << -2147483648 --- +int(65) +--- testing: 65 << 9223372034707292160 --- +int(65) +--- testing: 65 << -9223372034707292160 --- +int(65) +--- testing: 65 << 2147483648 --- +int(65) +--- testing: 65 << -2147483649 --- +int(-9223372036854775808) +--- testing: 65 << 4294967294 --- +int(4611686018427387904) +--- testing: 65 << 4294967295 --- +int(-9223372036854775808) +--- testing: 65 << 4294967293 --- +int(2305843009213693952) +--- testing: 65 << 9223372036854775806 --- +int(4611686018427387904) +--- testing: 65 << 9.2233720368548E+18 --- +int(65) +--- testing: 65 << -9223372036854775807 --- +int(130) +--- testing: 65 << -9.2233720368548E+18 --- +int(65) +--- testing: -44 << 9223372036854775807 --- +int(0) +--- testing: -44 << -9223372036854775808 --- +int(-44) +--- testing: -44 << 2147483647 --- +int(0) +--- testing: -44 << -2147483648 --- +int(-44) +--- testing: -44 << 9223372034707292160 --- +int(-44) +--- testing: -44 << -9223372034707292160 --- +int(-44) +--- testing: -44 << 2147483648 --- +int(-44) +--- testing: -44 << -2147483649 --- +int(0) +--- testing: -44 << 4294967294 --- +int(0) +--- testing: -44 << 4294967295 --- +int(0) +--- testing: -44 << 4294967293 --- +int(-9223372036854775808) +--- testing: -44 << 9223372036854775806 --- +int(0) +--- testing: -44 << 9.2233720368548E+18 --- +int(-44) +--- testing: -44 << -9223372036854775807 --- +int(-88) +--- testing: -44 << -9.2233720368548E+18 --- +int(-44) +--- testing: 2147483647 << 9223372036854775807 --- +int(-9223372036854775808) +--- testing: 2147483647 << -9223372036854775808 --- +int(2147483647) +--- testing: 2147483647 << 2147483647 --- +int(-9223372036854775808) +--- testing: 2147483647 << -2147483648 --- +int(2147483647) +--- testing: 2147483647 << 9223372034707292160 --- +int(2147483647) +--- testing: 2147483647 << -9223372034707292160 --- +int(2147483647) +--- testing: 2147483647 << 2147483648 --- +int(2147483647) +--- testing: 2147483647 << -2147483649 --- +int(-9223372036854775808) +--- testing: 2147483647 << 4294967294 --- +int(-4611686018427387904) +--- testing: 2147483647 << 4294967295 --- +int(-9223372036854775808) +--- testing: 2147483647 << 4294967293 --- +int(-2305843009213693952) +--- testing: 2147483647 << 9223372036854775806 --- +int(-4611686018427387904) +--- testing: 2147483647 << 9.2233720368548E+18 --- +int(2147483647) +--- testing: 2147483647 << -9223372036854775807 --- +int(4294967294) +--- testing: 2147483647 << -9.2233720368548E+18 --- +int(2147483647) +--- testing: 9223372036854775807 << 9223372036854775807 --- +int(-9223372036854775808) +--- testing: 9223372036854775807 << -9223372036854775808 --- +int(9223372036854775807) +--- testing: 9223372036854775807 << 2147483647 --- +int(-9223372036854775808) +--- testing: 9223372036854775807 << -2147483648 --- +int(9223372036854775807) +--- testing: 9223372036854775807 << 9223372034707292160 --- +int(9223372036854775807) +--- testing: 9223372036854775807 << -9223372034707292160 --- +int(9223372036854775807) +--- testing: 9223372036854775807 << 2147483648 --- +int(9223372036854775807) +--- testing: 9223372036854775807 << -2147483649 --- +int(-9223372036854775808) +--- testing: 9223372036854775807 << 4294967294 --- +int(-4611686018427387904) +--- testing: 9223372036854775807 << 4294967295 --- +int(-9223372036854775808) +--- testing: 9223372036854775807 << 4294967293 --- +int(-2305843009213693952) +--- testing: 9223372036854775807 << 9223372036854775806 --- +int(-4611686018427387904) +--- testing: 9223372036854775807 << 9.2233720368548E+18 --- +int(9223372036854775807) +--- testing: 9223372036854775807 << -9223372036854775807 --- +int(-2) +--- testing: 9223372036854775807 << -9.2233720368548E+18 --- +int(9223372036854775807) +===DONE=== +
\ No newline at end of file diff --git a/tests/lang/operators/bitwiseShiftLeft_variationStr.phpt b/tests/lang/operators/bitwiseShiftLeft_variationStr.phpt new file mode 100644 index 0000000..b1bc437 --- /dev/null +++ b/tests/lang/operators/bitwiseShiftLeft_variationStr.phpt @@ -0,0 +1,421 @@ +--TEST--
+Test << operator : various numbers as strings
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+
+$strVals = array(
+ "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",
+ "a5.9"
+);
+
+error_reporting(E_ERROR);
+
+foreach ($strVals as $strVal) {
+ foreach($strVals as $otherVal) {
+ echo "--- testing: '$strVal' << '$otherVal' ---\n";
+ var_dump(bin2hex($strVal<<$otherVal));
+ }
+}
+
+
+?>
+===DONE===
+--EXPECT--
+--- testing: '0' << '0' ---
+string(2) "30"
+--- testing: '0' << '65' ---
+string(2) "30"
+--- testing: '0' << '-44' ---
+string(2) "30"
+--- testing: '0' << '1.2' ---
+string(2) "30"
+--- testing: '0' << '-7.7' ---
+string(2) "30"
+--- testing: '0' << 'abc' ---
+string(2) "30"
+--- testing: '0' << '123abc' ---
+string(2) "30"
+--- testing: '0' << '123e5' ---
+string(2) "30"
+--- testing: '0' << '123e5xyz' ---
+string(2) "30"
+--- testing: '0' << ' 123abc' ---
+string(2) "30"
+--- testing: '0' << '123 abc' ---
+string(2) "30"
+--- testing: '0' << '123abc ' ---
+string(2) "30"
+--- testing: '0' << '3.4a' ---
+string(2) "30"
+--- testing: '0' << 'a5.9' ---
+string(2) "30"
+--- testing: '65' << '0' ---
+string(4) "3635"
+--- testing: '65' << '65' ---
+string(6) "313330"
+--- testing: '65' << '-44' ---
+string(16) "3638313537343430"
+--- testing: '65' << '1.2' ---
+string(6) "313330"
+--- testing: '65' << '-7.7' ---
+string(22) "2d32313133393239323136"
+--- testing: '65' << 'abc' ---
+string(4) "3635"
+--- testing: '65' << '123abc' ---
+string(18) "313334323137373238"
+--- testing: '65' << '123e5' ---
+string(18) "313334323137373238"
+--- testing: '65' << '123e5xyz' ---
+string(18) "313334323137373238"
+--- testing: '65' << ' 123abc' ---
+string(18) "313334323137373238"
+--- testing: '65' << '123 abc' ---
+string(18) "313334323137373238"
+--- testing: '65' << '123abc ' ---
+string(18) "313334323137373238"
+--- testing: '65' << '3.4a' ---
+string(6) "353230"
+--- testing: '65' << 'a5.9' ---
+string(4) "3635"
+--- testing: '-44' << '0' ---
+string(6) "2d3434"
+--- testing: '-44' << '65' ---
+string(6) "2d3838"
+--- testing: '-44' << '-44' ---
+string(18) "2d3436313337333434"
+--- testing: '-44' << '1.2' ---
+string(6) "2d3838"
+--- testing: '-44' << '-7.7' ---
+string(22) "2d31343736333935303038"
+--- testing: '-44' << 'abc' ---
+string(6) "2d3434"
+--- testing: '-44' << '123abc' ---
+string(22) "2d31363130363132373336"
+--- testing: '-44' << '123e5' ---
+string(22) "2d31363130363132373336"
+--- testing: '-44' << '123e5xyz' ---
+string(22) "2d31363130363132373336"
+--- testing: '-44' << ' 123abc' ---
+string(22) "2d31363130363132373336"
+--- testing: '-44' << '123 abc' ---
+string(22) "2d31363130363132373336"
+--- testing: '-44' << '123abc ' ---
+string(22) "2d31363130363132373336"
+--- testing: '-44' << '3.4a' ---
+string(8) "2d333532"
+--- testing: '-44' << 'a5.9' ---
+string(6) "2d3434"
+--- testing: '1.2' << '0' ---
+string(2) "31"
+--- testing: '1.2' << '65' ---
+string(2) "32"
+--- testing: '1.2' << '-44' ---
+string(14) "31303438353736"
+--- testing: '1.2' << '1.2' ---
+string(2) "32"
+--- testing: '1.2' << '-7.7' ---
+string(16) "3333353534343332"
+--- testing: '1.2' << 'abc' ---
+string(2) "31"
+--- testing: '1.2' << '123abc' ---
+string(18) "313334323137373238"
+--- testing: '1.2' << '123e5' ---
+string(18) "313334323137373238"
+--- testing: '1.2' << '123e5xyz' ---
+string(18) "313334323137373238"
+--- testing: '1.2' << ' 123abc' ---
+string(18) "313334323137373238"
+--- testing: '1.2' << '123 abc' ---
+string(18) "313334323137373238"
+--- testing: '1.2' << '123abc ' ---
+string(18) "313334323137373238"
+--- testing: '1.2' << '3.4a' ---
+string(2) "38"
+--- testing: '1.2' << 'a5.9' ---
+string(2) "31"
+--- testing: '-7.7' << '0' ---
+string(4) "2d37"
+--- testing: '-7.7' << '65' ---
+string(6) "2d3134"
+--- testing: '-7.7' << '-44' ---
+string(16) "2d37333430303332"
+--- testing: '-7.7' << '1.2' ---
+string(6) "2d3134"
+--- testing: '-7.7' << '-7.7' ---
+string(20) "2d323334383831303234"
+--- testing: '-7.7' << 'abc' ---
+string(4) "2d37"
+--- testing: '-7.7' << '123abc' ---
+string(20) "2d393339353234303936"
+--- testing: '-7.7' << '123e5' ---
+string(20) "2d393339353234303936"
+--- testing: '-7.7' << '123e5xyz' ---
+string(20) "2d393339353234303936"
+--- testing: '-7.7' << ' 123abc' ---
+string(20) "2d393339353234303936"
+--- testing: '-7.7' << '123 abc' ---
+string(20) "2d393339353234303936"
+--- testing: '-7.7' << '123abc ' ---
+string(20) "2d393339353234303936"
+--- testing: '-7.7' << '3.4a' ---
+string(6) "2d3536"
+--- testing: '-7.7' << 'a5.9' ---
+string(4) "2d37"
+--- testing: 'abc' << '0' ---
+string(2) "30"
+--- testing: 'abc' << '65' ---
+string(2) "30"
+--- testing: 'abc' << '-44' ---
+string(2) "30"
+--- testing: 'abc' << '1.2' ---
+string(2) "30"
+--- testing: 'abc' << '-7.7' ---
+string(2) "30"
+--- testing: 'abc' << 'abc' ---
+string(2) "30"
+--- testing: 'abc' << '123abc' ---
+string(2) "30"
+--- testing: 'abc' << '123e5' ---
+string(2) "30"
+--- testing: 'abc' << '123e5xyz' ---
+string(2) "30"
+--- testing: 'abc' << ' 123abc' ---
+string(2) "30"
+--- testing: 'abc' << '123 abc' ---
+string(2) "30"
+--- testing: 'abc' << '123abc ' ---
+string(2) "30"
+--- testing: 'abc' << '3.4a' ---
+string(2) "30"
+--- testing: 'abc' << 'a5.9' ---
+string(2) "30"
+--- testing: '123abc' << '0' ---
+string(6) "313233"
+--- testing: '123abc' << '65' ---
+string(6) "323436"
+--- testing: '123abc' << '-44' ---
+string(18) "313238393734383438"
+--- testing: '123abc' << '1.2' ---
+string(6) "323436"
+--- testing: '123abc' << '-7.7' ---
+string(20) "2d313637373732313630"
+--- testing: '123abc' << 'abc' ---
+string(6) "313233"
+--- testing: '123abc' << '123abc' ---
+string(20) "2d363731303838363430"
+--- testing: '123abc' << '123e5' ---
+string(20) "2d363731303838363430"
+--- testing: '123abc' << '123e5xyz' ---
+string(20) "2d363731303838363430"
+--- testing: '123abc' << ' 123abc' ---
+string(20) "2d363731303838363430"
+--- testing: '123abc' << '123 abc' ---
+string(20) "2d363731303838363430"
+--- testing: '123abc' << '123abc ' ---
+string(20) "2d363731303838363430"
+--- testing: '123abc' << '3.4a' ---
+string(6) "393834"
+--- testing: '123abc' << 'a5.9' ---
+string(6) "313233"
+--- testing: '123e5' << '0' ---
+string(6) "313233"
+--- testing: '123e5' << '65' ---
+string(6) "323436"
+--- testing: '123e5' << '-44' ---
+string(18) "313238393734383438"
+--- testing: '123e5' << '1.2' ---
+string(6) "323436"
+--- testing: '123e5' << '-7.7' ---
+string(20) "2d313637373732313630"
+--- testing: '123e5' << 'abc' ---
+string(6) "313233"
+--- testing: '123e5' << '123abc' ---
+string(20) "2d363731303838363430"
+--- testing: '123e5' << '123e5' ---
+string(20) "2d363731303838363430"
+--- testing: '123e5' << '123e5xyz' ---
+string(20) "2d363731303838363430"
+--- testing: '123e5' << ' 123abc' ---
+string(20) "2d363731303838363430"
+--- testing: '123e5' << '123 abc' ---
+string(20) "2d363731303838363430"
+--- testing: '123e5' << '123abc ' ---
+string(20) "2d363731303838363430"
+--- testing: '123e5' << '3.4a' ---
+string(6) "393834"
+--- testing: '123e5' << 'a5.9' ---
+string(6) "313233"
+--- testing: '123e5xyz' << '0' ---
+string(6) "313233"
+--- testing: '123e5xyz' << '65' ---
+string(6) "323436"
+--- testing: '123e5xyz' << '-44' ---
+string(18) "313238393734383438"
+--- testing: '123e5xyz' << '1.2' ---
+string(6) "323436"
+--- testing: '123e5xyz' << '-7.7' ---
+string(20) "2d313637373732313630"
+--- testing: '123e5xyz' << 'abc' ---
+string(6) "313233"
+--- testing: '123e5xyz' << '123abc' ---
+string(20) "2d363731303838363430"
+--- testing: '123e5xyz' << '123e5' ---
+string(20) "2d363731303838363430"
+--- testing: '123e5xyz' << '123e5xyz' ---
+string(20) "2d363731303838363430"
+--- testing: '123e5xyz' << ' 123abc' ---
+string(20) "2d363731303838363430"
+--- testing: '123e5xyz' << '123 abc' ---
+string(20) "2d363731303838363430"
+--- testing: '123e5xyz' << '123abc ' ---
+string(20) "2d363731303838363430"
+--- testing: '123e5xyz' << '3.4a' ---
+string(6) "393834"
+--- testing: '123e5xyz' << 'a5.9' ---
+string(6) "313233"
+--- testing: ' 123abc' << '0' ---
+string(6) "313233"
+--- testing: ' 123abc' << '65' ---
+string(6) "323436"
+--- testing: ' 123abc' << '-44' ---
+string(18) "313238393734383438"
+--- testing: ' 123abc' << '1.2' ---
+string(6) "323436"
+--- testing: ' 123abc' << '-7.7' ---
+string(20) "2d313637373732313630"
+--- testing: ' 123abc' << 'abc' ---
+string(6) "313233"
+--- testing: ' 123abc' << '123abc' ---
+string(20) "2d363731303838363430"
+--- testing: ' 123abc' << '123e5' ---
+string(20) "2d363731303838363430"
+--- testing: ' 123abc' << '123e5xyz' ---
+string(20) "2d363731303838363430"
+--- testing: ' 123abc' << ' 123abc' ---
+string(20) "2d363731303838363430"
+--- testing: ' 123abc' << '123 abc' ---
+string(20) "2d363731303838363430"
+--- testing: ' 123abc' << '123abc ' ---
+string(20) "2d363731303838363430"
+--- testing: ' 123abc' << '3.4a' ---
+string(6) "393834"
+--- testing: ' 123abc' << 'a5.9' ---
+string(6) "313233"
+--- testing: '123 abc' << '0' ---
+string(6) "313233"
+--- testing: '123 abc' << '65' ---
+string(6) "323436"
+--- testing: '123 abc' << '-44' ---
+string(18) "313238393734383438"
+--- testing: '123 abc' << '1.2' ---
+string(6) "323436"
+--- testing: '123 abc' << '-7.7' ---
+string(20) "2d313637373732313630"
+--- testing: '123 abc' << 'abc' ---
+string(6) "313233"
+--- testing: '123 abc' << '123abc' ---
+string(20) "2d363731303838363430"
+--- testing: '123 abc' << '123e5' ---
+string(20) "2d363731303838363430"
+--- testing: '123 abc' << '123e5xyz' ---
+string(20) "2d363731303838363430"
+--- testing: '123 abc' << ' 123abc' ---
+string(20) "2d363731303838363430"
+--- testing: '123 abc' << '123 abc' ---
+string(20) "2d363731303838363430"
+--- testing: '123 abc' << '123abc ' ---
+string(20) "2d363731303838363430"
+--- testing: '123 abc' << '3.4a' ---
+string(6) "393834"
+--- testing: '123 abc' << 'a5.9' ---
+string(6) "313233"
+--- testing: '123abc ' << '0' ---
+string(6) "313233"
+--- testing: '123abc ' << '65' ---
+string(6) "323436"
+--- testing: '123abc ' << '-44' ---
+string(18) "313238393734383438"
+--- testing: '123abc ' << '1.2' ---
+string(6) "323436"
+--- testing: '123abc ' << '-7.7' ---
+string(20) "2d313637373732313630"
+--- testing: '123abc ' << 'abc' ---
+string(6) "313233"
+--- testing: '123abc ' << '123abc' ---
+string(20) "2d363731303838363430"
+--- testing: '123abc ' << '123e5' ---
+string(20) "2d363731303838363430"
+--- testing: '123abc ' << '123e5xyz' ---
+string(20) "2d363731303838363430"
+--- testing: '123abc ' << ' 123abc' ---
+string(20) "2d363731303838363430"
+--- testing: '123abc ' << '123 abc' ---
+string(20) "2d363731303838363430"
+--- testing: '123abc ' << '123abc ' ---
+string(20) "2d363731303838363430"
+--- testing: '123abc ' << '3.4a' ---
+string(6) "393834"
+--- testing: '123abc ' << 'a5.9' ---
+string(6) "313233"
+--- testing: '3.4a' << '0' ---
+string(2) "33"
+--- testing: '3.4a' << '65' ---
+string(2) "36"
+--- testing: '3.4a' << '-44' ---
+string(14) "33313435373238"
+--- testing: '3.4a' << '1.2' ---
+string(2) "36"
+--- testing: '3.4a' << '-7.7' ---
+string(18) "313030363633323936"
+--- testing: '3.4a' << 'abc' ---
+string(2) "33"
+--- testing: '3.4a' << '123abc' ---
+string(18) "343032363533313834"
+--- testing: '3.4a' << '123e5' ---
+string(18) "343032363533313834"
+--- testing: '3.4a' << '123e5xyz' ---
+string(18) "343032363533313834"
+--- testing: '3.4a' << ' 123abc' ---
+string(18) "343032363533313834"
+--- testing: '3.4a' << '123 abc' ---
+string(18) "343032363533313834"
+--- testing: '3.4a' << '123abc ' ---
+string(18) "343032363533313834"
+--- testing: '3.4a' << '3.4a' ---
+string(4) "3234"
+--- testing: '3.4a' << 'a5.9' ---
+string(2) "33"
+--- testing: 'a5.9' << '0' ---
+string(2) "30"
+--- testing: 'a5.9' << '65' ---
+string(2) "30"
+--- testing: 'a5.9' << '-44' ---
+string(2) "30"
+--- testing: 'a5.9' << '1.2' ---
+string(2) "30"
+--- testing: 'a5.9' << '-7.7' ---
+string(2) "30"
+--- testing: 'a5.9' << 'abc' ---
+string(2) "30"
+--- testing: 'a5.9' << '123abc' ---
+string(2) "30"
+--- testing: 'a5.9' << '123e5' ---
+string(2) "30"
+--- testing: 'a5.9' << '123e5xyz' ---
+string(2) "30"
+--- testing: 'a5.9' << ' 123abc' ---
+string(2) "30"
+--- testing: 'a5.9' << '123 abc' ---
+string(2) "30"
+--- testing: 'a5.9' << '123abc ' ---
+string(2) "30"
+--- testing: 'a5.9' << '3.4a' ---
+string(2) "30"
+--- testing: 'a5.9' << 'a5.9' ---
+string(2) "30"
+===DONE===
+
diff --git a/tests/lang/operators/bitwiseShiftLeft_variationStr_64bit.phpt b/tests/lang/operators/bitwiseShiftLeft_variationStr_64bit.phpt new file mode 100644 index 0000000..0b697c8 --- /dev/null +++ b/tests/lang/operators/bitwiseShiftLeft_variationStr_64bit.phpt @@ -0,0 +1,420 @@ +--TEST--
+Test << operator : various numbers as strings
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+$strVals = array(
+ "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",
+ "a5.9"
+);
+
+error_reporting(E_ERROR);
+
+foreach ($strVals as $strVal) {
+ foreach($strVals as $otherVal) {
+ echo "--- testing: '$strVal' << '$otherVal' ---\n";
+ var_dump(bin2hex($strVal<<$otherVal));
+ }
+}
+
+
+?>
+===DONE===
+--EXPECT--
+--- testing: '0' << '0' --- +string(2) "30" +--- testing: '0' << '65' --- +string(2) "30" +--- testing: '0' << '-44' --- +string(2) "30" +--- testing: '0' << '1.2' --- +string(2) "30" +--- testing: '0' << '-7.7' --- +string(2) "30" +--- testing: '0' << 'abc' --- +string(2) "30" +--- testing: '0' << '123abc' --- +string(2) "30" +--- testing: '0' << '123e5' --- +string(2) "30" +--- testing: '0' << '123e5xyz' --- +string(2) "30" +--- testing: '0' << ' 123abc' --- +string(2) "30" +--- testing: '0' << '123 abc' --- +string(2) "30" +--- testing: '0' << '123abc ' --- +string(2) "30" +--- testing: '0' << '3.4a' --- +string(2) "30" +--- testing: '0' << 'a5.9' --- +string(2) "30" +--- testing: '65' << '0' --- +string(4) "3635" +--- testing: '65' << '65' --- +string(6) "313330" +--- testing: '65' << '-44' --- +string(16) "3638313537343430" +--- testing: '65' << '1.2' --- +string(6) "313330" +--- testing: '65' << '-7.7' --- +string(40) "2d39303739323536383438373738393139393336" +--- testing: '65' << 'abc' --- +string(4) "3635" +--- testing: '65' << '123abc' --- +string(36) "353736343630373532333033343233343838" +--- testing: '65' << '123e5' --- +string(36) "353736343630373532333033343233343838" +--- testing: '65' << '123e5xyz' --- +string(36) "353736343630373532333033343233343838" +--- testing: '65' << ' 123abc' --- +string(36) "353736343630373532333033343233343838" +--- testing: '65' << '123 abc' --- +string(36) "353736343630373532333033343233343838" +--- testing: '65' << '123abc ' --- +string(36) "353736343630373532333033343233343838" +--- testing: '65' << '3.4a' --- +string(6) "353230" +--- testing: '65' << 'a5.9' --- +string(4) "3635" +--- testing: '-44' << '0' --- +string(6) "2d3434" +--- testing: '-44' << '65' --- +string(6) "2d3838" +--- testing: '-44' << '-44' --- +string(18) "2d3436313337333434" +--- testing: '-44' << '1.2' --- +string(6) "2d3838" +--- testing: '-44' << '-7.7' --- +string(40) "2d36333431303638323735333337363538333638" +--- testing: '-44' << 'abc' --- +string(6) "2d3434" +--- testing: '-44' << '123abc' --- +string(40) "2d36393137353239303237363431303831383536" +--- testing: '-44' << '123e5' --- +string(40) "2d36393137353239303237363431303831383536" +--- testing: '-44' << '123e5xyz' --- +string(40) "2d36393137353239303237363431303831383536" +--- testing: '-44' << ' 123abc' --- +string(40) "2d36393137353239303237363431303831383536" +--- testing: '-44' << '123 abc' --- +string(40) "2d36393137353239303237363431303831383536" +--- testing: '-44' << '123abc ' --- +string(40) "2d36393137353239303237363431303831383536" +--- testing: '-44' << '3.4a' --- +string(8) "2d333532" +--- testing: '-44' << 'a5.9' --- +string(6) "2d3434" +--- testing: '1.2' << '0' --- +string(2) "31" +--- testing: '1.2' << '65' --- +string(2) "32" +--- testing: '1.2' << '-44' --- +string(14) "31303438353736" +--- testing: '1.2' << '1.2' --- +string(2) "32" +--- testing: '1.2' << '-7.7' --- +string(36) "313434313135313838303735383535383732" +--- testing: '1.2' << 'abc' --- +string(2) "31" +--- testing: '1.2' << '123abc' --- +string(36) "353736343630373532333033343233343838" +--- testing: '1.2' << '123e5' --- +string(36) "353736343630373532333033343233343838" +--- testing: '1.2' << '123e5xyz' --- +string(36) "353736343630373532333033343233343838" +--- testing: '1.2' << ' 123abc' --- +string(36) "353736343630373532333033343233343838" +--- testing: '1.2' << '123 abc' --- +string(36) "353736343630373532333033343233343838" +--- testing: '1.2' << '123abc ' --- +string(36) "353736343630373532333033343233343838" +--- testing: '1.2' << '3.4a' --- +string(2) "38" +--- testing: '1.2' << 'a5.9' --- +string(2) "31" +--- testing: '-7.7' << '0' --- +string(4) "2d37" +--- testing: '-7.7' << '65' --- +string(6) "2d3134" +--- testing: '-7.7' << '-44' --- +string(16) "2d37333430303332" +--- testing: '-7.7' << '1.2' --- +string(6) "2d3134" +--- testing: '-7.7' << '-7.7' --- +string(40) "2d31303038383036333136353330393931313034" +--- testing: '-7.7' << 'abc' --- +string(4) "2d37" +--- testing: '-7.7' << '123abc' --- +string(40) "2d34303335323235323636313233393634343136" +--- testing: '-7.7' << '123e5' --- +string(40) "2d34303335323235323636313233393634343136" +--- testing: '-7.7' << '123e5xyz' --- +string(40) "2d34303335323235323636313233393634343136" +--- testing: '-7.7' << ' 123abc' --- +string(40) "2d34303335323235323636313233393634343136" +--- testing: '-7.7' << '123 abc' --- +string(40) "2d34303335323235323636313233393634343136" +--- testing: '-7.7' << '123abc ' --- +string(40) "2d34303335323235323636313233393634343136" +--- testing: '-7.7' << '3.4a' --- +string(6) "2d3536" +--- testing: '-7.7' << 'a5.9' --- +string(4) "2d37" +--- testing: 'abc' << '0' --- +string(2) "30" +--- testing: 'abc' << '65' --- +string(2) "30" +--- testing: 'abc' << '-44' --- +string(2) "30" +--- testing: 'abc' << '1.2' --- +string(2) "30" +--- testing: 'abc' << '-7.7' --- +string(2) "30" +--- testing: 'abc' << 'abc' --- +string(2) "30" +--- testing: 'abc' << '123abc' --- +string(2) "30" +--- testing: 'abc' << '123e5' --- +string(2) "30" +--- testing: 'abc' << '123e5xyz' --- +string(2) "30" +--- testing: 'abc' << ' 123abc' --- +string(2) "30" +--- testing: 'abc' << '123 abc' --- +string(2) "30" +--- testing: 'abc' << '123abc ' --- +string(2) "30" +--- testing: 'abc' << '3.4a' --- +string(2) "30" +--- testing: 'abc' << 'a5.9' --- +string(2) "30" +--- testing: '123abc' << '0' --- +string(6) "313233" +--- testing: '123abc' << '65' --- +string(6) "323436" +--- testing: '123abc' << '-44' --- +string(18) "313238393734383438" +--- testing: '123abc' << '1.2' --- +string(6) "323436" +--- testing: '123abc' << '-7.7' --- +string(38) "2d373230353735393430333739323739333630" +--- testing: '123abc' << 'abc' --- +string(6) "313233" +--- testing: '123abc' << '123abc' --- +string(40) "2d32383832333033373631353137313137343430" +--- testing: '123abc' << '123e5' --- +string(40) "2d32383832333033373631353137313137343430" +--- testing: '123abc' << '123e5xyz' --- +string(40) "2d32383832333033373631353137313137343430" +--- testing: '123abc' << ' 123abc' --- +string(40) "2d32383832333033373631353137313137343430" +--- testing: '123abc' << '123 abc' --- +string(40) "2d32383832333033373631353137313137343430" +--- testing: '123abc' << '123abc ' --- +string(40) "2d32383832333033373631353137313137343430" +--- testing: '123abc' << '3.4a' --- +string(6) "393834" +--- testing: '123abc' << 'a5.9' --- +string(6) "313233" +--- testing: '123e5' << '0' --- +string(6) "313233" +--- testing: '123e5' << '65' --- +string(6) "323436" +--- testing: '123e5' << '-44' --- +string(18) "313238393734383438" +--- testing: '123e5' << '1.2' --- +string(6) "323436" +--- testing: '123e5' << '-7.7' --- +string(38) "2d373230353735393430333739323739333630" +--- testing: '123e5' << 'abc' --- +string(6) "313233" +--- testing: '123e5' << '123abc' --- +string(40) "2d32383832333033373631353137313137343430" +--- testing: '123e5' << '123e5' --- +string(40) "2d32383832333033373631353137313137343430" +--- testing: '123e5' << '123e5xyz' --- +string(40) "2d32383832333033373631353137313137343430" +--- testing: '123e5' << ' 123abc' --- +string(40) "2d32383832333033373631353137313137343430" +--- testing: '123e5' << '123 abc' --- +string(40) "2d32383832333033373631353137313137343430" +--- testing: '123e5' << '123abc ' --- +string(40) "2d32383832333033373631353137313137343430" +--- testing: '123e5' << '3.4a' --- +string(6) "393834" +--- testing: '123e5' << 'a5.9' --- +string(6) "313233" +--- testing: '123e5xyz' << '0' --- +string(6) "313233" +--- testing: '123e5xyz' << '65' --- +string(6) "323436" +--- testing: '123e5xyz' << '-44' --- +string(18) "313238393734383438" +--- testing: '123e5xyz' << '1.2' --- +string(6) "323436" +--- testing: '123e5xyz' << '-7.7' --- +string(38) "2d373230353735393430333739323739333630" +--- testing: '123e5xyz' << 'abc' --- +string(6) "313233" +--- testing: '123e5xyz' << '123abc' --- +string(40) "2d32383832333033373631353137313137343430" +--- testing: '123e5xyz' << '123e5' --- +string(40) "2d32383832333033373631353137313137343430" +--- testing: '123e5xyz' << '123e5xyz' --- +string(40) "2d32383832333033373631353137313137343430" +--- testing: '123e5xyz' << ' 123abc' --- +string(40) "2d32383832333033373631353137313137343430" +--- testing: '123e5xyz' << '123 abc' --- +string(40) "2d32383832333033373631353137313137343430" +--- testing: '123e5xyz' << '123abc ' --- +string(40) "2d32383832333033373631353137313137343430" +--- testing: '123e5xyz' << '3.4a' --- +string(6) "393834" +--- testing: '123e5xyz' << 'a5.9' --- +string(6) "313233" +--- testing: ' 123abc' << '0' --- +string(6) "313233" +--- testing: ' 123abc' << '65' --- +string(6) "323436" +--- testing: ' 123abc' << '-44' --- +string(18) "313238393734383438" +--- testing: ' 123abc' << '1.2' --- +string(6) "323436" +--- testing: ' 123abc' << '-7.7' --- +string(38) "2d373230353735393430333739323739333630" +--- testing: ' 123abc' << 'abc' --- +string(6) "313233" +--- testing: ' 123abc' << '123abc' --- +string(40) "2d32383832333033373631353137313137343430" +--- testing: ' 123abc' << '123e5' --- +string(40) "2d32383832333033373631353137313137343430" +--- testing: ' 123abc' << '123e5xyz' --- +string(40) "2d32383832333033373631353137313137343430" +--- testing: ' 123abc' << ' 123abc' --- +string(40) "2d32383832333033373631353137313137343430" +--- testing: ' 123abc' << '123 abc' --- +string(40) "2d32383832333033373631353137313137343430" +--- testing: ' 123abc' << '123abc ' --- +string(40) "2d32383832333033373631353137313137343430" +--- testing: ' 123abc' << '3.4a' --- +string(6) "393834" +--- testing: ' 123abc' << 'a5.9' --- +string(6) "313233" +--- testing: '123 abc' << '0' --- +string(6) "313233" +--- testing: '123 abc' << '65' --- +string(6) "323436" +--- testing: '123 abc' << '-44' --- +string(18) "313238393734383438" +--- testing: '123 abc' << '1.2' --- +string(6) "323436" +--- testing: '123 abc' << '-7.7' --- +string(38) "2d373230353735393430333739323739333630" +--- testing: '123 abc' << 'abc' --- +string(6) "313233" +--- testing: '123 abc' << '123abc' --- +string(40) "2d32383832333033373631353137313137343430" +--- testing: '123 abc' << '123e5' --- +string(40) "2d32383832333033373631353137313137343430" +--- testing: '123 abc' << '123e5xyz' --- +string(40) "2d32383832333033373631353137313137343430" +--- testing: '123 abc' << ' 123abc' --- +string(40) "2d32383832333033373631353137313137343430" +--- testing: '123 abc' << '123 abc' --- +string(40) "2d32383832333033373631353137313137343430" +--- testing: '123 abc' << '123abc ' --- +string(40) "2d32383832333033373631353137313137343430" +--- testing: '123 abc' << '3.4a' --- +string(6) "393834" +--- testing: '123 abc' << 'a5.9' --- +string(6) "313233" +--- testing: '123abc ' << '0' --- +string(6) "313233" +--- testing: '123abc ' << '65' --- +string(6) "323436" +--- testing: '123abc ' << '-44' --- +string(18) "313238393734383438" +--- testing: '123abc ' << '1.2' --- +string(6) "323436" +--- testing: '123abc ' << '-7.7' --- +string(38) "2d373230353735393430333739323739333630" +--- testing: '123abc ' << 'abc' --- +string(6) "313233" +--- testing: '123abc ' << '123abc' --- +string(40) "2d32383832333033373631353137313137343430" +--- testing: '123abc ' << '123e5' --- +string(40) "2d32383832333033373631353137313137343430" +--- testing: '123abc ' << '123e5xyz' --- +string(40) "2d32383832333033373631353137313137343430" +--- testing: '123abc ' << ' 123abc' --- +string(40) "2d32383832333033373631353137313137343430" +--- testing: '123abc ' << '123 abc' --- +string(40) "2d32383832333033373631353137313137343430" +--- testing: '123abc ' << '123abc ' --- +string(40) "2d32383832333033373631353137313137343430" +--- testing: '123abc ' << '3.4a' --- +string(6) "393834" +--- testing: '123abc ' << 'a5.9' --- +string(6) "313233" +--- testing: '3.4a' << '0' --- +string(2) "33" +--- testing: '3.4a' << '65' --- +string(2) "36" +--- testing: '3.4a' << '-44' --- +string(14) "33313435373238" +--- testing: '3.4a' << '1.2' --- +string(2) "36" +--- testing: '3.4a' << '-7.7' --- +string(36) "343332333435353634323237353637363136" +--- testing: '3.4a' << 'abc' --- +string(2) "33" +--- testing: '3.4a' << '123abc' --- +string(38) "31373239333832323536393130323730343634" +--- testing: '3.4a' << '123e5' --- +string(38) "31373239333832323536393130323730343634" +--- testing: '3.4a' << '123e5xyz' --- +string(38) "31373239333832323536393130323730343634" +--- testing: '3.4a' << ' 123abc' --- +string(38) "31373239333832323536393130323730343634" +--- testing: '3.4a' << '123 abc' --- +string(38) "31373239333832323536393130323730343634" +--- testing: '3.4a' << '123abc ' --- +string(38) "31373239333832323536393130323730343634" +--- testing: '3.4a' << '3.4a' --- +string(4) "3234" +--- testing: '3.4a' << 'a5.9' --- +string(2) "33" +--- testing: 'a5.9' << '0' --- +string(2) "30" +--- testing: 'a5.9' << '65' --- +string(2) "30" +--- testing: 'a5.9' << '-44' --- +string(2) "30" +--- testing: 'a5.9' << '1.2' --- +string(2) "30" +--- testing: 'a5.9' << '-7.7' --- +string(2) "30" +--- testing: 'a5.9' << 'abc' --- +string(2) "30" +--- testing: 'a5.9' << '123abc' --- +string(2) "30" +--- testing: 'a5.9' << '123e5' --- +string(2) "30" +--- testing: 'a5.9' << '123e5xyz' --- +string(2) "30" +--- testing: 'a5.9' << ' 123abc' --- +string(2) "30" +--- testing: 'a5.9' << '123 abc' --- +string(2) "30" +--- testing: 'a5.9' << '123abc ' --- +string(2) "30" +--- testing: 'a5.9' << '3.4a' --- +string(2) "30" +--- testing: 'a5.9' << 'a5.9' --- +string(2) "30"
+===DONE===
diff --git a/tests/lang/operators/bitwiseShiftRight_basiclong_64bit.phpt b/tests/lang/operators/bitwiseShiftRight_basiclong_64bit.phpt new file mode 100644 index 0000000..1029d19 --- /dev/null +++ b/tests/lang/operators/bitwiseShiftRight_basiclong_64bit.phpt @@ -0,0 +1,583 @@ +--TEST-- +Test >> operator : 64bit long tests +--SKIPIF-- +<?php +if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); +?> +--FILE-- +<?php + +define("MAX_64Bit", 9223372036854775807); +define("MAX_32Bit", 2147483647); +define("MIN_64Bit", -9223372036854775807 - 1); +define("MIN_32Bit", -2147483647 - 1); + +$longVals = array( + MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit, + MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1, + MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1 +); + +$otherVals = array(0, 1, -1, 7, 9, 65, -44, MAX_32Bit, MAX_64Bit); + +error_reporting(E_ERROR); + +foreach ($longVals as $longVal) { + foreach($otherVals as $otherVal) { + echo "--- testing: $longVal >> $otherVal ---\n"; + var_dump($longVal>>$otherVal); + } +} + +foreach ($otherVals as $otherVal) { + foreach($longVals as $longVal) { + echo "--- testing: $otherVal >> $longVal ---\n"; + var_dump($otherVal>>$longVal); + } +} + +?> +===DONE=== +--EXPECT-- +--- testing: 9223372036854775807 >> 0 --- +int(9223372036854775807) +--- testing: 9223372036854775807 >> 1 --- +int(4611686018427387903) +--- testing: 9223372036854775807 >> -1 --- +int(0) +--- testing: 9223372036854775807 >> 7 --- +int(72057594037927935) +--- testing: 9223372036854775807 >> 9 --- +int(18014398509481983) +--- testing: 9223372036854775807 >> 65 --- +int(4611686018427387903) +--- testing: 9223372036854775807 >> -44 --- +int(8796093022207) +--- testing: 9223372036854775807 >> 2147483647 --- +int(0) +--- testing: 9223372036854775807 >> 9223372036854775807 --- +int(0) +--- testing: -9223372036854775808 >> 0 --- +int(-9223372036854775808) +--- testing: -9223372036854775808 >> 1 --- +int(-4611686018427387904) +--- testing: -9223372036854775808 >> -1 --- +int(-1) +--- testing: -9223372036854775808 >> 7 --- +int(-72057594037927936) +--- testing: -9223372036854775808 >> 9 --- +int(-18014398509481984) +--- testing: -9223372036854775808 >> 65 --- +int(-4611686018427387904) +--- testing: -9223372036854775808 >> -44 --- +int(-8796093022208) +--- testing: -9223372036854775808 >> 2147483647 --- +int(-1) +--- testing: -9223372036854775808 >> 9223372036854775807 --- +int(-1) +--- testing: 2147483647 >> 0 --- +int(2147483647) +--- testing: 2147483647 >> 1 --- +int(1073741823) +--- testing: 2147483647 >> -1 --- +int(0) +--- testing: 2147483647 >> 7 --- +int(16777215) +--- testing: 2147483647 >> 9 --- +int(4194303) +--- testing: 2147483647 >> 65 --- +int(1073741823) +--- testing: 2147483647 >> -44 --- +int(2047) +--- testing: 2147483647 >> 2147483647 --- +int(0) +--- testing: 2147483647 >> 9223372036854775807 --- +int(0) +--- testing: -2147483648 >> 0 --- +int(-2147483648) +--- testing: -2147483648 >> 1 --- +int(-1073741824) +--- testing: -2147483648 >> -1 --- +int(-1) +--- testing: -2147483648 >> 7 --- +int(-16777216) +--- testing: -2147483648 >> 9 --- +int(-4194304) +--- testing: -2147483648 >> 65 --- +int(-1073741824) +--- testing: -2147483648 >> -44 --- +int(-2048) +--- testing: -2147483648 >> 2147483647 --- +int(-1) +--- testing: -2147483648 >> 9223372036854775807 --- +int(-1) +--- testing: 9223372034707292160 >> 0 --- +int(9223372034707292160) +--- testing: 9223372034707292160 >> 1 --- +int(4611686017353646080) +--- testing: 9223372034707292160 >> -1 --- +int(0) +--- testing: 9223372034707292160 >> 7 --- +int(72057594021150720) +--- testing: 9223372034707292160 >> 9 --- +int(18014398505287680) +--- testing: 9223372034707292160 >> 65 --- +int(4611686017353646080) +--- testing: 9223372034707292160 >> -44 --- +int(8796093020160) +--- testing: 9223372034707292160 >> 2147483647 --- +int(0) +--- testing: 9223372034707292160 >> 9223372036854775807 --- +int(0) +--- testing: -9223372034707292160 >> 0 --- +int(-9223372034707292160) +--- testing: -9223372034707292160 >> 1 --- +int(-4611686017353646080) +--- testing: -9223372034707292160 >> -1 --- +int(-1) +--- testing: -9223372034707292160 >> 7 --- +int(-72057594021150720) +--- testing: -9223372034707292160 >> 9 --- +int(-18014398505287680) +--- testing: -9223372034707292160 >> 65 --- +int(-4611686017353646080) +--- testing: -9223372034707292160 >> -44 --- +int(-8796093020160) +--- testing: -9223372034707292160 >> 2147483647 --- +int(-1) +--- testing: -9223372034707292160 >> 9223372036854775807 --- +int(-1) +--- testing: 2147483648 >> 0 --- +int(2147483648) +--- testing: 2147483648 >> 1 --- +int(1073741824) +--- testing: 2147483648 >> -1 --- +int(0) +--- testing: 2147483648 >> 7 --- +int(16777216) +--- testing: 2147483648 >> 9 --- +int(4194304) +--- testing: 2147483648 >> 65 --- +int(1073741824) +--- testing: 2147483648 >> -44 --- +int(2048) +--- testing: 2147483648 >> 2147483647 --- +int(0) +--- testing: 2147483648 >> 9223372036854775807 --- +int(0) +--- testing: -2147483649 >> 0 --- +int(-2147483649) +--- testing: -2147483649 >> 1 --- +int(-1073741825) +--- testing: -2147483649 >> -1 --- +int(-1) +--- testing: -2147483649 >> 7 --- +int(-16777217) +--- testing: -2147483649 >> 9 --- +int(-4194305) +--- testing: -2147483649 >> 65 --- +int(-1073741825) +--- testing: -2147483649 >> -44 --- +int(-2049) +--- testing: -2147483649 >> 2147483647 --- +int(-1) +--- testing: -2147483649 >> 9223372036854775807 --- +int(-1) +--- testing: 4294967294 >> 0 --- +int(4294967294) +--- testing: 4294967294 >> 1 --- +int(2147483647) +--- testing: 4294967294 >> -1 --- +int(0) +--- testing: 4294967294 >> 7 --- +int(33554431) +--- testing: 4294967294 >> 9 --- +int(8388607) +--- testing: 4294967294 >> 65 --- +int(2147483647) +--- testing: 4294967294 >> -44 --- +int(4095) +--- testing: 4294967294 >> 2147483647 --- +int(0) +--- testing: 4294967294 >> 9223372036854775807 --- +int(0) +--- testing: 4294967295 >> 0 --- +int(4294967295) +--- testing: 4294967295 >> 1 --- +int(2147483647) +--- testing: 4294967295 >> -1 --- +int(0) +--- testing: 4294967295 >> 7 --- +int(33554431) +--- testing: 4294967295 >> 9 --- +int(8388607) +--- testing: 4294967295 >> 65 --- +int(2147483647) +--- testing: 4294967295 >> -44 --- +int(4095) +--- testing: 4294967295 >> 2147483647 --- +int(0) +--- testing: 4294967295 >> 9223372036854775807 --- +int(0) +--- testing: 4294967293 >> 0 --- +int(4294967293) +--- testing: 4294967293 >> 1 --- +int(2147483646) +--- testing: 4294967293 >> -1 --- +int(0) +--- testing: 4294967293 >> 7 --- +int(33554431) +--- testing: 4294967293 >> 9 --- +int(8388607) +--- testing: 4294967293 >> 65 --- +int(2147483646) +--- testing: 4294967293 >> -44 --- +int(4095) +--- testing: 4294967293 >> 2147483647 --- +int(0) +--- testing: 4294967293 >> 9223372036854775807 --- +int(0) +--- testing: 9223372036854775806 >> 0 --- +int(9223372036854775806) +--- testing: 9223372036854775806 >> 1 --- +int(4611686018427387903) +--- testing: 9223372036854775806 >> -1 --- +int(0) +--- testing: 9223372036854775806 >> 7 --- +int(72057594037927935) +--- testing: 9223372036854775806 >> 9 --- +int(18014398509481983) +--- testing: 9223372036854775806 >> 65 --- +int(4611686018427387903) +--- testing: 9223372036854775806 >> -44 --- +int(8796093022207) +--- testing: 9223372036854775806 >> 2147483647 --- +int(0) +--- testing: 9223372036854775806 >> 9223372036854775807 --- +int(0) +--- testing: 9.2233720368548E+18 >> 0 --- +int(-9223372036854775808) +--- testing: 9.2233720368548E+18 >> 1 --- +int(-4611686018427387904) +--- testing: 9.2233720368548E+18 >> -1 --- +int(-1) +--- testing: 9.2233720368548E+18 >> 7 --- +int(-72057594037927936) +--- testing: 9.2233720368548E+18 >> 9 --- +int(-18014398509481984) +--- testing: 9.2233720368548E+18 >> 65 --- +int(-4611686018427387904) +--- testing: 9.2233720368548E+18 >> -44 --- +int(-8796093022208) +--- testing: 9.2233720368548E+18 >> 2147483647 --- +int(-1) +--- testing: 9.2233720368548E+18 >> 9223372036854775807 --- +int(-1) +--- testing: -9223372036854775807 >> 0 --- +int(-9223372036854775807) +--- testing: -9223372036854775807 >> 1 --- +int(-4611686018427387904) +--- testing: -9223372036854775807 >> -1 --- +int(-1) +--- testing: -9223372036854775807 >> 7 --- +int(-72057594037927936) +--- testing: -9223372036854775807 >> 9 --- +int(-18014398509481984) +--- testing: -9223372036854775807 >> 65 --- +int(-4611686018427387904) +--- testing: -9223372036854775807 >> -44 --- +int(-8796093022208) +--- testing: -9223372036854775807 >> 2147483647 --- +int(-1) +--- testing: -9223372036854775807 >> 9223372036854775807 --- +int(-1) +--- testing: -9.2233720368548E+18 >> 0 --- +int(-9223372036854775808) +--- testing: -9.2233720368548E+18 >> 1 --- +int(-4611686018427387904) +--- testing: -9.2233720368548E+18 >> -1 --- +int(-1) +--- testing: -9.2233720368548E+18 >> 7 --- +int(-72057594037927936) +--- testing: -9.2233720368548E+18 >> 9 --- +int(-18014398509481984) +--- testing: -9.2233720368548E+18 >> 65 --- +int(-4611686018427387904) +--- testing: -9.2233720368548E+18 >> -44 --- +int(-8796093022208) +--- testing: -9.2233720368548E+18 >> 2147483647 --- +int(-1) +--- testing: -9.2233720368548E+18 >> 9223372036854775807 --- +int(-1) +--- testing: 0 >> 9223372036854775807 --- +int(0) +--- testing: 0 >> -9223372036854775808 --- +int(0) +--- testing: 0 >> 2147483647 --- +int(0) +--- testing: 0 >> -2147483648 --- +int(0) +--- testing: 0 >> 9223372034707292160 --- +int(0) +--- testing: 0 >> -9223372034707292160 --- +int(0) +--- testing: 0 >> 2147483648 --- +int(0) +--- testing: 0 >> -2147483649 --- +int(0) +--- testing: 0 >> 4294967294 --- +int(0) +--- testing: 0 >> 4294967295 --- +int(0) +--- testing: 0 >> 4294967293 --- +int(0) +--- testing: 0 >> 9223372036854775806 --- +int(0) +--- testing: 0 >> 9.2233720368548E+18 --- +int(0) +--- testing: 0 >> -9223372036854775807 --- +int(0) +--- testing: 0 >> -9.2233720368548E+18 --- +int(0) +--- testing: 1 >> 9223372036854775807 --- +int(0) +--- testing: 1 >> -9223372036854775808 --- +int(1) +--- testing: 1 >> 2147483647 --- +int(0) +--- testing: 1 >> -2147483648 --- +int(1) +--- testing: 1 >> 9223372034707292160 --- +int(1) +--- testing: 1 >> -9223372034707292160 --- +int(1) +--- testing: 1 >> 2147483648 --- +int(1) +--- testing: 1 >> -2147483649 --- +int(0) +--- testing: 1 >> 4294967294 --- +int(0) +--- testing: 1 >> 4294967295 --- +int(0) +--- testing: 1 >> 4294967293 --- +int(0) +--- testing: 1 >> 9223372036854775806 --- +int(0) +--- testing: 1 >> 9.2233720368548E+18 --- +int(1) +--- testing: 1 >> -9223372036854775807 --- +int(0) +--- testing: 1 >> -9.2233720368548E+18 --- +int(1) +--- testing: -1 >> 9223372036854775807 --- +int(-1) +--- testing: -1 >> -9223372036854775808 --- +int(-1) +--- testing: -1 >> 2147483647 --- +int(-1) +--- testing: -1 >> -2147483648 --- +int(-1) +--- testing: -1 >> 9223372034707292160 --- +int(-1) +--- testing: -1 >> -9223372034707292160 --- +int(-1) +--- testing: -1 >> 2147483648 --- +int(-1) +--- testing: -1 >> -2147483649 --- +int(-1) +--- testing: -1 >> 4294967294 --- +int(-1) +--- testing: -1 >> 4294967295 --- +int(-1) +--- testing: -1 >> 4294967293 --- +int(-1) +--- testing: -1 >> 9223372036854775806 --- +int(-1) +--- testing: -1 >> 9.2233720368548E+18 --- +int(-1) +--- testing: -1 >> -9223372036854775807 --- +int(-1) +--- testing: -1 >> -9.2233720368548E+18 --- +int(-1) +--- testing: 7 >> 9223372036854775807 --- +int(0) +--- testing: 7 >> -9223372036854775808 --- +int(7) +--- testing: 7 >> 2147483647 --- +int(0) +--- testing: 7 >> -2147483648 --- +int(7) +--- testing: 7 >> 9223372034707292160 --- +int(7) +--- testing: 7 >> -9223372034707292160 --- +int(7) +--- testing: 7 >> 2147483648 --- +int(7) +--- testing: 7 >> -2147483649 --- +int(0) +--- testing: 7 >> 4294967294 --- +int(0) +--- testing: 7 >> 4294967295 --- +int(0) +--- testing: 7 >> 4294967293 --- +int(0) +--- testing: 7 >> 9223372036854775806 --- +int(0) +--- testing: 7 >> 9.2233720368548E+18 --- +int(7) +--- testing: 7 >> -9223372036854775807 --- +int(3) +--- testing: 7 >> -9.2233720368548E+18 --- +int(7) +--- testing: 9 >> 9223372036854775807 --- +int(0) +--- testing: 9 >> -9223372036854775808 --- +int(9) +--- testing: 9 >> 2147483647 --- +int(0) +--- testing: 9 >> -2147483648 --- +int(9) +--- testing: 9 >> 9223372034707292160 --- +int(9) +--- testing: 9 >> -9223372034707292160 --- +int(9) +--- testing: 9 >> 2147483648 --- +int(9) +--- testing: 9 >> -2147483649 --- +int(0) +--- testing: 9 >> 4294967294 --- +int(0) +--- testing: 9 >> 4294967295 --- +int(0) +--- testing: 9 >> 4294967293 --- +int(0) +--- testing: 9 >> 9223372036854775806 --- +int(0) +--- testing: 9 >> 9.2233720368548E+18 --- +int(9) +--- testing: 9 >> -9223372036854775807 --- +int(4) +--- testing: 9 >> -9.2233720368548E+18 --- +int(9) +--- testing: 65 >> 9223372036854775807 --- +int(0) +--- testing: 65 >> -9223372036854775808 --- +int(65) +--- testing: 65 >> 2147483647 --- +int(0) +--- testing: 65 >> -2147483648 --- +int(65) +--- testing: 65 >> 9223372034707292160 --- +int(65) +--- testing: 65 >> -9223372034707292160 --- +int(65) +--- testing: 65 >> 2147483648 --- +int(65) +--- testing: 65 >> -2147483649 --- +int(0) +--- testing: 65 >> 4294967294 --- +int(0) +--- testing: 65 >> 4294967295 --- +int(0) +--- testing: 65 >> 4294967293 --- +int(0) +--- testing: 65 >> 9223372036854775806 --- +int(0) +--- testing: 65 >> 9.2233720368548E+18 --- +int(65) +--- testing: 65 >> -9223372036854775807 --- +int(32) +--- testing: 65 >> -9.2233720368548E+18 --- +int(65) +--- testing: -44 >> 9223372036854775807 --- +int(-1) +--- testing: -44 >> -9223372036854775808 --- +int(-44) +--- testing: -44 >> 2147483647 --- +int(-1) +--- testing: -44 >> -2147483648 --- +int(-44) +--- testing: -44 >> 9223372034707292160 --- +int(-44) +--- testing: -44 >> -9223372034707292160 --- +int(-44) +--- testing: -44 >> 2147483648 --- +int(-44) +--- testing: -44 >> -2147483649 --- +int(-1) +--- testing: -44 >> 4294967294 --- +int(-1) +--- testing: -44 >> 4294967295 --- +int(-1) +--- testing: -44 >> 4294967293 --- +int(-1) +--- testing: -44 >> 9223372036854775806 --- +int(-1) +--- testing: -44 >> 9.2233720368548E+18 --- +int(-44) +--- testing: -44 >> -9223372036854775807 --- +int(-22) +--- testing: -44 >> -9.2233720368548E+18 --- +int(-44) +--- testing: 2147483647 >> 9223372036854775807 --- +int(0) +--- testing: 2147483647 >> -9223372036854775808 --- +int(2147483647) +--- testing: 2147483647 >> 2147483647 --- +int(0) +--- testing: 2147483647 >> -2147483648 --- +int(2147483647) +--- testing: 2147483647 >> 9223372034707292160 --- +int(2147483647) +--- testing: 2147483647 >> -9223372034707292160 --- +int(2147483647) +--- testing: 2147483647 >> 2147483648 --- +int(2147483647) +--- testing: 2147483647 >> -2147483649 --- +int(0) +--- testing: 2147483647 >> 4294967294 --- +int(0) +--- testing: 2147483647 >> 4294967295 --- +int(0) +--- testing: 2147483647 >> 4294967293 --- +int(0) +--- testing: 2147483647 >> 9223372036854775806 --- +int(0) +--- testing: 2147483647 >> 9.2233720368548E+18 --- +int(2147483647) +--- testing: 2147483647 >> -9223372036854775807 --- +int(1073741823) +--- testing: 2147483647 >> -9.2233720368548E+18 --- +int(2147483647) +--- testing: 9223372036854775807 >> 9223372036854775807 --- +int(0) +--- testing: 9223372036854775807 >> -9223372036854775808 --- +int(9223372036854775807) +--- testing: 9223372036854775807 >> 2147483647 --- +int(0) +--- testing: 9223372036854775807 >> -2147483648 --- +int(9223372036854775807) +--- testing: 9223372036854775807 >> 9223372034707292160 --- +int(9223372036854775807) +--- testing: 9223372036854775807 >> -9223372034707292160 --- +int(9223372036854775807) +--- testing: 9223372036854775807 >> 2147483648 --- +int(9223372036854775807) +--- testing: 9223372036854775807 >> -2147483649 --- +int(0) +--- testing: 9223372036854775807 >> 4294967294 --- +int(1) +--- testing: 9223372036854775807 >> 4294967295 --- +int(0) +--- testing: 9223372036854775807 >> 4294967293 --- +int(3) +--- testing: 9223372036854775807 >> 9223372036854775806 --- +int(1) +--- testing: 9223372036854775807 >> 9.2233720368548E+18 --- +int(9223372036854775807) +--- testing: 9223372036854775807 >> -9223372036854775807 --- +int(4611686018427387903) +--- testing: 9223372036854775807 >> -9.2233720368548E+18 --- +int(9223372036854775807) +===DONE=== +
\ No newline at end of file diff --git a/tests/lang/operators/bitwiseShiftRight_variationStr.phpt b/tests/lang/operators/bitwiseShiftRight_variationStr.phpt new file mode 100644 index 0000000..9518d42 --- /dev/null +++ b/tests/lang/operators/bitwiseShiftRight_variationStr.phpt @@ -0,0 +1,416 @@ +--TEST--
+Test >> operator : various numbers as strings
+--FILE--
+<?php
+
+$strVals = array(
+ "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",
+ "a5.9"
+);
+
+error_reporting(E_ERROR);
+
+foreach ($strVals as $strVal) {
+ foreach($strVals as $otherVal) {
+ echo "--- testing: '$strVal' >> '$otherVal' ---\n";
+ var_dump(bin2hex($strVal>>$otherVal));
+ }
+}
+
+
+?>
+===DONE===
+--EXPECT--
+--- testing: '0' >> '0' --- +string(2) "30" +--- testing: '0' >> '65' --- +string(2) "30" +--- testing: '0' >> '-44' --- +string(2) "30" +--- testing: '0' >> '1.2' --- +string(2) "30" +--- testing: '0' >> '-7.7' --- +string(2) "30" +--- testing: '0' >> 'abc' --- +string(2) "30" +--- testing: '0' >> '123abc' --- +string(2) "30" +--- testing: '0' >> '123e5' --- +string(2) "30" +--- testing: '0' >> '123e5xyz' --- +string(2) "30" +--- testing: '0' >> ' 123abc' --- +string(2) "30" +--- testing: '0' >> '123 abc' --- +string(2) "30" +--- testing: '0' >> '123abc ' --- +string(2) "30" +--- testing: '0' >> '3.4a' --- +string(2) "30" +--- testing: '0' >> 'a5.9' --- +string(2) "30" +--- testing: '65' >> '0' --- +string(4) "3635" +--- testing: '65' >> '65' --- +string(4) "3332" +--- testing: '65' >> '-44' --- +string(2) "30" +--- testing: '65' >> '1.2' --- +string(4) "3332" +--- testing: '65' >> '-7.7' --- +string(2) "30" +--- testing: '65' >> 'abc' --- +string(4) "3635" +--- testing: '65' >> '123abc' --- +string(2) "30" +--- testing: '65' >> '123e5' --- +string(2) "30" +--- testing: '65' >> '123e5xyz' --- +string(2) "30" +--- testing: '65' >> ' 123abc' --- +string(2) "30" +--- testing: '65' >> '123 abc' --- +string(2) "30" +--- testing: '65' >> '123abc ' --- +string(2) "30" +--- testing: '65' >> '3.4a' --- +string(2) "38" +--- testing: '65' >> 'a5.9' --- +string(4) "3635" +--- testing: '-44' >> '0' --- +string(6) "2d3434" +--- testing: '-44' >> '65' --- +string(6) "2d3232" +--- testing: '-44' >> '-44' --- +string(4) "2d31" +--- testing: '-44' >> '1.2' --- +string(6) "2d3232" +--- testing: '-44' >> '-7.7' --- +string(4) "2d31" +--- testing: '-44' >> 'abc' --- +string(6) "2d3434" +--- testing: '-44' >> '123abc' --- +string(4) "2d31" +--- testing: '-44' >> '123e5' --- +string(4) "2d31" +--- testing: '-44' >> '123e5xyz' --- +string(4) "2d31" +--- testing: '-44' >> ' 123abc' --- +string(4) "2d31" +--- testing: '-44' >> '123 abc' --- +string(4) "2d31" +--- testing: '-44' >> '123abc ' --- +string(4) "2d31" +--- testing: '-44' >> '3.4a' --- +string(4) "2d36" +--- testing: '-44' >> 'a5.9' --- +string(6) "2d3434" +--- testing: '1.2' >> '0' --- +string(2) "31" +--- testing: '1.2' >> '65' --- +string(2) "30" +--- testing: '1.2' >> '-44' --- +string(2) "30" +--- testing: '1.2' >> '1.2' --- +string(2) "30" +--- testing: '1.2' >> '-7.7' --- +string(2) "30" +--- testing: '1.2' >> 'abc' --- +string(2) "31" +--- testing: '1.2' >> '123abc' --- +string(2) "30" +--- testing: '1.2' >> '123e5' --- +string(2) "30" +--- testing: '1.2' >> '123e5xyz' --- +string(2) "30" +--- testing: '1.2' >> ' 123abc' --- +string(2) "30" +--- testing: '1.2' >> '123 abc' --- +string(2) "30" +--- testing: '1.2' >> '123abc ' --- +string(2) "30" +--- testing: '1.2' >> '3.4a' --- +string(2) "30" +--- testing: '1.2' >> 'a5.9' --- +string(2) "31" +--- testing: '-7.7' >> '0' --- +string(4) "2d37" +--- testing: '-7.7' >> '65' --- +string(4) "2d34" +--- testing: '-7.7' >> '-44' --- +string(4) "2d31" +--- testing: '-7.7' >> '1.2' --- +string(4) "2d34" +--- testing: '-7.7' >> '-7.7' --- +string(4) "2d31" +--- testing: '-7.7' >> 'abc' --- +string(4) "2d37" +--- testing: '-7.7' >> '123abc' --- +string(4) "2d31" +--- testing: '-7.7' >> '123e5' --- +string(4) "2d31" +--- testing: '-7.7' >> '123e5xyz' --- +string(4) "2d31" +--- testing: '-7.7' >> ' 123abc' --- +string(4) "2d31" +--- testing: '-7.7' >> '123 abc' --- +string(4) "2d31" +--- testing: '-7.7' >> '123abc ' --- +string(4) "2d31" +--- testing: '-7.7' >> '3.4a' --- +string(4) "2d31" +--- testing: '-7.7' >> 'a5.9' --- +string(4) "2d37" +--- testing: 'abc' >> '0' --- +string(2) "30" +--- testing: 'abc' >> '65' --- +string(2) "30" +--- testing: 'abc' >> '-44' --- +string(2) "30" +--- testing: 'abc' >> '1.2' --- +string(2) "30" +--- testing: 'abc' >> '-7.7' --- +string(2) "30" +--- testing: 'abc' >> 'abc' --- +string(2) "30" +--- testing: 'abc' >> '123abc' --- +string(2) "30" +--- testing: 'abc' >> '123e5' --- +string(2) "30" +--- testing: 'abc' >> '123e5xyz' --- +string(2) "30" +--- testing: 'abc' >> ' 123abc' --- +string(2) "30" +--- testing: 'abc' >> '123 abc' --- +string(2) "30" +--- testing: 'abc' >> '123abc ' --- +string(2) "30" +--- testing: 'abc' >> '3.4a' --- +string(2) "30" +--- testing: 'abc' >> 'a5.9' --- +string(2) "30" +--- testing: '123abc' >> '0' --- +string(6) "313233" +--- testing: '123abc' >> '65' --- +string(4) "3631" +--- testing: '123abc' >> '-44' --- +string(2) "30" +--- testing: '123abc' >> '1.2' --- +string(4) "3631" +--- testing: '123abc' >> '-7.7' --- +string(2) "30" +--- testing: '123abc' >> 'abc' --- +string(6) "313233" +--- testing: '123abc' >> '123abc' --- +string(2) "30" +--- testing: '123abc' >> '123e5' --- +string(2) "30" +--- testing: '123abc' >> '123e5xyz' --- +string(2) "30" +--- testing: '123abc' >> ' 123abc' --- +string(2) "30" +--- testing: '123abc' >> '123 abc' --- +string(2) "30" +--- testing: '123abc' >> '123abc ' --- +string(2) "30" +--- testing: '123abc' >> '3.4a' --- +string(4) "3135" +--- testing: '123abc' >> 'a5.9' --- +string(6) "313233" +--- testing: '123e5' >> '0' --- +string(6) "313233" +--- testing: '123e5' >> '65' --- +string(4) "3631" +--- testing: '123e5' >> '-44' --- +string(2) "30" +--- testing: '123e5' >> '1.2' --- +string(4) "3631" +--- testing: '123e5' >> '-7.7' --- +string(2) "30" +--- testing: '123e5' >> 'abc' --- +string(6) "313233" +--- testing: '123e5' >> '123abc' --- +string(2) "30" +--- testing: '123e5' >> '123e5' --- +string(2) "30" +--- testing: '123e5' >> '123e5xyz' --- +string(2) "30" +--- testing: '123e5' >> ' 123abc' --- +string(2) "30" +--- testing: '123e5' >> '123 abc' --- +string(2) "30" +--- testing: '123e5' >> '123abc ' --- +string(2) "30" +--- testing: '123e5' >> '3.4a' --- +string(4) "3135" +--- testing: '123e5' >> 'a5.9' --- +string(6) "313233" +--- testing: '123e5xyz' >> '0' --- +string(6) "313233" +--- testing: '123e5xyz' >> '65' --- +string(4) "3631" +--- testing: '123e5xyz' >> '-44' --- +string(2) "30" +--- testing: '123e5xyz' >> '1.2' --- +string(4) "3631" +--- testing: '123e5xyz' >> '-7.7' --- +string(2) "30" +--- testing: '123e5xyz' >> 'abc' --- +string(6) "313233" +--- testing: '123e5xyz' >> '123abc' --- +string(2) "30" +--- testing: '123e5xyz' >> '123e5' --- +string(2) "30" +--- testing: '123e5xyz' >> '123e5xyz' --- +string(2) "30" +--- testing: '123e5xyz' >> ' 123abc' --- +string(2) "30" +--- testing: '123e5xyz' >> '123 abc' --- +string(2) "30" +--- testing: '123e5xyz' >> '123abc ' --- +string(2) "30" +--- testing: '123e5xyz' >> '3.4a' --- +string(4) "3135" +--- testing: '123e5xyz' >> 'a5.9' --- +string(6) "313233" +--- testing: ' 123abc' >> '0' --- +string(6) "313233" +--- testing: ' 123abc' >> '65' --- +string(4) "3631" +--- testing: ' 123abc' >> '-44' --- +string(2) "30" +--- testing: ' 123abc' >> '1.2' --- +string(4) "3631" +--- testing: ' 123abc' >> '-7.7' --- +string(2) "30" +--- testing: ' 123abc' >> 'abc' --- +string(6) "313233" +--- testing: ' 123abc' >> '123abc' --- +string(2) "30" +--- testing: ' 123abc' >> '123e5' --- +string(2) "30" +--- testing: ' 123abc' >> '123e5xyz' --- +string(2) "30" +--- testing: ' 123abc' >> ' 123abc' --- +string(2) "30" +--- testing: ' 123abc' >> '123 abc' --- +string(2) "30" +--- testing: ' 123abc' >> '123abc ' --- +string(2) "30" +--- testing: ' 123abc' >> '3.4a' --- +string(4) "3135" +--- testing: ' 123abc' >> 'a5.9' --- +string(6) "313233" +--- testing: '123 abc' >> '0' --- +string(6) "313233" +--- testing: '123 abc' >> '65' --- +string(4) "3631" +--- testing: '123 abc' >> '-44' --- +string(2) "30" +--- testing: '123 abc' >> '1.2' --- +string(4) "3631" +--- testing: '123 abc' >> '-7.7' --- +string(2) "30" +--- testing: '123 abc' >> 'abc' --- +string(6) "313233" +--- testing: '123 abc' >> '123abc' --- +string(2) "30" +--- testing: '123 abc' >> '123e5' --- +string(2) "30" +--- testing: '123 abc' >> '123e5xyz' --- +string(2) "30" +--- testing: '123 abc' >> ' 123abc' --- +string(2) "30" +--- testing: '123 abc' >> '123 abc' --- +string(2) "30" +--- testing: '123 abc' >> '123abc ' --- +string(2) "30" +--- testing: '123 abc' >> '3.4a' --- +string(4) "3135" +--- testing: '123 abc' >> 'a5.9' --- +string(6) "313233" +--- testing: '123abc ' >> '0' --- +string(6) "313233" +--- testing: '123abc ' >> '65' --- +string(4) "3631" +--- testing: '123abc ' >> '-44' --- +string(2) "30" +--- testing: '123abc ' >> '1.2' --- +string(4) "3631" +--- testing: '123abc ' >> '-7.7' --- +string(2) "30" +--- testing: '123abc ' >> 'abc' --- +string(6) "313233" +--- testing: '123abc ' >> '123abc' --- +string(2) "30" +--- testing: '123abc ' >> '123e5' --- +string(2) "30" +--- testing: '123abc ' >> '123e5xyz' --- +string(2) "30" +--- testing: '123abc ' >> ' 123abc' --- +string(2) "30" +--- testing: '123abc ' >> '123 abc' --- +string(2) "30" +--- testing: '123abc ' >> '123abc ' --- +string(2) "30" +--- testing: '123abc ' >> '3.4a' --- +string(4) "3135" +--- testing: '123abc ' >> 'a5.9' --- +string(6) "313233" +--- testing: '3.4a' >> '0' --- +string(2) "33" +--- testing: '3.4a' >> '65' --- +string(2) "31" +--- testing: '3.4a' >> '-44' --- +string(2) "30" +--- testing: '3.4a' >> '1.2' --- +string(2) "31" +--- testing: '3.4a' >> '-7.7' --- +string(2) "30" +--- testing: '3.4a' >> 'abc' --- +string(2) "33" +--- testing: '3.4a' >> '123abc' --- +string(2) "30" +--- testing: '3.4a' >> '123e5' --- +string(2) "30" +--- testing: '3.4a' >> '123e5xyz' --- +string(2) "30" +--- testing: '3.4a' >> ' 123abc' --- +string(2) "30" +--- testing: '3.4a' >> '123 abc' --- +string(2) "30" +--- testing: '3.4a' >> '123abc ' --- +string(2) "30" +--- testing: '3.4a' >> '3.4a' --- +string(2) "30" +--- testing: '3.4a' >> 'a5.9' --- +string(2) "33" +--- testing: 'a5.9' >> '0' --- +string(2) "30" +--- testing: 'a5.9' >> '65' --- +string(2) "30" +--- testing: 'a5.9' >> '-44' --- +string(2) "30" +--- testing: 'a5.9' >> '1.2' --- +string(2) "30" +--- testing: 'a5.9' >> '-7.7' --- +string(2) "30" +--- testing: 'a5.9' >> 'abc' --- +string(2) "30" +--- testing: 'a5.9' >> '123abc' --- +string(2) "30" +--- testing: 'a5.9' >> '123e5' --- +string(2) "30" +--- testing: 'a5.9' >> '123e5xyz' --- +string(2) "30" +--- testing: 'a5.9' >> ' 123abc' --- +string(2) "30" +--- testing: 'a5.9' >> '123 abc' --- +string(2) "30" +--- testing: 'a5.9' >> '123abc ' --- +string(2) "30" +--- testing: 'a5.9' >> '3.4a' --- +string(2) "30" +--- testing: 'a5.9' >> 'a5.9' --- +string(2) "30"
+===DONE===
diff --git a/tests/lang/operators/bitwiseXor_basiclong_64bit.phpt b/tests/lang/operators/bitwiseXor_basiclong_64bit.phpt new file mode 100644 index 0000000..2764be6 --- /dev/null +++ b/tests/lang/operators/bitwiseXor_basiclong_64bit.phpt @@ -0,0 +1,583 @@ +--TEST-- +Test ^ operator : 64bit long tests +--SKIPIF-- +<?php +if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); +?> +--FILE-- +<?php + +define("MAX_64Bit", 9223372036854775807); +define("MAX_32Bit", 2147483647); +define("MIN_64Bit", -9223372036854775807 - 1); +define("MIN_32Bit", -2147483647 - 1); + +$longVals = array( + MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit, + MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1, + MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1 +); + +$otherVals = array(0, 1, -1, 7, 9, 65, -44, MAX_32Bit, MAX_64Bit); + +error_reporting(E_ERROR); + +foreach ($longVals as $longVal) { + foreach($otherVals as $otherVal) { + echo "--- testing: $longVal ^ $otherVal ---\n"; + var_dump($longVal^$otherVal); + } +} + +foreach ($otherVals as $otherVal) { + foreach($longVals as $longVal) { + echo "--- testing: $otherVal ^ $longVal ---\n"; + var_dump($otherVal^$longVal); + } +} + +?> +===DONE=== +--EXPECT-- +--- testing: 9223372036854775807 ^ 0 --- +int(9223372036854775807) +--- testing: 9223372036854775807 ^ 1 --- +int(9223372036854775806) +--- testing: 9223372036854775807 ^ -1 --- +int(-9223372036854775808) +--- testing: 9223372036854775807 ^ 7 --- +int(9223372036854775800) +--- testing: 9223372036854775807 ^ 9 --- +int(9223372036854775798) +--- testing: 9223372036854775807 ^ 65 --- +int(9223372036854775742) +--- testing: 9223372036854775807 ^ -44 --- +int(-9223372036854775765) +--- testing: 9223372036854775807 ^ 2147483647 --- +int(9223372034707292160) +--- testing: 9223372036854775807 ^ 9223372036854775807 --- +int(0) +--- testing: -9223372036854775808 ^ 0 --- +int(-9223372036854775808) +--- testing: -9223372036854775808 ^ 1 --- +int(-9223372036854775807) +--- testing: -9223372036854775808 ^ -1 --- +int(9223372036854775807) +--- testing: -9223372036854775808 ^ 7 --- +int(-9223372036854775801) +--- testing: -9223372036854775808 ^ 9 --- +int(-9223372036854775799) +--- testing: -9223372036854775808 ^ 65 --- +int(-9223372036854775743) +--- testing: -9223372036854775808 ^ -44 --- +int(9223372036854775764) +--- testing: -9223372036854775808 ^ 2147483647 --- +int(-9223372034707292161) +--- testing: -9223372036854775808 ^ 9223372036854775807 --- +int(-1) +--- testing: 2147483647 ^ 0 --- +int(2147483647) +--- testing: 2147483647 ^ 1 --- +int(2147483646) +--- testing: 2147483647 ^ -1 --- +int(-2147483648) +--- testing: 2147483647 ^ 7 --- +int(2147483640) +--- testing: 2147483647 ^ 9 --- +int(2147483638) +--- testing: 2147483647 ^ 65 --- +int(2147483582) +--- testing: 2147483647 ^ -44 --- +int(-2147483605) +--- testing: 2147483647 ^ 2147483647 --- +int(0) +--- testing: 2147483647 ^ 9223372036854775807 --- +int(9223372034707292160) +--- testing: -2147483648 ^ 0 --- +int(-2147483648) +--- testing: -2147483648 ^ 1 --- +int(-2147483647) +--- testing: -2147483648 ^ -1 --- +int(2147483647) +--- testing: -2147483648 ^ 7 --- +int(-2147483641) +--- testing: -2147483648 ^ 9 --- +int(-2147483639) +--- testing: -2147483648 ^ 65 --- +int(-2147483583) +--- testing: -2147483648 ^ -44 --- +int(2147483604) +--- testing: -2147483648 ^ 2147483647 --- +int(-1) +--- testing: -2147483648 ^ 9223372036854775807 --- +int(-9223372034707292161) +--- testing: 9223372034707292160 ^ 0 --- +int(9223372034707292160) +--- testing: 9223372034707292160 ^ 1 --- +int(9223372034707292161) +--- testing: 9223372034707292160 ^ -1 --- +int(-9223372034707292161) +--- testing: 9223372034707292160 ^ 7 --- +int(9223372034707292167) +--- testing: 9223372034707292160 ^ 9 --- +int(9223372034707292169) +--- testing: 9223372034707292160 ^ 65 --- +int(9223372034707292225) +--- testing: 9223372034707292160 ^ -44 --- +int(-9223372034707292204) +--- testing: 9223372034707292160 ^ 2147483647 --- +int(9223372036854775807) +--- testing: 9223372034707292160 ^ 9223372036854775807 --- +int(2147483647) +--- testing: -9223372034707292160 ^ 0 --- +int(-9223372034707292160) +--- testing: -9223372034707292160 ^ 1 --- +int(-9223372034707292159) +--- testing: -9223372034707292160 ^ -1 --- +int(9223372034707292159) +--- testing: -9223372034707292160 ^ 7 --- +int(-9223372034707292153) +--- testing: -9223372034707292160 ^ 9 --- +int(-9223372034707292151) +--- testing: -9223372034707292160 ^ 65 --- +int(-9223372034707292095) +--- testing: -9223372034707292160 ^ -44 --- +int(9223372034707292116) +--- testing: -9223372034707292160 ^ 2147483647 --- +int(-9223372032559808513) +--- testing: -9223372034707292160 ^ 9223372036854775807 --- +int(-2147483649) +--- testing: 2147483648 ^ 0 --- +int(2147483648) +--- testing: 2147483648 ^ 1 --- +int(2147483649) +--- testing: 2147483648 ^ -1 --- +int(-2147483649) +--- testing: 2147483648 ^ 7 --- +int(2147483655) +--- testing: 2147483648 ^ 9 --- +int(2147483657) +--- testing: 2147483648 ^ 65 --- +int(2147483713) +--- testing: 2147483648 ^ -44 --- +int(-2147483692) +--- testing: 2147483648 ^ 2147483647 --- +int(4294967295) +--- testing: 2147483648 ^ 9223372036854775807 --- +int(9223372034707292159) +--- testing: -2147483649 ^ 0 --- +int(-2147483649) +--- testing: -2147483649 ^ 1 --- +int(-2147483650) +--- testing: -2147483649 ^ -1 --- +int(2147483648) +--- testing: -2147483649 ^ 7 --- +int(-2147483656) +--- testing: -2147483649 ^ 9 --- +int(-2147483658) +--- testing: -2147483649 ^ 65 --- +int(-2147483714) +--- testing: -2147483649 ^ -44 --- +int(2147483691) +--- testing: -2147483649 ^ 2147483647 --- +int(-4294967296) +--- testing: -2147483649 ^ 9223372036854775807 --- +int(-9223372034707292160) +--- testing: 4294967294 ^ 0 --- +int(4294967294) +--- testing: 4294967294 ^ 1 --- +int(4294967295) +--- testing: 4294967294 ^ -1 --- +int(-4294967295) +--- testing: 4294967294 ^ 7 --- +int(4294967289) +--- testing: 4294967294 ^ 9 --- +int(4294967287) +--- testing: 4294967294 ^ 65 --- +int(4294967231) +--- testing: 4294967294 ^ -44 --- +int(-4294967254) +--- testing: 4294967294 ^ 2147483647 --- +int(2147483649) +--- testing: 4294967294 ^ 9223372036854775807 --- +int(9223372032559808513) +--- testing: 4294967295 ^ 0 --- +int(4294967295) +--- testing: 4294967295 ^ 1 --- +int(4294967294) +--- testing: 4294967295 ^ -1 --- +int(-4294967296) +--- testing: 4294967295 ^ 7 --- +int(4294967288) +--- testing: 4294967295 ^ 9 --- +int(4294967286) +--- testing: 4294967295 ^ 65 --- +int(4294967230) +--- testing: 4294967295 ^ -44 --- +int(-4294967253) +--- testing: 4294967295 ^ 2147483647 --- +int(2147483648) +--- testing: 4294967295 ^ 9223372036854775807 --- +int(9223372032559808512) +--- testing: 4294967293 ^ 0 --- +int(4294967293) +--- testing: 4294967293 ^ 1 --- +int(4294967292) +--- testing: 4294967293 ^ -1 --- +int(-4294967294) +--- testing: 4294967293 ^ 7 --- +int(4294967290) +--- testing: 4294967293 ^ 9 --- +int(4294967284) +--- testing: 4294967293 ^ 65 --- +int(4294967228) +--- testing: 4294967293 ^ -44 --- +int(-4294967255) +--- testing: 4294967293 ^ 2147483647 --- +int(2147483650) +--- testing: 4294967293 ^ 9223372036854775807 --- +int(9223372032559808514) +--- testing: 9223372036854775806 ^ 0 --- +int(9223372036854775806) +--- testing: 9223372036854775806 ^ 1 --- +int(9223372036854775807) +--- testing: 9223372036854775806 ^ -1 --- +int(-9223372036854775807) +--- testing: 9223372036854775806 ^ 7 --- +int(9223372036854775801) +--- testing: 9223372036854775806 ^ 9 --- +int(9223372036854775799) +--- testing: 9223372036854775806 ^ 65 --- +int(9223372036854775743) +--- testing: 9223372036854775806 ^ -44 --- +int(-9223372036854775766) +--- testing: 9223372036854775806 ^ 2147483647 --- +int(9223372034707292161) +--- testing: 9223372036854775806 ^ 9223372036854775807 --- +int(1) +--- testing: 9.2233720368548E+18 ^ 0 --- +int(-9223372036854775808) +--- testing: 9.2233720368548E+18 ^ 1 --- +int(-9223372036854775807) +--- testing: 9.2233720368548E+18 ^ -1 --- +int(9223372036854775807) +--- testing: 9.2233720368548E+18 ^ 7 --- +int(-9223372036854775801) +--- testing: 9.2233720368548E+18 ^ 9 --- +int(-9223372036854775799) +--- testing: 9.2233720368548E+18 ^ 65 --- +int(-9223372036854775743) +--- testing: 9.2233720368548E+18 ^ -44 --- +int(9223372036854775764) +--- testing: 9.2233720368548E+18 ^ 2147483647 --- +int(-9223372034707292161) +--- testing: 9.2233720368548E+18 ^ 9223372036854775807 --- +int(-1) +--- testing: -9223372036854775807 ^ 0 --- +int(-9223372036854775807) +--- testing: -9223372036854775807 ^ 1 --- +int(-9223372036854775808) +--- testing: -9223372036854775807 ^ -1 --- +int(9223372036854775806) +--- testing: -9223372036854775807 ^ 7 --- +int(-9223372036854775802) +--- testing: -9223372036854775807 ^ 9 --- +int(-9223372036854775800) +--- testing: -9223372036854775807 ^ 65 --- +int(-9223372036854775744) +--- testing: -9223372036854775807 ^ -44 --- +int(9223372036854775765) +--- testing: -9223372036854775807 ^ 2147483647 --- +int(-9223372034707292162) +--- testing: -9223372036854775807 ^ 9223372036854775807 --- +int(-2) +--- testing: -9.2233720368548E+18 ^ 0 --- +int(-9223372036854775808) +--- testing: -9.2233720368548E+18 ^ 1 --- +int(-9223372036854775807) +--- testing: -9.2233720368548E+18 ^ -1 --- +int(9223372036854775807) +--- testing: -9.2233720368548E+18 ^ 7 --- +int(-9223372036854775801) +--- testing: -9.2233720368548E+18 ^ 9 --- +int(-9223372036854775799) +--- testing: -9.2233720368548E+18 ^ 65 --- +int(-9223372036854775743) +--- testing: -9.2233720368548E+18 ^ -44 --- +int(9223372036854775764) +--- testing: -9.2233720368548E+18 ^ 2147483647 --- +int(-9223372034707292161) +--- testing: -9.2233720368548E+18 ^ 9223372036854775807 --- +int(-1) +--- testing: 0 ^ 9223372036854775807 --- +int(9223372036854775807) +--- testing: 0 ^ -9223372036854775808 --- +int(-9223372036854775808) +--- testing: 0 ^ 2147483647 --- +int(2147483647) +--- testing: 0 ^ -2147483648 --- +int(-2147483648) +--- testing: 0 ^ 9223372034707292160 --- +int(9223372034707292160) +--- testing: 0 ^ -9223372034707292160 --- +int(-9223372034707292160) +--- testing: 0 ^ 2147483648 --- +int(2147483648) +--- testing: 0 ^ -2147483649 --- +int(-2147483649) +--- testing: 0 ^ 4294967294 --- +int(4294967294) +--- testing: 0 ^ 4294967295 --- +int(4294967295) +--- testing: 0 ^ 4294967293 --- +int(4294967293) +--- testing: 0 ^ 9223372036854775806 --- +int(9223372036854775806) +--- testing: 0 ^ 9.2233720368548E+18 --- +int(-9223372036854775808) +--- testing: 0 ^ -9223372036854775807 --- +int(-9223372036854775807) +--- testing: 0 ^ -9.2233720368548E+18 --- +int(-9223372036854775808) +--- testing: 1 ^ 9223372036854775807 --- +int(9223372036854775806) +--- testing: 1 ^ -9223372036854775808 --- +int(-9223372036854775807) +--- testing: 1 ^ 2147483647 --- +int(2147483646) +--- testing: 1 ^ -2147483648 --- +int(-2147483647) +--- testing: 1 ^ 9223372034707292160 --- +int(9223372034707292161) +--- testing: 1 ^ -9223372034707292160 --- +int(-9223372034707292159) +--- testing: 1 ^ 2147483648 --- +int(2147483649) +--- testing: 1 ^ -2147483649 --- +int(-2147483650) +--- testing: 1 ^ 4294967294 --- +int(4294967295) +--- testing: 1 ^ 4294967295 --- +int(4294967294) +--- testing: 1 ^ 4294967293 --- +int(4294967292) +--- testing: 1 ^ 9223372036854775806 --- +int(9223372036854775807) +--- testing: 1 ^ 9.2233720368548E+18 --- +int(-9223372036854775807) +--- testing: 1 ^ -9223372036854775807 --- +int(-9223372036854775808) +--- testing: 1 ^ -9.2233720368548E+18 --- +int(-9223372036854775807) +--- testing: -1 ^ 9223372036854775807 --- +int(-9223372036854775808) +--- testing: -1 ^ -9223372036854775808 --- +int(9223372036854775807) +--- testing: -1 ^ 2147483647 --- +int(-2147483648) +--- testing: -1 ^ -2147483648 --- +int(2147483647) +--- testing: -1 ^ 9223372034707292160 --- +int(-9223372034707292161) +--- testing: -1 ^ -9223372034707292160 --- +int(9223372034707292159) +--- testing: -1 ^ 2147483648 --- +int(-2147483649) +--- testing: -1 ^ -2147483649 --- +int(2147483648) +--- testing: -1 ^ 4294967294 --- +int(-4294967295) +--- testing: -1 ^ 4294967295 --- +int(-4294967296) +--- testing: -1 ^ 4294967293 --- +int(-4294967294) +--- testing: -1 ^ 9223372036854775806 --- +int(-9223372036854775807) +--- testing: -1 ^ 9.2233720368548E+18 --- +int(9223372036854775807) +--- testing: -1 ^ -9223372036854775807 --- +int(9223372036854775806) +--- testing: -1 ^ -9.2233720368548E+18 --- +int(9223372036854775807) +--- testing: 7 ^ 9223372036854775807 --- +int(9223372036854775800) +--- testing: 7 ^ -9223372036854775808 --- +int(-9223372036854775801) +--- testing: 7 ^ 2147483647 --- +int(2147483640) +--- testing: 7 ^ -2147483648 --- +int(-2147483641) +--- testing: 7 ^ 9223372034707292160 --- +int(9223372034707292167) +--- testing: 7 ^ -9223372034707292160 --- +int(-9223372034707292153) +--- testing: 7 ^ 2147483648 --- +int(2147483655) +--- testing: 7 ^ -2147483649 --- +int(-2147483656) +--- testing: 7 ^ 4294967294 --- +int(4294967289) +--- testing: 7 ^ 4294967295 --- +int(4294967288) +--- testing: 7 ^ 4294967293 --- +int(4294967290) +--- testing: 7 ^ 9223372036854775806 --- +int(9223372036854775801) +--- testing: 7 ^ 9.2233720368548E+18 --- +int(-9223372036854775801) +--- testing: 7 ^ -9223372036854775807 --- +int(-9223372036854775802) +--- testing: 7 ^ -9.2233720368548E+18 --- +int(-9223372036854775801) +--- testing: 9 ^ 9223372036854775807 --- +int(9223372036854775798) +--- testing: 9 ^ -9223372036854775808 --- +int(-9223372036854775799) +--- testing: 9 ^ 2147483647 --- +int(2147483638) +--- testing: 9 ^ -2147483648 --- +int(-2147483639) +--- testing: 9 ^ 9223372034707292160 --- +int(9223372034707292169) +--- testing: 9 ^ -9223372034707292160 --- +int(-9223372034707292151) +--- testing: 9 ^ 2147483648 --- +int(2147483657) +--- testing: 9 ^ -2147483649 --- +int(-2147483658) +--- testing: 9 ^ 4294967294 --- +int(4294967287) +--- testing: 9 ^ 4294967295 --- +int(4294967286) +--- testing: 9 ^ 4294967293 --- +int(4294967284) +--- testing: 9 ^ 9223372036854775806 --- +int(9223372036854775799) +--- testing: 9 ^ 9.2233720368548E+18 --- +int(-9223372036854775799) +--- testing: 9 ^ -9223372036854775807 --- +int(-9223372036854775800) +--- testing: 9 ^ -9.2233720368548E+18 --- +int(-9223372036854775799) +--- testing: 65 ^ 9223372036854775807 --- +int(9223372036854775742) +--- testing: 65 ^ -9223372036854775808 --- +int(-9223372036854775743) +--- testing: 65 ^ 2147483647 --- +int(2147483582) +--- testing: 65 ^ -2147483648 --- +int(-2147483583) +--- testing: 65 ^ 9223372034707292160 --- +int(9223372034707292225) +--- testing: 65 ^ -9223372034707292160 --- +int(-9223372034707292095) +--- testing: 65 ^ 2147483648 --- +int(2147483713) +--- testing: 65 ^ -2147483649 --- +int(-2147483714) +--- testing: 65 ^ 4294967294 --- +int(4294967231) +--- testing: 65 ^ 4294967295 --- +int(4294967230) +--- testing: 65 ^ 4294967293 --- +int(4294967228) +--- testing: 65 ^ 9223372036854775806 --- +int(9223372036854775743) +--- testing: 65 ^ 9.2233720368548E+18 --- +int(-9223372036854775743) +--- testing: 65 ^ -9223372036854775807 --- +int(-9223372036854775744) +--- testing: 65 ^ -9.2233720368548E+18 --- +int(-9223372036854775743) +--- testing: -44 ^ 9223372036854775807 --- +int(-9223372036854775765) +--- testing: -44 ^ -9223372036854775808 --- +int(9223372036854775764) +--- testing: -44 ^ 2147483647 --- +int(-2147483605) +--- testing: -44 ^ -2147483648 --- +int(2147483604) +--- testing: -44 ^ 9223372034707292160 --- +int(-9223372034707292204) +--- testing: -44 ^ -9223372034707292160 --- +int(9223372034707292116) +--- testing: -44 ^ 2147483648 --- +int(-2147483692) +--- testing: -44 ^ -2147483649 --- +int(2147483691) +--- testing: -44 ^ 4294967294 --- +int(-4294967254) +--- testing: -44 ^ 4294967295 --- +int(-4294967253) +--- testing: -44 ^ 4294967293 --- +int(-4294967255) +--- testing: -44 ^ 9223372036854775806 --- +int(-9223372036854775766) +--- testing: -44 ^ 9.2233720368548E+18 --- +int(9223372036854775764) +--- testing: -44 ^ -9223372036854775807 --- +int(9223372036854775765) +--- testing: -44 ^ -9.2233720368548E+18 --- +int(9223372036854775764) +--- testing: 2147483647 ^ 9223372036854775807 --- +int(9223372034707292160) +--- testing: 2147483647 ^ -9223372036854775808 --- +int(-9223372034707292161) +--- testing: 2147483647 ^ 2147483647 --- +int(0) +--- testing: 2147483647 ^ -2147483648 --- +int(-1) +--- testing: 2147483647 ^ 9223372034707292160 --- +int(9223372036854775807) +--- testing: 2147483647 ^ -9223372034707292160 --- +int(-9223372032559808513) +--- testing: 2147483647 ^ 2147483648 --- +int(4294967295) +--- testing: 2147483647 ^ -2147483649 --- +int(-4294967296) +--- testing: 2147483647 ^ 4294967294 --- +int(2147483649) +--- testing: 2147483647 ^ 4294967295 --- +int(2147483648) +--- testing: 2147483647 ^ 4294967293 --- +int(2147483650) +--- testing: 2147483647 ^ 9223372036854775806 --- +int(9223372034707292161) +--- testing: 2147483647 ^ 9.2233720368548E+18 --- +int(-9223372034707292161) +--- testing: 2147483647 ^ -9223372036854775807 --- +int(-9223372034707292162) +--- testing: 2147483647 ^ -9.2233720368548E+18 --- +int(-9223372034707292161) +--- testing: 9223372036854775807 ^ 9223372036854775807 --- +int(0) +--- testing: 9223372036854775807 ^ -9223372036854775808 --- +int(-1) +--- testing: 9223372036854775807 ^ 2147483647 --- +int(9223372034707292160) +--- testing: 9223372036854775807 ^ -2147483648 --- +int(-9223372034707292161) +--- testing: 9223372036854775807 ^ 9223372034707292160 --- +int(2147483647) +--- testing: 9223372036854775807 ^ -9223372034707292160 --- +int(-2147483649) +--- testing: 9223372036854775807 ^ 2147483648 --- +int(9223372034707292159) +--- testing: 9223372036854775807 ^ -2147483649 --- +int(-9223372034707292160) +--- testing: 9223372036854775807 ^ 4294967294 --- +int(9223372032559808513) +--- testing: 9223372036854775807 ^ 4294967295 --- +int(9223372032559808512) +--- testing: 9223372036854775807 ^ 4294967293 --- +int(9223372032559808514) +--- testing: 9223372036854775807 ^ 9223372036854775806 --- +int(1) +--- testing: 9223372036854775807 ^ 9.2233720368548E+18 --- +int(-1) +--- testing: 9223372036854775807 ^ -9223372036854775807 --- +int(-2) +--- testing: 9223372036854775807 ^ -9.2233720368548E+18 --- +int(-1) +===DONE=== +
\ No newline at end of file diff --git a/tests/lang/operators/bitwiseXor_variationStr.phpt b/tests/lang/operators/bitwiseXor_variationStr.phpt new file mode 100644 index 0000000..7dda659 --- /dev/null +++ b/tests/lang/operators/bitwiseXor_variationStr.phpt @@ -0,0 +1,416 @@ +--TEST--
+Test ^ operator : various numbers as strings
+--FILE--
+<?php
+
+$strVals = array(
+ "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",
+ "a5.9"
+);
+
+error_reporting(E_ERROR);
+
+foreach ($strVals as $strVal) {
+ foreach($strVals as $otherVal) {
+ echo "--- testing: '$strVal' ^ '$otherVal' ---\n";
+ var_dump(bin2hex($strVal^$otherVal));
+ }
+}
+
+
+?>
+===DONE===
+--EXPECT--
+--- testing: '0' ^ '0' --- +string(2) "00" +--- testing: '0' ^ '65' --- +string(2) "06" +--- testing: '0' ^ '-44' --- +string(2) "1d" +--- testing: '0' ^ '1.2' --- +string(2) "01" +--- testing: '0' ^ '-7.7' --- +string(2) "1d" +--- testing: '0' ^ 'abc' --- +string(2) "51" +--- testing: '0' ^ '123abc' --- +string(2) "01" +--- testing: '0' ^ '123e5' --- +string(2) "01" +--- testing: '0' ^ '123e5xyz' --- +string(2) "01" +--- testing: '0' ^ ' 123abc' --- +string(2) "10" +--- testing: '0' ^ '123 abc' --- +string(2) "01" +--- testing: '0' ^ '123abc ' --- +string(2) "01" +--- testing: '0' ^ '3.4a' --- +string(2) "03" +--- testing: '0' ^ 'a5.9' --- +string(2) "51" +--- testing: '65' ^ '0' --- +string(2) "06" +--- testing: '65' ^ '65' --- +string(4) "0000" +--- testing: '65' ^ '-44' --- +string(4) "1b01" +--- testing: '65' ^ '1.2' --- +string(4) "071b" +--- testing: '65' ^ '-7.7' --- +string(4) "1b02" +--- testing: '65' ^ 'abc' --- +string(4) "5757" +--- testing: '65' ^ '123abc' --- +string(4) "0707" +--- testing: '65' ^ '123e5' --- +string(4) "0707" +--- testing: '65' ^ '123e5xyz' --- +string(4) "0707" +--- testing: '65' ^ ' 123abc' --- +string(4) "1604" +--- testing: '65' ^ '123 abc' --- +string(4) "0707" +--- testing: '65' ^ '123abc ' --- +string(4) "0707" +--- testing: '65' ^ '3.4a' --- +string(4) "051b" +--- testing: '65' ^ 'a5.9' --- +string(4) "5700" +--- testing: '-44' ^ '0' --- +string(2) "1d" +--- testing: '-44' ^ '65' --- +string(4) "1b01" +--- testing: '-44' ^ '-44' --- +string(6) "000000" +--- testing: '-44' ^ '1.2' --- +string(6) "1c1a06" +--- testing: '-44' ^ '-7.7' --- +string(6) "00031a" +--- testing: '-44' ^ 'abc' --- +string(6) "4c5657" +--- testing: '-44' ^ '123abc' --- +string(6) "1c0607" +--- testing: '-44' ^ '123e5' --- +string(6) "1c0607" +--- testing: '-44' ^ '123e5xyz' --- +string(6) "1c0607" +--- testing: '-44' ^ ' 123abc' --- +string(6) "0d0506" +--- testing: '-44' ^ '123 abc' --- +string(6) "1c0607" +--- testing: '-44' ^ '123abc ' --- +string(6) "1c0607" +--- testing: '-44' ^ '3.4a' --- +string(6) "1e1a00" +--- testing: '-44' ^ 'a5.9' --- +string(6) "4c011a" +--- testing: '1.2' ^ '0' --- +string(2) "01" +--- testing: '1.2' ^ '65' --- +string(4) "071b" +--- testing: '1.2' ^ '-44' --- +string(6) "1c1a06" +--- testing: '1.2' ^ '1.2' --- +string(6) "000000" +--- testing: '1.2' ^ '-7.7' --- +string(6) "1c191c" +--- testing: '1.2' ^ 'abc' --- +string(6) "504c51" +--- testing: '1.2' ^ '123abc' --- +string(6) "001c01" +--- testing: '1.2' ^ '123e5' --- +string(6) "001c01" +--- testing: '1.2' ^ '123e5xyz' --- +string(6) "001c01" +--- testing: '1.2' ^ ' 123abc' --- +string(6) "111f00" +--- testing: '1.2' ^ '123 abc' --- +string(6) "001c01" +--- testing: '1.2' ^ '123abc ' --- +string(6) "001c01" +--- testing: '1.2' ^ '3.4a' --- +string(6) "020006" +--- testing: '1.2' ^ 'a5.9' --- +string(6) "501b1c" +--- testing: '-7.7' ^ '0' --- +string(2) "1d" +--- testing: '-7.7' ^ '65' --- +string(4) "1b02" +--- testing: '-7.7' ^ '-44' --- +string(6) "00031a" +--- testing: '-7.7' ^ '1.2' --- +string(6) "1c191c" +--- testing: '-7.7' ^ '-7.7' --- +string(8) "00000000" +--- testing: '-7.7' ^ 'abc' --- +string(6) "4c554d" +--- testing: '-7.7' ^ '123abc' --- +string(8) "1c051d56" +--- testing: '-7.7' ^ '123e5' --- +string(8) "1c051d52" +--- testing: '-7.7' ^ '123e5xyz' --- +string(8) "1c051d52" +--- testing: '-7.7' ^ ' 123abc' --- +string(8) "0d061c04" +--- testing: '-7.7' ^ '123 abc' --- +string(8) "1c051d17" +--- testing: '-7.7' ^ '123abc ' --- +string(8) "1c051d56" +--- testing: '-7.7' ^ '3.4a' --- +string(8) "1e191a56" +--- testing: '-7.7' ^ 'a5.9' --- +string(8) "4c02000e" +--- testing: 'abc' ^ '0' --- +string(2) "51" +--- testing: 'abc' ^ '65' --- +string(4) "5757" +--- testing: 'abc' ^ '-44' --- +string(6) "4c5657" +--- testing: 'abc' ^ '1.2' --- +string(6) "504c51" +--- testing: 'abc' ^ '-7.7' --- +string(6) "4c554d" +--- testing: 'abc' ^ 'abc' --- +string(6) "000000" +--- testing: 'abc' ^ '123abc' --- +string(6) "505050" +--- testing: 'abc' ^ '123e5' --- +string(6) "505050" +--- testing: 'abc' ^ '123e5xyz' --- +string(6) "505050" +--- testing: 'abc' ^ ' 123abc' --- +string(6) "415351" +--- testing: 'abc' ^ '123 abc' --- +string(6) "505050" +--- testing: 'abc' ^ '123abc ' --- +string(6) "505050" +--- testing: 'abc' ^ '3.4a' --- +string(6) "524c57" +--- testing: 'abc' ^ 'a5.9' --- +string(6) "00574d" +--- testing: '123abc' ^ '0' --- +string(2) "01" +--- testing: '123abc' ^ '65' --- +string(4) "0707" +--- testing: '123abc' ^ '-44' --- +string(6) "1c0607" +--- testing: '123abc' ^ '1.2' --- +string(6) "001c01" +--- testing: '123abc' ^ '-7.7' --- +string(8) "1c051d56" +--- testing: '123abc' ^ 'abc' --- +string(6) "505050" +--- testing: '123abc' ^ '123abc' --- +string(12) "000000000000" +--- testing: '123abc' ^ '123e5' --- +string(10) "0000000457" +--- testing: '123abc' ^ '123e5xyz' --- +string(12) "00000004571b" +--- testing: '123abc' ^ ' 123abc' --- +string(12) "110301520301" +--- testing: '123abc' ^ '123 abc' --- +string(12) "000000410301" +--- testing: '123abc' ^ '123abc ' --- +string(12) "000000000000" +--- testing: '123abc' ^ '3.4a' --- +string(8) "021c0700" +--- testing: '123abc' ^ 'a5.9' --- +string(8) "50071d58" +--- testing: '123e5' ^ '0' --- +string(2) "01" +--- testing: '123e5' ^ '65' --- +string(4) "0707" +--- testing: '123e5' ^ '-44' --- +string(6) "1c0607" +--- testing: '123e5' ^ '1.2' --- +string(6) "001c01" +--- testing: '123e5' ^ '-7.7' --- +string(8) "1c051d52" +--- testing: '123e5' ^ 'abc' --- +string(6) "505050" +--- testing: '123e5' ^ '123abc' --- +string(10) "0000000457" +--- testing: '123e5' ^ '123e5' --- +string(10) "0000000000" +--- testing: '123e5' ^ '123e5xyz' --- +string(10) "0000000000" +--- testing: '123e5' ^ ' 123abc' --- +string(10) "1103015654" +--- testing: '123e5' ^ '123 abc' --- +string(10) "0000004554" +--- testing: '123e5' ^ '123abc ' --- +string(10) "0000000457" +--- testing: '123e5' ^ '3.4a' --- +string(8) "021c0704" +--- testing: '123e5' ^ 'a5.9' --- +string(8) "50071d5c" +--- testing: '123e5xyz' ^ '0' --- +string(2) "01" +--- testing: '123e5xyz' ^ '65' --- +string(4) "0707" +--- testing: '123e5xyz' ^ '-44' --- +string(6) "1c0607" +--- testing: '123e5xyz' ^ '1.2' --- +string(6) "001c01" +--- testing: '123e5xyz' ^ '-7.7' --- +string(8) "1c051d52" +--- testing: '123e5xyz' ^ 'abc' --- +string(6) "505050" +--- testing: '123e5xyz' ^ '123abc' --- +string(12) "00000004571b" +--- testing: '123e5xyz' ^ '123e5' --- +string(10) "0000000000" +--- testing: '123e5xyz' ^ '123e5xyz' --- +string(16) "0000000000000000" +--- testing: '123e5xyz' ^ ' 123abc' --- +string(14) "11030156541a1a" +--- testing: '123e5xyz' ^ '123 abc' --- +string(14) "00000045541a1a" +--- testing: '123e5xyz' ^ '123abc ' --- +string(14) "00000004571b59" +--- testing: '123e5xyz' ^ '3.4a' --- +string(8) "021c0704" +--- testing: '123e5xyz' ^ 'a5.9' --- +string(8) "50071d5c" +--- testing: ' 123abc' ^ '0' --- +string(2) "10" +--- testing: ' 123abc' ^ '65' --- +string(4) "1604" +--- testing: ' 123abc' ^ '-44' --- +string(6) "0d0506" +--- testing: ' 123abc' ^ '1.2' --- +string(6) "111f00" +--- testing: ' 123abc' ^ '-7.7' --- +string(8) "0d061c04" +--- testing: ' 123abc' ^ 'abc' --- +string(6) "415351" +--- testing: ' 123abc' ^ '123abc' --- +string(12) "110301520301" +--- testing: ' 123abc' ^ '123e5' --- +string(10) "1103015654" +--- testing: ' 123abc' ^ '123e5xyz' --- +string(14) "11030156541a1a" +--- testing: ' 123abc' ^ ' 123abc' --- +string(14) "00000000000000" +--- testing: ' 123abc' ^ '123 abc' --- +string(14) "11030113000000" +--- testing: ' 123abc' ^ '123abc ' --- +string(14) "11030152030143" +--- testing: ' 123abc' ^ '3.4a' --- +string(8) "131f0652" +--- testing: ' 123abc' ^ 'a5.9' --- +string(8) "41041c0a" +--- testing: '123 abc' ^ '0' --- +string(2) "01" +--- testing: '123 abc' ^ '65' --- +string(4) "0707" +--- testing: '123 abc' ^ '-44' --- +string(6) "1c0607" +--- testing: '123 abc' ^ '1.2' --- +string(6) "001c01" +--- testing: '123 abc' ^ '-7.7' --- +string(8) "1c051d17" +--- testing: '123 abc' ^ 'abc' --- +string(6) "505050" +--- testing: '123 abc' ^ '123abc' --- +string(12) "000000410301" +--- testing: '123 abc' ^ '123e5' --- +string(10) "0000004554" +--- testing: '123 abc' ^ '123e5xyz' --- +string(14) "00000045541a1a" +--- testing: '123 abc' ^ ' 123abc' --- +string(14) "11030113000000" +--- testing: '123 abc' ^ '123 abc' --- +string(14) "00000000000000" +--- testing: '123 abc' ^ '123abc ' --- +string(14) "00000041030143" +--- testing: '123 abc' ^ '3.4a' --- +string(8) "021c0741" +--- testing: '123 abc' ^ 'a5.9' --- +string(8) "50071d19" +--- testing: '123abc ' ^ '0' --- +string(2) "01" +--- testing: '123abc ' ^ '65' --- +string(4) "0707" +--- testing: '123abc ' ^ '-44' --- +string(6) "1c0607" +--- testing: '123abc ' ^ '1.2' --- +string(6) "001c01" +--- testing: '123abc ' ^ '-7.7' --- +string(8) "1c051d56" +--- testing: '123abc ' ^ 'abc' --- +string(6) "505050" +--- testing: '123abc ' ^ '123abc' --- +string(12) "000000000000" +--- testing: '123abc ' ^ '123e5' --- +string(10) "0000000457" +--- testing: '123abc ' ^ '123e5xyz' --- +string(14) "00000004571b59" +--- testing: '123abc ' ^ ' 123abc' --- +string(14) "11030152030143" +--- testing: '123abc ' ^ '123 abc' --- +string(14) "00000041030143" +--- testing: '123abc ' ^ '123abc ' --- +string(14) "00000000000000" +--- testing: '123abc ' ^ '3.4a' --- +string(8) "021c0700" +--- testing: '123abc ' ^ 'a5.9' --- +string(8) "50071d58" +--- testing: '3.4a' ^ '0' --- +string(2) "03" +--- testing: '3.4a' ^ '65' --- +string(4) "051b" +--- testing: '3.4a' ^ '-44' --- +string(6) "1e1a00" +--- testing: '3.4a' ^ '1.2' --- +string(6) "020006" +--- testing: '3.4a' ^ '-7.7' --- +string(8) "1e191a56" +--- testing: '3.4a' ^ 'abc' --- +string(6) "524c57" +--- testing: '3.4a' ^ '123abc' --- +string(8) "021c0700" +--- testing: '3.4a' ^ '123e5' --- +string(8) "021c0704" +--- testing: '3.4a' ^ '123e5xyz' --- +string(8) "021c0704" +--- testing: '3.4a' ^ ' 123abc' --- +string(8) "131f0652" +--- testing: '3.4a' ^ '123 abc' --- +string(8) "021c0741" +--- testing: '3.4a' ^ '123abc ' --- +string(8) "021c0700" +--- testing: '3.4a' ^ '3.4a' --- +string(8) "00000000" +--- testing: '3.4a' ^ 'a5.9' --- +string(8) "521b1a58" +--- testing: 'a5.9' ^ '0' --- +string(2) "51" +--- testing: 'a5.9' ^ '65' --- +string(4) "5700" +--- testing: 'a5.9' ^ '-44' --- +string(6) "4c011a" +--- testing: 'a5.9' ^ '1.2' --- +string(6) "501b1c" +--- testing: 'a5.9' ^ '-7.7' --- +string(8) "4c02000e" +--- testing: 'a5.9' ^ 'abc' --- +string(6) "00574d" +--- testing: 'a5.9' ^ '123abc' --- +string(8) "50071d58" +--- testing: 'a5.9' ^ '123e5' --- +string(8) "50071d5c" +--- testing: 'a5.9' ^ '123e5xyz' --- +string(8) "50071d5c" +--- testing: 'a5.9' ^ ' 123abc' --- +string(8) "41041c0a" +--- testing: 'a5.9' ^ '123 abc' --- +string(8) "50071d19" +--- testing: 'a5.9' ^ '123abc ' --- +string(8) "50071d58" +--- testing: 'a5.9' ^ '3.4a' --- +string(8) "521b1a58" +--- testing: 'a5.9' ^ 'a5.9' --- +string(8) "00000000"
+===DONE===
diff --git a/tests/lang/operators/divide_basiclong_64bit.phpt b/tests/lang/operators/divide_basiclong_64bit.phpt new file mode 100644 index 0000000..b5d6df9 --- /dev/null +++ b/tests/lang/operators/divide_basiclong_64bit.phpt @@ -0,0 +1,582 @@ +--TEST--
+Test / operator : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+$otherVals = array(0, 1, -1, 7, 9, 65, -44, MAX_32Bit, MAX_64Bit);
+
+error_reporting(E_ERROR);
+
+foreach ($longVals as $longVal) {
+ foreach($otherVals as $otherVal) {
+ echo "--- testing: $longVal / $otherVal ---\n";
+ var_dump($longVal/$otherVal);
+ }
+}
+
+foreach ($otherVals as $otherVal) {
+ foreach($longVals as $longVal) {
+ echo "--- testing: $otherVal / $longVal ---\n";
+ var_dump($otherVal/$longVal);
+ }
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 / 0 --- +bool(false) +--- testing: 9223372036854775807 / 1 --- +int(9223372036854775807) +--- testing: 9223372036854775807 / -1 --- +int(-9223372036854775807) +--- testing: 9223372036854775807 / 7 --- +int(1317624576693539401) +--- testing: 9223372036854775807 / 9 --- +float(1.0248191152061E+18) +--- testing: 9223372036854775807 / 65 --- +float(1.4189803133623E+17) +--- testing: 9223372036854775807 / -44 --- +float(-2.096220917467E+17) +--- testing: 9223372036854775807 / 2147483647 --- +float(4294967298) +--- testing: 9223372036854775807 / 9223372036854775807 --- +int(1) +--- testing: -9223372036854775808 / 0 --- +bool(false) +--- testing: -9223372036854775808 / 1 --- +int(-9223372036854775808) +--- testing: -9223372036854775808 / -1 --- +float(9.2233720368548E+18) +--- testing: -9223372036854775808 / 7 --- +float(-1.3176245766935E+18) +--- testing: -9223372036854775808 / 9 --- +float(-1.0248191152061E+18) +--- testing: -9223372036854775808 / 65 --- +float(-1.4189803133623E+17) +--- testing: -9223372036854775808 / -44 --- +float(2.096220917467E+17) +--- testing: -9223372036854775808 / 2147483647 --- +float(-4294967298) +--- testing: -9223372036854775808 / 9223372036854775807 --- +float(-1) +--- testing: 2147483647 / 0 --- +bool(false) +--- testing: 2147483647 / 1 --- +int(2147483647) +--- testing: 2147483647 / -1 --- +int(-2147483647) +--- testing: 2147483647 / 7 --- +float(306783378.14286) +--- testing: 2147483647 / 9 --- +float(238609294.11111) +--- testing: 2147483647 / 65 --- +float(33038209.953846) +--- testing: 2147483647 / -44 --- +float(-48806446.522727) +--- testing: 2147483647 / 2147483647 --- +int(1) +--- testing: 2147483647 / 9223372036854775807 --- +float(2.3283064354545E-10) +--- testing: -2147483648 / 0 --- +bool(false) +--- testing: -2147483648 / 1 --- +int(-2147483648) +--- testing: -2147483648 / -1 --- +int(2147483648) +--- testing: -2147483648 / 7 --- +float(-306783378.28571) +--- testing: -2147483648 / 9 --- +float(-238609294.22222) +--- testing: -2147483648 / 65 --- +float(-33038209.969231) +--- testing: -2147483648 / -44 --- +float(48806446.545455) +--- testing: -2147483648 / 2147483647 --- +float(-1.0000000004657) +--- testing: -2147483648 / 9223372036854775807 --- +float(-2.3283064365387E-10) +--- testing: 9223372034707292160 / 0 --- +bool(false) +--- testing: 9223372034707292160 / 1 --- +int(9223372034707292160) +--- testing: 9223372034707292160 / -1 --- +int(-9223372034707292160) +--- testing: 9223372034707292160 / 7 --- +float(1.3176245763868E+18) +--- testing: 9223372034707292160 / 9 --- +float(1.0248191149675E+18) +--- testing: 9223372034707292160 / 65 --- +float(1.4189803130319E+17) +--- testing: 9223372034707292160 / -44 --- +float(-2.0962209169789E+17) +--- testing: 9223372034707292160 / 2147483647 --- +float(4294967297) +--- testing: 9223372034707292160 / 9223372036854775807 --- +float(0.99999999976717) +--- testing: -9223372034707292160 / 0 --- +bool(false) +--- testing: -9223372034707292160 / 1 --- +int(-9223372034707292160) +--- testing: -9223372034707292160 / -1 --- +int(9223372034707292160) +--- testing: -9223372034707292160 / 7 --- +float(-1.3176245763868E+18) +--- testing: -9223372034707292160 / 9 --- +float(-1.0248191149675E+18) +--- testing: -9223372034707292160 / 65 --- +float(-1.4189803130319E+17) +--- testing: -9223372034707292160 / -44 --- +float(2.0962209169789E+17) +--- testing: -9223372034707292160 / 2147483647 --- +float(-4294967297) +--- testing: -9223372034707292160 / 9223372036854775807 --- +float(-0.99999999976717) +--- testing: 2147483648 / 0 --- +bool(false) +--- testing: 2147483648 / 1 --- +int(2147483648) +--- testing: 2147483648 / -1 --- +int(-2147483648) +--- testing: 2147483648 / 7 --- +float(306783378.28571) +--- testing: 2147483648 / 9 --- +float(238609294.22222) +--- testing: 2147483648 / 65 --- +float(33038209.969231) +--- testing: 2147483648 / -44 --- +float(-48806446.545455) +--- testing: 2147483648 / 2147483647 --- +float(1.0000000004657) +--- testing: 2147483648 / 9223372036854775807 --- +float(2.3283064365387E-10) +--- testing: -2147483649 / 0 --- +bool(false) +--- testing: -2147483649 / 1 --- +int(-2147483649) +--- testing: -2147483649 / -1 --- +int(2147483649) +--- testing: -2147483649 / 7 --- +float(-306783378.42857) +--- testing: -2147483649 / 9 --- +float(-238609294.33333) +--- testing: -2147483649 / 65 --- +float(-33038209.984615) +--- testing: -2147483649 / -44 --- +float(48806446.568182) +--- testing: -2147483649 / 2147483647 --- +float(-1.0000000009313) +--- testing: -2147483649 / 9223372036854775807 --- +float(-2.3283064376229E-10) +--- testing: 4294967294 / 0 --- +bool(false) +--- testing: 4294967294 / 1 --- +int(4294967294) +--- testing: 4294967294 / -1 --- +int(-4294967294) +--- testing: 4294967294 / 7 --- +float(613566756.28571) +--- testing: 4294967294 / 9 --- +float(477218588.22222) +--- testing: 4294967294 / 65 --- +float(66076419.907692) +--- testing: 4294967294 / -44 --- +float(-97612893.045455) +--- testing: 4294967294 / 2147483647 --- +int(2) +--- testing: 4294967294 / 9223372036854775807 --- +float(4.656612870909E-10) +--- testing: 4294967295 / 0 --- +bool(false) +--- testing: 4294967295 / 1 --- +int(4294967295) +--- testing: 4294967295 / -1 --- +int(-4294967295) +--- testing: 4294967295 / 7 --- +float(613566756.42857) +--- testing: 4294967295 / 9 --- +float(477218588.33333) +--- testing: 4294967295 / 65 --- +float(66076419.923077) +--- testing: 4294967295 / -44 --- +float(-97612893.068182) +--- testing: 4294967295 / 2147483647 --- +float(2.0000000004657) +--- testing: 4294967295 / 9223372036854775807 --- +float(4.6566128719932E-10) +--- testing: 4294967293 / 0 --- +bool(false) +--- testing: 4294967293 / 1 --- +int(4294967293) +--- testing: 4294967293 / -1 --- +int(-4294967293) +--- testing: 4294967293 / 7 --- +float(613566756.14286) +--- testing: 4294967293 / 9 --- +float(477218588.11111) +--- testing: 4294967293 / 65 --- +float(66076419.892308) +--- testing: 4294967293 / -44 --- +float(-97612893.022727) +--- testing: 4294967293 / 2147483647 --- +float(1.9999999995343) +--- testing: 4294967293 / 9223372036854775807 --- +float(4.6566128698248E-10) +--- testing: 9223372036854775806 / 0 --- +bool(false) +--- testing: 9223372036854775806 / 1 --- +int(9223372036854775806) +--- testing: 9223372036854775806 / -1 --- +int(-9223372036854775806) +--- testing: 9223372036854775806 / 7 --- +float(1.3176245766935E+18) +--- testing: 9223372036854775806 / 9 --- +float(1.0248191152061E+18) +--- testing: 9223372036854775806 / 65 --- +float(1.4189803133623E+17) +--- testing: 9223372036854775806 / -44 --- +float(-2.096220917467E+17) +--- testing: 9223372036854775806 / 2147483647 --- +int(4294967298) +--- testing: 9223372036854775806 / 9223372036854775807 --- +float(1) +--- testing: 9.2233720368548E+18 / 0 --- +bool(false) +--- testing: 9.2233720368548E+18 / 1 --- +float(9.2233720368548E+18) +--- testing: 9.2233720368548E+18 / -1 --- +float(-9.2233720368548E+18) +--- testing: 9.2233720368548E+18 / 7 --- +float(1.3176245766935E+18) +--- testing: 9.2233720368548E+18 / 9 --- +float(1.0248191152061E+18) +--- testing: 9.2233720368548E+18 / 65 --- +float(1.4189803133623E+17) +--- testing: 9.2233720368548E+18 / -44 --- +float(-2.096220917467E+17) +--- testing: 9.2233720368548E+18 / 2147483647 --- +float(4294967298) +--- testing: 9.2233720368548E+18 / 9223372036854775807 --- +float(1) +--- testing: -9223372036854775807 / 0 --- +bool(false) +--- testing: -9223372036854775807 / 1 --- +int(-9223372036854775807) +--- testing: -9223372036854775807 / -1 --- +int(9223372036854775807) +--- testing: -9223372036854775807 / 7 --- +int(-1317624576693539401) +--- testing: -9223372036854775807 / 9 --- +float(-1.0248191152061E+18) +--- testing: -9223372036854775807 / 65 --- +float(-1.4189803133623E+17) +--- testing: -9223372036854775807 / -44 --- +float(2.096220917467E+17) +--- testing: -9223372036854775807 / 2147483647 --- +float(-4294967298) +--- testing: -9223372036854775807 / 9223372036854775807 --- +int(-1) +--- testing: -9.2233720368548E+18 / 0 --- +bool(false) +--- testing: -9.2233720368548E+18 / 1 --- +float(-9.2233720368548E+18) +--- testing: -9.2233720368548E+18 / -1 --- +float(9.2233720368548E+18) +--- testing: -9.2233720368548E+18 / 7 --- +float(-1.3176245766935E+18) +--- testing: -9.2233720368548E+18 / 9 --- +float(-1.0248191152061E+18) +--- testing: -9.2233720368548E+18 / 65 --- +float(-1.4189803133623E+17) +--- testing: -9.2233720368548E+18 / -44 --- +float(2.096220917467E+17) +--- testing: -9.2233720368548E+18 / 2147483647 --- +float(-4294967298) +--- testing: -9.2233720368548E+18 / 9223372036854775807 --- +float(-1) +--- testing: 0 / 9223372036854775807 --- +int(0) +--- testing: 0 / -9223372036854775808 --- +int(0) +--- testing: 0 / 2147483647 --- +int(0) +--- testing: 0 / -2147483648 --- +int(0) +--- testing: 0 / 9223372034707292160 --- +int(0) +--- testing: 0 / -9223372034707292160 --- +int(0) +--- testing: 0 / 2147483648 --- +int(0) +--- testing: 0 / -2147483649 --- +int(0) +--- testing: 0 / 4294967294 --- +int(0) +--- testing: 0 / 4294967295 --- +int(0) +--- testing: 0 / 4294967293 --- +int(0) +--- testing: 0 / 9223372036854775806 --- +int(0) +--- testing: 0 / 9.2233720368548E+18 --- +float(0) +--- testing: 0 / -9223372036854775807 --- +int(0) +--- testing: 0 / -9.2233720368548E+18 --- +float(-0) +--- testing: 1 / 9223372036854775807 --- +float(1.0842021724855E-19) +--- testing: 1 / -9223372036854775808 --- +float(-1.0842021724855E-19) +--- testing: 1 / 2147483647 --- +float(4.6566128752458E-10) +--- testing: 1 / -2147483648 --- +float(-4.6566128730774E-10) +--- testing: 1 / 9223372034707292160 --- +float(1.0842021727379E-19) +--- testing: 1 / -9223372034707292160 --- +float(-1.0842021727379E-19) +--- testing: 1 / 2147483648 --- +float(4.6566128730774E-10) +--- testing: 1 / -2147483649 --- +float(-4.656612870909E-10) +--- testing: 1 / 4294967294 --- +float(2.3283064376229E-10) +--- testing: 1 / 4294967295 --- +float(2.3283064370808E-10) +--- testing: 1 / 4294967293 --- +float(2.328306438165E-10) +--- testing: 1 / 9223372036854775806 --- +float(1.0842021724855E-19) +--- testing: 1 / 9.2233720368548E+18 --- +float(1.0842021724855E-19) +--- testing: 1 / -9223372036854775807 --- +float(-1.0842021724855E-19) +--- testing: 1 / -9.2233720368548E+18 --- +float(-1.0842021724855E-19) +--- testing: -1 / 9223372036854775807 --- +float(-1.0842021724855E-19) +--- testing: -1 / -9223372036854775808 --- +float(1.0842021724855E-19) +--- testing: -1 / 2147483647 --- +float(-4.6566128752458E-10) +--- testing: -1 / -2147483648 --- +float(4.6566128730774E-10) +--- testing: -1 / 9223372034707292160 --- +float(-1.0842021727379E-19) +--- testing: -1 / -9223372034707292160 --- +float(1.0842021727379E-19) +--- testing: -1 / 2147483648 --- +float(-4.6566128730774E-10) +--- testing: -1 / -2147483649 --- +float(4.656612870909E-10) +--- testing: -1 / 4294967294 --- +float(-2.3283064376229E-10) +--- testing: -1 / 4294967295 --- +float(-2.3283064370808E-10) +--- testing: -1 / 4294967293 --- +float(-2.328306438165E-10) +--- testing: -1 / 9223372036854775806 --- +float(-1.0842021724855E-19) +--- testing: -1 / 9.2233720368548E+18 --- +float(-1.0842021724855E-19) +--- testing: -1 / -9223372036854775807 --- +float(1.0842021724855E-19) +--- testing: -1 / -9.2233720368548E+18 --- +float(1.0842021724855E-19) +--- testing: 7 / 9223372036854775807 --- +float(7.5894152073985E-19) +--- testing: 7 / -9223372036854775808 --- +float(-7.5894152073985E-19) +--- testing: 7 / 2147483647 --- +float(3.2596290126721E-9) +--- testing: 7 / -2147483648 --- +float(-3.2596290111542E-9) +--- testing: 7 / 9223372034707292160 --- +float(7.5894152091656E-19) +--- testing: 7 / -9223372034707292160 --- +float(-7.5894152091656E-19) +--- testing: 7 / 2147483648 --- +float(3.2596290111542E-9) +--- testing: 7 / -2147483649 --- +float(-3.2596290096363E-9) +--- testing: 7 / 4294967294 --- +float(1.629814506336E-9) +--- testing: 7 / 4294967295 --- +float(1.6298145059566E-9) +--- testing: 7 / 4294967293 --- +float(1.6298145067155E-9) +--- testing: 7 / 9223372036854775806 --- +float(7.5894152073985E-19) +--- testing: 7 / 9.2233720368548E+18 --- +float(7.5894152073985E-19) +--- testing: 7 / -9223372036854775807 --- +float(-7.5894152073985E-19) +--- testing: 7 / -9.2233720368548E+18 --- +float(-7.5894152073985E-19) +--- testing: 9 / 9223372036854775807 --- +float(9.7578195523695E-19) +--- testing: 9 / -9223372036854775808 --- +float(-9.7578195523695E-19) +--- testing: 9 / 2147483647 --- +float(4.1909515877212E-9) +--- testing: 9 / -2147483648 --- +float(-4.1909515857697E-9) +--- testing: 9 / 9223372034707292160 --- +float(9.7578195546415E-19) +--- testing: 9 / -9223372034707292160 --- +float(-9.7578195546415E-19) +--- testing: 9 / 2147483648 --- +float(4.1909515857697E-9) +--- testing: 9 / -2147483649 --- +float(-4.1909515838181E-9) +--- testing: 9 / 4294967294 --- +float(2.0954757938606E-9) +--- testing: 9 / 4294967295 --- +float(2.0954757933727E-9) +--- testing: 9 / 4294967293 --- +float(2.0954757943485E-9) +--- testing: 9 / 9223372036854775806 --- +float(9.7578195523695E-19) +--- testing: 9 / 9.2233720368548E+18 --- +float(9.7578195523695E-19) +--- testing: 9 / -9223372036854775807 --- +float(-9.7578195523695E-19) +--- testing: 9 / -9.2233720368548E+18 --- +float(-9.7578195523695E-19) +--- testing: 65 / 9223372036854775807 --- +float(7.0473141211558E-18) +--- testing: 65 / -9223372036854775808 --- +float(-7.0473141211558E-18) +--- testing: 65 / 2147483647 --- +float(3.0267983689098E-8) +--- testing: 65 / -2147483648 --- +float(-3.0267983675003E-8) +--- testing: 65 / 9223372034707292160 --- +float(7.0473141227966E-18) +--- testing: 65 / -9223372034707292160 --- +float(-7.0473141227966E-18) +--- testing: 65 / 2147483648 --- +float(3.0267983675003E-8) +--- testing: 65 / -2147483649 --- +float(-3.0267983660908E-8) +--- testing: 65 / 4294967294 --- +float(1.5133991844549E-8) +--- testing: 65 / 4294967295 --- +float(1.5133991841025E-8) +--- testing: 65 / 4294967293 --- +float(1.5133991848072E-8) +--- testing: 65 / 9223372036854775806 --- +float(7.0473141211558E-18) +--- testing: 65 / 9.2233720368548E+18 --- +float(7.0473141211558E-18) +--- testing: 65 / -9223372036854775807 --- +float(-7.0473141211558E-18) +--- testing: 65 / -9.2233720368548E+18 --- +float(-7.0473141211558E-18) +--- testing: -44 / 9223372036854775807 --- +float(-4.7704895589362E-18) +--- testing: -44 / -9223372036854775808 --- +float(4.7704895589362E-18) +--- testing: -44 / 2147483647 --- +float(-2.0489096651082E-8) +--- testing: -44 / -2147483648 --- +float(2.0489096641541E-8) +--- testing: -44 / 9223372034707292160 --- +float(-4.7704895600469E-18) +--- testing: -44 / -9223372034707292160 --- +float(4.7704895600469E-18) +--- testing: -44 / 2147483648 --- +float(-2.0489096641541E-8) +--- testing: -44 / -2147483649 --- +float(2.0489096632E-8) +--- testing: -44 / 4294967294 --- +float(-1.0244548325541E-8) +--- testing: -44 / 4294967295 --- +float(-1.0244548323156E-8) +--- testing: -44 / 4294967293 --- +float(-1.0244548327926E-8) +--- testing: -44 / 9223372036854775806 --- +float(-4.7704895589362E-18) +--- testing: -44 / 9.2233720368548E+18 --- +float(-4.7704895589362E-18) +--- testing: -44 / -9223372036854775807 --- +float(4.7704895589362E-18) +--- testing: -44 / -9.2233720368548E+18 --- +float(4.7704895589362E-18) +--- testing: 2147483647 / 9223372036854775807 --- +float(2.3283064354545E-10) +--- testing: 2147483647 / -9223372036854775808 --- +float(-2.3283064354545E-10) +--- testing: 2147483647 / 2147483647 --- +int(1) +--- testing: 2147483647 / -2147483648 --- +float(-0.99999999953434) +--- testing: 2147483647 / 9223372034707292160 --- +float(2.3283064359966E-10) +--- testing: 2147483647 / -9223372034707292160 --- +float(-2.3283064359966E-10) +--- testing: 2147483647 / 2147483648 --- +float(0.99999999953434) +--- testing: 2147483647 / -2147483649 --- +float(-0.99999999906868) +--- testing: 2147483647 / 4294967294 --- +float(0.5) +--- testing: 2147483647 / 4294967295 --- +float(0.49999999988358) +--- testing: 2147483647 / 4294967293 --- +float(0.50000000011642) +--- testing: 2147483647 / 9223372036854775806 --- +float(2.3283064354545E-10) +--- testing: 2147483647 / 9.2233720368548E+18 --- +float(2.3283064354545E-10) +--- testing: 2147483647 / -9223372036854775807 --- +float(-2.3283064354545E-10) +--- testing: 2147483647 / -9.2233720368548E+18 --- +float(-2.3283064354545E-10) +--- testing: 9223372036854775807 / 9223372036854775807 --- +int(1) +--- testing: 9223372036854775807 / -9223372036854775808 --- +float(-1) +--- testing: 9223372036854775807 / 2147483647 --- +float(4294967298) +--- testing: 9223372036854775807 / -2147483648 --- +float(-4294967296) +--- testing: 9223372036854775807 / 9223372034707292160 --- +float(1.0000000002328) +--- testing: 9223372036854775807 / -9223372034707292160 --- +float(-1.0000000002328) +--- testing: 9223372036854775807 / 2147483648 --- +float(4294967296) +--- testing: 9223372036854775807 / -2147483649 --- +float(-4294967294) +--- testing: 9223372036854775807 / 4294967294 --- +float(2147483649) +--- testing: 9223372036854775807 / 4294967295 --- +float(2147483648.5) +--- testing: 9223372036854775807 / 4294967293 --- +float(2147483649.5) +--- testing: 9223372036854775807 / 9223372036854775806 --- +float(1) +--- testing: 9223372036854775807 / 9.2233720368548E+18 --- +float(1) +--- testing: 9223372036854775807 / -9223372036854775807 --- +int(-1) +--- testing: 9223372036854775807 / -9.2233720368548E+18 --- +float(-1)
+===DONE===
diff --git a/tests/lang/operators/divide_variationStr.phpt b/tests/lang/operators/divide_variationStr.phpt new file mode 100644 index 0000000..e48e9e1 --- /dev/null +++ b/tests/lang/operators/divide_variationStr.phpt @@ -0,0 +1,416 @@ +--TEST--
+Test / operator : various numbers as strings
+--FILE--
+<?php
+
+$strVals = array(
+ "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",
+ "a5.9"
+);
+
+error_reporting(E_ERROR);
+
+foreach ($strVals as $strVal) {
+ foreach($strVals as $otherVal) {
+ echo "--- testing: '$strVal' / '$otherVal' ---\n";
+ var_dump($strVal/$otherVal);
+ }
+}
+
+
+?>
+===DONE===
+--EXPECT--
+--- testing: '0' / '0' --- +bool(false) +--- testing: '0' / '65' --- +int(0) +--- testing: '0' / '-44' --- +int(0) +--- testing: '0' / '1.2' --- +float(0) +--- testing: '0' / '-7.7' --- +float(-0) +--- testing: '0' / 'abc' --- +bool(false) +--- testing: '0' / '123abc' --- +int(0) +--- testing: '0' / '123e5' --- +float(0) +--- testing: '0' / '123e5xyz' --- +float(0) +--- testing: '0' / ' 123abc' --- +int(0) +--- testing: '0' / '123 abc' --- +int(0) +--- testing: '0' / '123abc ' --- +int(0) +--- testing: '0' / '3.4a' --- +float(0) +--- testing: '0' / 'a5.9' --- +bool(false) +--- testing: '65' / '0' --- +bool(false) +--- testing: '65' / '65' --- +int(1) +--- testing: '65' / '-44' --- +float(-1.4772727272727) +--- testing: '65' / '1.2' --- +float(54.166666666667) +--- testing: '65' / '-7.7' --- +float(-8.4415584415584) +--- testing: '65' / 'abc' --- +bool(false) +--- testing: '65' / '123abc' --- +float(0.52845528455285) +--- testing: '65' / '123e5' --- +float(5.2845528455285E-6) +--- testing: '65' / '123e5xyz' --- +float(5.2845528455285E-6) +--- testing: '65' / ' 123abc' --- +float(0.52845528455285) +--- testing: '65' / '123 abc' --- +float(0.52845528455285) +--- testing: '65' / '123abc ' --- +float(0.52845528455285) +--- testing: '65' / '3.4a' --- +float(19.117647058824) +--- testing: '65' / 'a5.9' --- +bool(false) +--- testing: '-44' / '0' --- +bool(false) +--- testing: '-44' / '65' --- +float(-0.67692307692308) +--- testing: '-44' / '-44' --- +int(1) +--- testing: '-44' / '1.2' --- +float(-36.666666666667) +--- testing: '-44' / '-7.7' --- +float(5.7142857142857) +--- testing: '-44' / 'abc' --- +bool(false) +--- testing: '-44' / '123abc' --- +float(-0.35772357723577) +--- testing: '-44' / '123e5' --- +float(-3.5772357723577E-6) +--- testing: '-44' / '123e5xyz' --- +float(-3.5772357723577E-6) +--- testing: '-44' / ' 123abc' --- +float(-0.35772357723577) +--- testing: '-44' / '123 abc' --- +float(-0.35772357723577) +--- testing: '-44' / '123abc ' --- +float(-0.35772357723577) +--- testing: '-44' / '3.4a' --- +float(-12.941176470588) +--- testing: '-44' / 'a5.9' --- +bool(false) +--- testing: '1.2' / '0' --- +bool(false) +--- testing: '1.2' / '65' --- +float(0.018461538461538) +--- testing: '1.2' / '-44' --- +float(-0.027272727272727) +--- testing: '1.2' / '1.2' --- +float(1) +--- testing: '1.2' / '-7.7' --- +float(-0.15584415584416) +--- testing: '1.2' / 'abc' --- +bool(false) +--- testing: '1.2' / '123abc' --- +float(0.0097560975609756) +--- testing: '1.2' / '123e5' --- +float(9.7560975609756E-8) +--- testing: '1.2' / '123e5xyz' --- +float(9.7560975609756E-8) +--- testing: '1.2' / ' 123abc' --- +float(0.0097560975609756) +--- testing: '1.2' / '123 abc' --- +float(0.0097560975609756) +--- testing: '1.2' / '123abc ' --- +float(0.0097560975609756) +--- testing: '1.2' / '3.4a' --- +float(0.35294117647059) +--- testing: '1.2' / 'a5.9' --- +bool(false) +--- testing: '-7.7' / '0' --- +bool(false) +--- testing: '-7.7' / '65' --- +float(-0.11846153846154) +--- testing: '-7.7' / '-44' --- +float(0.175) +--- testing: '-7.7' / '1.2' --- +float(-6.4166666666667) +--- testing: '-7.7' / '-7.7' --- +float(1) +--- testing: '-7.7' / 'abc' --- +bool(false) +--- testing: '-7.7' / '123abc' --- +float(-0.06260162601626) +--- testing: '-7.7' / '123e5' --- +float(-6.260162601626E-7) +--- testing: '-7.7' / '123e5xyz' --- +float(-6.260162601626E-7) +--- testing: '-7.7' / ' 123abc' --- +float(-0.06260162601626) +--- testing: '-7.7' / '123 abc' --- +float(-0.06260162601626) +--- testing: '-7.7' / '123abc ' --- +float(-0.06260162601626) +--- testing: '-7.7' / '3.4a' --- +float(-2.2647058823529) +--- testing: '-7.7' / 'a5.9' --- +bool(false) +--- testing: 'abc' / '0' --- +bool(false) +--- testing: 'abc' / '65' --- +int(0) +--- testing: 'abc' / '-44' --- +int(0) +--- testing: 'abc' / '1.2' --- +float(0) +--- testing: 'abc' / '-7.7' --- +float(-0) +--- testing: 'abc' / 'abc' --- +bool(false) +--- testing: 'abc' / '123abc' --- +int(0) +--- testing: 'abc' / '123e5' --- +float(0) +--- testing: 'abc' / '123e5xyz' --- +float(0) +--- testing: 'abc' / ' 123abc' --- +int(0) +--- testing: 'abc' / '123 abc' --- +int(0) +--- testing: 'abc' / '123abc ' --- +int(0) +--- testing: 'abc' / '3.4a' --- +float(0) +--- testing: 'abc' / 'a5.9' --- +bool(false) +--- testing: '123abc' / '0' --- +bool(false) +--- testing: '123abc' / '65' --- +float(1.8923076923077) +--- testing: '123abc' / '-44' --- +float(-2.7954545454545) +--- testing: '123abc' / '1.2' --- +float(102.5) +--- testing: '123abc' / '-7.7' --- +float(-15.974025974026) +--- testing: '123abc' / 'abc' --- +bool(false) +--- testing: '123abc' / '123abc' --- +int(1) +--- testing: '123abc' / '123e5' --- +float(1.0E-5) +--- testing: '123abc' / '123e5xyz' --- +float(1.0E-5) +--- testing: '123abc' / ' 123abc' --- +int(1) +--- testing: '123abc' / '123 abc' --- +int(1) +--- testing: '123abc' / '123abc ' --- +int(1) +--- testing: '123abc' / '3.4a' --- +float(36.176470588235) +--- testing: '123abc' / 'a5.9' --- +bool(false) +--- testing: '123e5' / '0' --- +bool(false) +--- testing: '123e5' / '65' --- +float(189230.76923077) +--- testing: '123e5' / '-44' --- +float(-279545.45454545) +--- testing: '123e5' / '1.2' --- +float(10250000) +--- testing: '123e5' / '-7.7' --- +float(-1597402.5974026) +--- testing: '123e5' / 'abc' --- +bool(false) +--- testing: '123e5' / '123abc' --- +float(100000) +--- testing: '123e5' / '123e5' --- +float(1) +--- testing: '123e5' / '123e5xyz' --- +float(1) +--- testing: '123e5' / ' 123abc' --- +float(100000) +--- testing: '123e5' / '123 abc' --- +float(100000) +--- testing: '123e5' / '123abc ' --- +float(100000) +--- testing: '123e5' / '3.4a' --- +float(3617647.0588235) +--- testing: '123e5' / 'a5.9' --- +bool(false) +--- testing: '123e5xyz' / '0' --- +bool(false) +--- testing: '123e5xyz' / '65' --- +float(189230.76923077) +--- testing: '123e5xyz' / '-44' --- +float(-279545.45454545) +--- testing: '123e5xyz' / '1.2' --- +float(10250000) +--- testing: '123e5xyz' / '-7.7' --- +float(-1597402.5974026) +--- testing: '123e5xyz' / 'abc' --- +bool(false) +--- testing: '123e5xyz' / '123abc' --- +float(100000) +--- testing: '123e5xyz' / '123e5' --- +float(1) +--- testing: '123e5xyz' / '123e5xyz' --- +float(1) +--- testing: '123e5xyz' / ' 123abc' --- +float(100000) +--- testing: '123e5xyz' / '123 abc' --- +float(100000) +--- testing: '123e5xyz' / '123abc ' --- +float(100000) +--- testing: '123e5xyz' / '3.4a' --- +float(3617647.0588235) +--- testing: '123e5xyz' / 'a5.9' --- +bool(false) +--- testing: ' 123abc' / '0' --- +bool(false) +--- testing: ' 123abc' / '65' --- +float(1.8923076923077) +--- testing: ' 123abc' / '-44' --- +float(-2.7954545454545) +--- testing: ' 123abc' / '1.2' --- +float(102.5) +--- testing: ' 123abc' / '-7.7' --- +float(-15.974025974026) +--- testing: ' 123abc' / 'abc' --- +bool(false) +--- testing: ' 123abc' / '123abc' --- +int(1) +--- testing: ' 123abc' / '123e5' --- +float(1.0E-5) +--- testing: ' 123abc' / '123e5xyz' --- +float(1.0E-5) +--- testing: ' 123abc' / ' 123abc' --- +int(1) +--- testing: ' 123abc' / '123 abc' --- +int(1) +--- testing: ' 123abc' / '123abc ' --- +int(1) +--- testing: ' 123abc' / '3.4a' --- +float(36.176470588235) +--- testing: ' 123abc' / 'a5.9' --- +bool(false) +--- testing: '123 abc' / '0' --- +bool(false) +--- testing: '123 abc' / '65' --- +float(1.8923076923077) +--- testing: '123 abc' / '-44' --- +float(-2.7954545454545) +--- testing: '123 abc' / '1.2' --- +float(102.5) +--- testing: '123 abc' / '-7.7' --- +float(-15.974025974026) +--- testing: '123 abc' / 'abc' --- +bool(false) +--- testing: '123 abc' / '123abc' --- +int(1) +--- testing: '123 abc' / '123e5' --- +float(1.0E-5) +--- testing: '123 abc' / '123e5xyz' --- +float(1.0E-5) +--- testing: '123 abc' / ' 123abc' --- +int(1) +--- testing: '123 abc' / '123 abc' --- +int(1) +--- testing: '123 abc' / '123abc ' --- +int(1) +--- testing: '123 abc' / '3.4a' --- +float(36.176470588235) +--- testing: '123 abc' / 'a5.9' --- +bool(false) +--- testing: '123abc ' / '0' --- +bool(false) +--- testing: '123abc ' / '65' --- +float(1.8923076923077) +--- testing: '123abc ' / '-44' --- +float(-2.7954545454545) +--- testing: '123abc ' / '1.2' --- +float(102.5) +--- testing: '123abc ' / '-7.7' --- +float(-15.974025974026) +--- testing: '123abc ' / 'abc' --- +bool(false) +--- testing: '123abc ' / '123abc' --- +int(1) +--- testing: '123abc ' / '123e5' --- +float(1.0E-5) +--- testing: '123abc ' / '123e5xyz' --- +float(1.0E-5) +--- testing: '123abc ' / ' 123abc' --- +int(1) +--- testing: '123abc ' / '123 abc' --- +int(1) +--- testing: '123abc ' / '123abc ' --- +int(1) +--- testing: '123abc ' / '3.4a' --- +float(36.176470588235) +--- testing: '123abc ' / 'a5.9' --- +bool(false) +--- testing: '3.4a' / '0' --- +bool(false) +--- testing: '3.4a' / '65' --- +float(0.052307692307692) +--- testing: '3.4a' / '-44' --- +float(-0.077272727272727) +--- testing: '3.4a' / '1.2' --- +float(2.8333333333333) +--- testing: '3.4a' / '-7.7' --- +float(-0.44155844155844) +--- testing: '3.4a' / 'abc' --- +bool(false) +--- testing: '3.4a' / '123abc' --- +float(0.027642276422764) +--- testing: '3.4a' / '123e5' --- +float(2.7642276422764E-7) +--- testing: '3.4a' / '123e5xyz' --- +float(2.7642276422764E-7) +--- testing: '3.4a' / ' 123abc' --- +float(0.027642276422764) +--- testing: '3.4a' / '123 abc' --- +float(0.027642276422764) +--- testing: '3.4a' / '123abc ' --- +float(0.027642276422764) +--- testing: '3.4a' / '3.4a' --- +float(1) +--- testing: '3.4a' / 'a5.9' --- +bool(false) +--- testing: 'a5.9' / '0' --- +bool(false) +--- testing: 'a5.9' / '65' --- +int(0) +--- testing: 'a5.9' / '-44' --- +int(0) +--- testing: 'a5.9' / '1.2' --- +float(0) +--- testing: 'a5.9' / '-7.7' --- +float(-0) +--- testing: 'a5.9' / 'abc' --- +bool(false) +--- testing: 'a5.9' / '123abc' --- +int(0) +--- testing: 'a5.9' / '123e5' --- +float(0) +--- testing: 'a5.9' / '123e5xyz' --- +float(0) +--- testing: 'a5.9' / ' 123abc' --- +int(0) +--- testing: 'a5.9' / '123 abc' --- +int(0) +--- testing: 'a5.9' / '123abc ' --- +int(0) +--- testing: 'a5.9' / '3.4a' --- +float(0) +--- testing: 'a5.9' / 'a5.9' --- +bool(false)
+===DONE===
diff --git a/tests/lang/operators/modulus_basiclong_64bit.phpt b/tests/lang/operators/modulus_basiclong_64bit.phpt new file mode 100644 index 0000000..d75ff1e --- /dev/null +++ b/tests/lang/operators/modulus_basiclong_64bit.phpt @@ -0,0 +1,582 @@ +--TEST-- +Test % operator : 64bit long tests +--SKIPIF-- +<?php +if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); +?> +--FILE-- +<?php + +define("MAX_64Bit", 9223372036854775807); +define("MAX_32Bit", 2147483647); +define("MIN_64Bit", -9223372036854775807 - 1); +define("MIN_32Bit", -2147483647 - 1); + +$longVals = array( + MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit, + MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1, + MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1 +); + +$otherVals = array(0, 1, -1, 7, 9, 65, -44, MAX_32Bit, MAX_64Bit); + +error_reporting(E_ERROR); + +foreach ($longVals as $longVal) { + foreach($otherVals as $otherVal) { + echo "--- testing: $longVal % $otherVal ---\n"; + var_dump($longVal%$otherVal); + } +} + +foreach ($otherVals as $otherVal) { + foreach($longVals as $longVal) { + echo "--- testing: $otherVal % $longVal ---\n"; + var_dump($otherVal%$longVal); + } +} + +?> +===DONE=== +--EXPECT-- +--- testing: 9223372036854775807 % 0 --- +bool(false) +--- testing: 9223372036854775807 % 1 --- +int(0) +--- testing: 9223372036854775807 % -1 --- +int(0) +--- testing: 9223372036854775807 % 7 --- +int(0) +--- testing: 9223372036854775807 % 9 --- +int(7) +--- testing: 9223372036854775807 % 65 --- +int(7) +--- testing: 9223372036854775807 % -44 --- +int(7) +--- testing: 9223372036854775807 % 2147483647 --- +int(1) +--- testing: 9223372036854775807 % 9223372036854775807 --- +int(0) +--- testing: -9223372036854775808 % 0 --- +bool(false) +--- testing: -9223372036854775808 % 1 --- +int(0) +--- testing: -9223372036854775808 % -1 --- +int(0) +--- testing: -9223372036854775808 % 7 --- +int(-1) +--- testing: -9223372036854775808 % 9 --- +int(-8) +--- testing: -9223372036854775808 % 65 --- +int(-8) +--- testing: -9223372036854775808 % -44 --- +int(-8) +--- testing: -9223372036854775808 % 2147483647 --- +int(-2) +--- testing: -9223372036854775808 % 9223372036854775807 --- +int(-1) +--- testing: 2147483647 % 0 --- +bool(false) +--- testing: 2147483647 % 1 --- +int(0) +--- testing: 2147483647 % -1 --- +int(0) +--- testing: 2147483647 % 7 --- +int(1) +--- testing: 2147483647 % 9 --- +int(1) +--- testing: 2147483647 % 65 --- +int(62) +--- testing: 2147483647 % -44 --- +int(23) +--- testing: 2147483647 % 2147483647 --- +int(0) +--- testing: 2147483647 % 9223372036854775807 --- +int(2147483647) +--- testing: -2147483648 % 0 --- +bool(false) +--- testing: -2147483648 % 1 --- +int(0) +--- testing: -2147483648 % -1 --- +int(0) +--- testing: -2147483648 % 7 --- +int(-2) +--- testing: -2147483648 % 9 --- +int(-2) +--- testing: -2147483648 % 65 --- +int(-63) +--- testing: -2147483648 % -44 --- +int(-24) +--- testing: -2147483648 % 2147483647 --- +int(-1) +--- testing: -2147483648 % 9223372036854775807 --- +int(-2147483648) +--- testing: 9223372034707292160 % 0 --- +bool(false) +--- testing: 9223372034707292160 % 1 --- +int(0) +--- testing: 9223372034707292160 % -1 --- +int(0) +--- testing: 9223372034707292160 % 7 --- +int(6) +--- testing: 9223372034707292160 % 9 --- +int(6) +--- testing: 9223372034707292160 % 65 --- +int(10) +--- testing: 9223372034707292160 % -44 --- +int(28) +--- testing: 9223372034707292160 % 2147483647 --- +int(1) +--- testing: 9223372034707292160 % 9223372036854775807 --- +int(9223372034707292160) +--- testing: -9223372034707292160 % 0 --- +bool(false) +--- testing: -9223372034707292160 % 1 --- +int(0) +--- testing: -9223372034707292160 % -1 --- +int(0) +--- testing: -9223372034707292160 % 7 --- +int(-6) +--- testing: -9223372034707292160 % 9 --- +int(-6) +--- testing: -9223372034707292160 % 65 --- +int(-10) +--- testing: -9223372034707292160 % -44 --- +int(-28) +--- testing: -9223372034707292160 % 2147483647 --- +int(-1) +--- testing: -9223372034707292160 % 9223372036854775807 --- +int(-9223372034707292160) +--- testing: 2147483648 % 0 --- +bool(false) +--- testing: 2147483648 % 1 --- +int(0) +--- testing: 2147483648 % -1 --- +int(0) +--- testing: 2147483648 % 7 --- +int(2) +--- testing: 2147483648 % 9 --- +int(2) +--- testing: 2147483648 % 65 --- +int(63) +--- testing: 2147483648 % -44 --- +int(24) +--- testing: 2147483648 % 2147483647 --- +int(1) +--- testing: 2147483648 % 9223372036854775807 --- +int(2147483648) +--- testing: -2147483649 % 0 --- +bool(false) +--- testing: -2147483649 % 1 --- +int(0) +--- testing: -2147483649 % -1 --- +int(0) +--- testing: -2147483649 % 7 --- +int(-3) +--- testing: -2147483649 % 9 --- +int(-3) +--- testing: -2147483649 % 65 --- +int(-64) +--- testing: -2147483649 % -44 --- +int(-25) +--- testing: -2147483649 % 2147483647 --- +int(-2) +--- testing: -2147483649 % 9223372036854775807 --- +int(-2147483649) +--- testing: 4294967294 % 0 --- +bool(false) +--- testing: 4294967294 % 1 --- +int(0) +--- testing: 4294967294 % -1 --- +int(0) +--- testing: 4294967294 % 7 --- +int(2) +--- testing: 4294967294 % 9 --- +int(2) +--- testing: 4294967294 % 65 --- +int(59) +--- testing: 4294967294 % -44 --- +int(2) +--- testing: 4294967294 % 2147483647 --- +int(0) +--- testing: 4294967294 % 9223372036854775807 --- +int(4294967294) +--- testing: 4294967295 % 0 --- +bool(false) +--- testing: 4294967295 % 1 --- +int(0) +--- testing: 4294967295 % -1 --- +int(0) +--- testing: 4294967295 % 7 --- +int(3) +--- testing: 4294967295 % 9 --- +int(3) +--- testing: 4294967295 % 65 --- +int(60) +--- testing: 4294967295 % -44 --- +int(3) +--- testing: 4294967295 % 2147483647 --- +int(1) +--- testing: 4294967295 % 9223372036854775807 --- +int(4294967295) +--- testing: 4294967293 % 0 --- +bool(false) +--- testing: 4294967293 % 1 --- +int(0) +--- testing: 4294967293 % -1 --- +int(0) +--- testing: 4294967293 % 7 --- +int(1) +--- testing: 4294967293 % 9 --- +int(1) +--- testing: 4294967293 % 65 --- +int(58) +--- testing: 4294967293 % -44 --- +int(1) +--- testing: 4294967293 % 2147483647 --- +int(2147483646) +--- testing: 4294967293 % 9223372036854775807 --- +int(4294967293) +--- testing: 9223372036854775806 % 0 --- +bool(false) +--- testing: 9223372036854775806 % 1 --- +int(0) +--- testing: 9223372036854775806 % -1 --- +int(0) +--- testing: 9223372036854775806 % 7 --- +int(6) +--- testing: 9223372036854775806 % 9 --- +int(6) +--- testing: 9223372036854775806 % 65 --- +int(6) +--- testing: 9223372036854775806 % -44 --- +int(6) +--- testing: 9223372036854775806 % 2147483647 --- +int(0) +--- testing: 9223372036854775806 % 9223372036854775807 --- +int(9223372036854775806) +--- testing: 9.2233720368548E+18 % 0 --- +bool(false) +--- testing: 9.2233720368548E+18 % 1 --- +int(0) +--- testing: 9.2233720368548E+18 % -1 --- +int(0) +--- testing: 9.2233720368548E+18 % 7 --- +int(-1) +--- testing: 9.2233720368548E+18 % 9 --- +int(-8) +--- testing: 9.2233720368548E+18 % 65 --- +int(-8) +--- testing: 9.2233720368548E+18 % -44 --- +int(-8) +--- testing: 9.2233720368548E+18 % 2147483647 --- +int(-2) +--- testing: 9.2233720368548E+18 % 9223372036854775807 --- +int(-1) +--- testing: -9223372036854775807 % 0 --- +bool(false) +--- testing: -9223372036854775807 % 1 --- +int(0) +--- testing: -9223372036854775807 % -1 --- +int(0) +--- testing: -9223372036854775807 % 7 --- +int(0) +--- testing: -9223372036854775807 % 9 --- +int(-7) +--- testing: -9223372036854775807 % 65 --- +int(-7) +--- testing: -9223372036854775807 % -44 --- +int(-7) +--- testing: -9223372036854775807 % 2147483647 --- +int(-1) +--- testing: -9223372036854775807 % 9223372036854775807 --- +int(0) +--- testing: -9.2233720368548E+18 % 0 --- +bool(false) +--- testing: -9.2233720368548E+18 % 1 --- +int(0) +--- testing: -9.2233720368548E+18 % -1 --- +int(0) +--- testing: -9.2233720368548E+18 % 7 --- +int(-1) +--- testing: -9.2233720368548E+18 % 9 --- +int(-8) +--- testing: -9.2233720368548E+18 % 65 --- +int(-8) +--- testing: -9.2233720368548E+18 % -44 --- +int(-8) +--- testing: -9.2233720368548E+18 % 2147483647 --- +int(-2) +--- testing: -9.2233720368548E+18 % 9223372036854775807 --- +int(-1) +--- testing: 0 % 9223372036854775807 --- +int(0) +--- testing: 0 % -9223372036854775808 --- +int(0) +--- testing: 0 % 2147483647 --- +int(0) +--- testing: 0 % -2147483648 --- +int(0) +--- testing: 0 % 9223372034707292160 --- +int(0) +--- testing: 0 % -9223372034707292160 --- +int(0) +--- testing: 0 % 2147483648 --- +int(0) +--- testing: 0 % -2147483649 --- +int(0) +--- testing: 0 % 4294967294 --- +int(0) +--- testing: 0 % 4294967295 --- +int(0) +--- testing: 0 % 4294967293 --- +int(0) +--- testing: 0 % 9223372036854775806 --- +int(0) +--- testing: 0 % 9.2233720368548E+18 --- +int(0) +--- testing: 0 % -9223372036854775807 --- +int(0) +--- testing: 0 % -9.2233720368548E+18 --- +int(0) +--- testing: 1 % 9223372036854775807 --- +int(1) +--- testing: 1 % -9223372036854775808 --- +int(1) +--- testing: 1 % 2147483647 --- +int(1) +--- testing: 1 % -2147483648 --- +int(1) +--- testing: 1 % 9223372034707292160 --- +int(1) +--- testing: 1 % -9223372034707292160 --- +int(1) +--- testing: 1 % 2147483648 --- +int(1) +--- testing: 1 % -2147483649 --- +int(1) +--- testing: 1 % 4294967294 --- +int(1) +--- testing: 1 % 4294967295 --- +int(1) +--- testing: 1 % 4294967293 --- +int(1) +--- testing: 1 % 9223372036854775806 --- +int(1) +--- testing: 1 % 9.2233720368548E+18 --- +int(1) +--- testing: 1 % -9223372036854775807 --- +int(1) +--- testing: 1 % -9.2233720368548E+18 --- +int(1) +--- testing: -1 % 9223372036854775807 --- +int(-1) +--- testing: -1 % -9223372036854775808 --- +int(-1) +--- testing: -1 % 2147483647 --- +int(-1) +--- testing: -1 % -2147483648 --- +int(-1) +--- testing: -1 % 9223372034707292160 --- +int(-1) +--- testing: -1 % -9223372034707292160 --- +int(-1) +--- testing: -1 % 2147483648 --- +int(-1) +--- testing: -1 % -2147483649 --- +int(-1) +--- testing: -1 % 4294967294 --- +int(-1) +--- testing: -1 % 4294967295 --- +int(-1) +--- testing: -1 % 4294967293 --- +int(-1) +--- testing: -1 % 9223372036854775806 --- +int(-1) +--- testing: -1 % 9.2233720368548E+18 --- +int(-1) +--- testing: -1 % -9223372036854775807 --- +int(-1) +--- testing: -1 % -9.2233720368548E+18 --- +int(-1) +--- testing: 7 % 9223372036854775807 --- +int(7) +--- testing: 7 % -9223372036854775808 --- +int(7) +--- testing: 7 % 2147483647 --- +int(7) +--- testing: 7 % -2147483648 --- +int(7) +--- testing: 7 % 9223372034707292160 --- +int(7) +--- testing: 7 % -9223372034707292160 --- +int(7) +--- testing: 7 % 2147483648 --- +int(7) +--- testing: 7 % -2147483649 --- +int(7) +--- testing: 7 % 4294967294 --- +int(7) +--- testing: 7 % 4294967295 --- +int(7) +--- testing: 7 % 4294967293 --- +int(7) +--- testing: 7 % 9223372036854775806 --- +int(7) +--- testing: 7 % 9.2233720368548E+18 --- +int(7) +--- testing: 7 % -9223372036854775807 --- +int(7) +--- testing: 7 % -9.2233720368548E+18 --- +int(7) +--- testing: 9 % 9223372036854775807 --- +int(9) +--- testing: 9 % -9223372036854775808 --- +int(9) +--- testing: 9 % 2147483647 --- +int(9) +--- testing: 9 % -2147483648 --- +int(9) +--- testing: 9 % 9223372034707292160 --- +int(9) +--- testing: 9 % -9223372034707292160 --- +int(9) +--- testing: 9 % 2147483648 --- +int(9) +--- testing: 9 % -2147483649 --- +int(9) +--- testing: 9 % 4294967294 --- +int(9) +--- testing: 9 % 4294967295 --- +int(9) +--- testing: 9 % 4294967293 --- +int(9) +--- testing: 9 % 9223372036854775806 --- +int(9) +--- testing: 9 % 9.2233720368548E+18 --- +int(9) +--- testing: 9 % -9223372036854775807 --- +int(9) +--- testing: 9 % -9.2233720368548E+18 --- +int(9) +--- testing: 65 % 9223372036854775807 --- +int(65) +--- testing: 65 % -9223372036854775808 --- +int(65) +--- testing: 65 % 2147483647 --- +int(65) +--- testing: 65 % -2147483648 --- +int(65) +--- testing: 65 % 9223372034707292160 --- +int(65) +--- testing: 65 % -9223372034707292160 --- +int(65) +--- testing: 65 % 2147483648 --- +int(65) +--- testing: 65 % -2147483649 --- +int(65) +--- testing: 65 % 4294967294 --- +int(65) +--- testing: 65 % 4294967295 --- +int(65) +--- testing: 65 % 4294967293 --- +int(65) +--- testing: 65 % 9223372036854775806 --- +int(65) +--- testing: 65 % 9.2233720368548E+18 --- +int(65) +--- testing: 65 % -9223372036854775807 --- +int(65) +--- testing: 65 % -9.2233720368548E+18 --- +int(65) +--- testing: -44 % 9223372036854775807 --- +int(-44) +--- testing: -44 % -9223372036854775808 --- +int(-44) +--- testing: -44 % 2147483647 --- +int(-44) +--- testing: -44 % -2147483648 --- +int(-44) +--- testing: -44 % 9223372034707292160 --- +int(-44) +--- testing: -44 % -9223372034707292160 --- +int(-44) +--- testing: -44 % 2147483648 --- +int(-44) +--- testing: -44 % -2147483649 --- +int(-44) +--- testing: -44 % 4294967294 --- +int(-44) +--- testing: -44 % 4294967295 --- +int(-44) +--- testing: -44 % 4294967293 --- +int(-44) +--- testing: -44 % 9223372036854775806 --- +int(-44) +--- testing: -44 % 9.2233720368548E+18 --- +int(-44) +--- testing: -44 % -9223372036854775807 --- +int(-44) +--- testing: -44 % -9.2233720368548E+18 --- +int(-44) +--- testing: 2147483647 % 9223372036854775807 --- +int(2147483647) +--- testing: 2147483647 % -9223372036854775808 --- +int(2147483647) +--- testing: 2147483647 % 2147483647 --- +int(0) +--- testing: 2147483647 % -2147483648 --- +int(2147483647) +--- testing: 2147483647 % 9223372034707292160 --- +int(2147483647) +--- testing: 2147483647 % -9223372034707292160 --- +int(2147483647) +--- testing: 2147483647 % 2147483648 --- +int(2147483647) +--- testing: 2147483647 % -2147483649 --- +int(2147483647) +--- testing: 2147483647 % 4294967294 --- +int(2147483647) +--- testing: 2147483647 % 4294967295 --- +int(2147483647) +--- testing: 2147483647 % 4294967293 --- +int(2147483647) +--- testing: 2147483647 % 9223372036854775806 --- +int(2147483647) +--- testing: 2147483647 % 9.2233720368548E+18 --- +int(2147483647) +--- testing: 2147483647 % -9223372036854775807 --- +int(2147483647) +--- testing: 2147483647 % -9.2233720368548E+18 --- +int(2147483647) +--- testing: 9223372036854775807 % 9223372036854775807 --- +int(0) +--- testing: 9223372036854775807 % -9223372036854775808 --- +int(9223372036854775807) +--- testing: 9223372036854775807 % 2147483647 --- +int(1) +--- testing: 9223372036854775807 % -2147483648 --- +int(2147483647) +--- testing: 9223372036854775807 % 9223372034707292160 --- +int(2147483647) +--- testing: 9223372036854775807 % -9223372034707292160 --- +int(2147483647) +--- testing: 9223372036854775807 % 2147483648 --- +int(2147483647) +--- testing: 9223372036854775807 % -2147483649 --- +int(1) +--- testing: 9223372036854775807 % 4294967294 --- +int(1) +--- testing: 9223372036854775807 % 4294967295 --- +int(2147483647) +--- testing: 9223372036854775807 % 4294967293 --- +int(2147483650) +--- testing: 9223372036854775807 % 9223372036854775806 --- +int(1) +--- testing: 9223372036854775807 % 9.2233720368548E+18 --- +int(9223372036854775807) +--- testing: 9223372036854775807 % -9223372036854775807 --- +int(0) +--- testing: 9223372036854775807 % -9.2233720368548E+18 --- +int(9223372036854775807) +===DONE===
\ No newline at end of file diff --git a/tests/lang/operators/modulus_variationStr.phpt b/tests/lang/operators/modulus_variationStr.phpt new file mode 100644 index 0000000..7b3ce76 --- /dev/null +++ b/tests/lang/operators/modulus_variationStr.phpt @@ -0,0 +1,416 @@ +--TEST--
+Test % operator : various numbers as strings
+--FILE--
+<?php
+
+$strVals = array(
+ "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",
+ "a5.9"
+);
+
+error_reporting(E_ERROR);
+
+foreach ($strVals as $strVal) {
+ foreach($strVals as $otherVal) {
+ echo "--- testing: '$strVal' % '$otherVal' ---\n";
+ var_dump($strVal%$otherVal);
+ }
+}
+
+
+?>
+===DONE===
+--EXPECT--
+--- testing: '0' % '0' --- +bool(false) +--- testing: '0' % '65' --- +int(0) +--- testing: '0' % '-44' --- +int(0) +--- testing: '0' % '1.2' --- +int(0) +--- testing: '0' % '-7.7' --- +int(0) +--- testing: '0' % 'abc' --- +bool(false) +--- testing: '0' % '123abc' --- +int(0) +--- testing: '0' % '123e5' --- +int(0) +--- testing: '0' % '123e5xyz' --- +int(0) +--- testing: '0' % ' 123abc' --- +int(0) +--- testing: '0' % '123 abc' --- +int(0) +--- testing: '0' % '123abc ' --- +int(0) +--- testing: '0' % '3.4a' --- +int(0) +--- testing: '0' % 'a5.9' --- +bool(false) +--- testing: '65' % '0' --- +bool(false) +--- testing: '65' % '65' --- +int(0) +--- testing: '65' % '-44' --- +int(21) +--- testing: '65' % '1.2' --- +int(0) +--- testing: '65' % '-7.7' --- +int(2) +--- testing: '65' % 'abc' --- +bool(false) +--- testing: '65' % '123abc' --- +int(65) +--- testing: '65' % '123e5' --- +int(65) +--- testing: '65' % '123e5xyz' --- +int(65) +--- testing: '65' % ' 123abc' --- +int(65) +--- testing: '65' % '123 abc' --- +int(65) +--- testing: '65' % '123abc ' --- +int(65) +--- testing: '65' % '3.4a' --- +int(2) +--- testing: '65' % 'a5.9' --- +bool(false) +--- testing: '-44' % '0' --- +bool(false) +--- testing: '-44' % '65' --- +int(-44) +--- testing: '-44' % '-44' --- +int(0) +--- testing: '-44' % '1.2' --- +int(0) +--- testing: '-44' % '-7.7' --- +int(-2) +--- testing: '-44' % 'abc' --- +bool(false) +--- testing: '-44' % '123abc' --- +int(-44) +--- testing: '-44' % '123e5' --- +int(-44) +--- testing: '-44' % '123e5xyz' --- +int(-44) +--- testing: '-44' % ' 123abc' --- +int(-44) +--- testing: '-44' % '123 abc' --- +int(-44) +--- testing: '-44' % '123abc ' --- +int(-44) +--- testing: '-44' % '3.4a' --- +int(-2) +--- testing: '-44' % 'a5.9' --- +bool(false) +--- testing: '1.2' % '0' --- +bool(false) +--- testing: '1.2' % '65' --- +int(1) +--- testing: '1.2' % '-44' --- +int(1) +--- testing: '1.2' % '1.2' --- +int(0) +--- testing: '1.2' % '-7.7' --- +int(1) +--- testing: '1.2' % 'abc' --- +bool(false) +--- testing: '1.2' % '123abc' --- +int(1) +--- testing: '1.2' % '123e5' --- +int(1) +--- testing: '1.2' % '123e5xyz' --- +int(1) +--- testing: '1.2' % ' 123abc' --- +int(1) +--- testing: '1.2' % '123 abc' --- +int(1) +--- testing: '1.2' % '123abc ' --- +int(1) +--- testing: '1.2' % '3.4a' --- +int(1) +--- testing: '1.2' % 'a5.9' --- +bool(false) +--- testing: '-7.7' % '0' --- +bool(false) +--- testing: '-7.7' % '65' --- +int(-7) +--- testing: '-7.7' % '-44' --- +int(-7) +--- testing: '-7.7' % '1.2' --- +int(0) +--- testing: '-7.7' % '-7.7' --- +int(0) +--- testing: '-7.7' % 'abc' --- +bool(false) +--- testing: '-7.7' % '123abc' --- +int(-7) +--- testing: '-7.7' % '123e5' --- +int(-7) +--- testing: '-7.7' % '123e5xyz' --- +int(-7) +--- testing: '-7.7' % ' 123abc' --- +int(-7) +--- testing: '-7.7' % '123 abc' --- +int(-7) +--- testing: '-7.7' % '123abc ' --- +int(-7) +--- testing: '-7.7' % '3.4a' --- +int(-1) +--- testing: '-7.7' % 'a5.9' --- +bool(false) +--- testing: 'abc' % '0' --- +bool(false) +--- testing: 'abc' % '65' --- +int(0) +--- testing: 'abc' % '-44' --- +int(0) +--- testing: 'abc' % '1.2' --- +int(0) +--- testing: 'abc' % '-7.7' --- +int(0) +--- testing: 'abc' % 'abc' --- +bool(false) +--- testing: 'abc' % '123abc' --- +int(0) +--- testing: 'abc' % '123e5' --- +int(0) +--- testing: 'abc' % '123e5xyz' --- +int(0) +--- testing: 'abc' % ' 123abc' --- +int(0) +--- testing: 'abc' % '123 abc' --- +int(0) +--- testing: 'abc' % '123abc ' --- +int(0) +--- testing: 'abc' % '3.4a' --- +int(0) +--- testing: 'abc' % 'a5.9' --- +bool(false) +--- testing: '123abc' % '0' --- +bool(false) +--- testing: '123abc' % '65' --- +int(58) +--- testing: '123abc' % '-44' --- +int(35) +--- testing: '123abc' % '1.2' --- +int(0) +--- testing: '123abc' % '-7.7' --- +int(4) +--- testing: '123abc' % 'abc' --- +bool(false) +--- testing: '123abc' % '123abc' --- +int(0) +--- testing: '123abc' % '123e5' --- +int(0) +--- testing: '123abc' % '123e5xyz' --- +int(0) +--- testing: '123abc' % ' 123abc' --- +int(0) +--- testing: '123abc' % '123 abc' --- +int(0) +--- testing: '123abc' % '123abc ' --- +int(0) +--- testing: '123abc' % '3.4a' --- +int(0) +--- testing: '123abc' % 'a5.9' --- +bool(false) +--- testing: '123e5' % '0' --- +bool(false) +--- testing: '123e5' % '65' --- +int(58) +--- testing: '123e5' % '-44' --- +int(35) +--- testing: '123e5' % '1.2' --- +int(0) +--- testing: '123e5' % '-7.7' --- +int(4) +--- testing: '123e5' % 'abc' --- +bool(false) +--- testing: '123e5' % '123abc' --- +int(0) +--- testing: '123e5' % '123e5' --- +int(0) +--- testing: '123e5' % '123e5xyz' --- +int(0) +--- testing: '123e5' % ' 123abc' --- +int(0) +--- testing: '123e5' % '123 abc' --- +int(0) +--- testing: '123e5' % '123abc ' --- +int(0) +--- testing: '123e5' % '3.4a' --- +int(0) +--- testing: '123e5' % 'a5.9' --- +bool(false) +--- testing: '123e5xyz' % '0' --- +bool(false) +--- testing: '123e5xyz' % '65' --- +int(58) +--- testing: '123e5xyz' % '-44' --- +int(35) +--- testing: '123e5xyz' % '1.2' --- +int(0) +--- testing: '123e5xyz' % '-7.7' --- +int(4) +--- testing: '123e5xyz' % 'abc' --- +bool(false) +--- testing: '123e5xyz' % '123abc' --- +int(0) +--- testing: '123e5xyz' % '123e5' --- +int(0) +--- testing: '123e5xyz' % '123e5xyz' --- +int(0) +--- testing: '123e5xyz' % ' 123abc' --- +int(0) +--- testing: '123e5xyz' % '123 abc' --- +int(0) +--- testing: '123e5xyz' % '123abc ' --- +int(0) +--- testing: '123e5xyz' % '3.4a' --- +int(0) +--- testing: '123e5xyz' % 'a5.9' --- +bool(false) +--- testing: ' 123abc' % '0' --- +bool(false) +--- testing: ' 123abc' % '65' --- +int(58) +--- testing: ' 123abc' % '-44' --- +int(35) +--- testing: ' 123abc' % '1.2' --- +int(0) +--- testing: ' 123abc' % '-7.7' --- +int(4) +--- testing: ' 123abc' % 'abc' --- +bool(false) +--- testing: ' 123abc' % '123abc' --- +int(0) +--- testing: ' 123abc' % '123e5' --- +int(0) +--- testing: ' 123abc' % '123e5xyz' --- +int(0) +--- testing: ' 123abc' % ' 123abc' --- +int(0) +--- testing: ' 123abc' % '123 abc' --- +int(0) +--- testing: ' 123abc' % '123abc ' --- +int(0) +--- testing: ' 123abc' % '3.4a' --- +int(0) +--- testing: ' 123abc' % 'a5.9' --- +bool(false) +--- testing: '123 abc' % '0' --- +bool(false) +--- testing: '123 abc' % '65' --- +int(58) +--- testing: '123 abc' % '-44' --- +int(35) +--- testing: '123 abc' % '1.2' --- +int(0) +--- testing: '123 abc' % '-7.7' --- +int(4) +--- testing: '123 abc' % 'abc' --- +bool(false) +--- testing: '123 abc' % '123abc' --- +int(0) +--- testing: '123 abc' % '123e5' --- +int(0) +--- testing: '123 abc' % '123e5xyz' --- +int(0) +--- testing: '123 abc' % ' 123abc' --- +int(0) +--- testing: '123 abc' % '123 abc' --- +int(0) +--- testing: '123 abc' % '123abc ' --- +int(0) +--- testing: '123 abc' % '3.4a' --- +int(0) +--- testing: '123 abc' % 'a5.9' --- +bool(false) +--- testing: '123abc ' % '0' --- +bool(false) +--- testing: '123abc ' % '65' --- +int(58) +--- testing: '123abc ' % '-44' --- +int(35) +--- testing: '123abc ' % '1.2' --- +int(0) +--- testing: '123abc ' % '-7.7' --- +int(4) +--- testing: '123abc ' % 'abc' --- +bool(false) +--- testing: '123abc ' % '123abc' --- +int(0) +--- testing: '123abc ' % '123e5' --- +int(0) +--- testing: '123abc ' % '123e5xyz' --- +int(0) +--- testing: '123abc ' % ' 123abc' --- +int(0) +--- testing: '123abc ' % '123 abc' --- +int(0) +--- testing: '123abc ' % '123abc ' --- +int(0) +--- testing: '123abc ' % '3.4a' --- +int(0) +--- testing: '123abc ' % 'a5.9' --- +bool(false) +--- testing: '3.4a' % '0' --- +bool(false) +--- testing: '3.4a' % '65' --- +int(3) +--- testing: '3.4a' % '-44' --- +int(3) +--- testing: '3.4a' % '1.2' --- +int(0) +--- testing: '3.4a' % '-7.7' --- +int(3) +--- testing: '3.4a' % 'abc' --- +bool(false) +--- testing: '3.4a' % '123abc' --- +int(3) +--- testing: '3.4a' % '123e5' --- +int(3) +--- testing: '3.4a' % '123e5xyz' --- +int(3) +--- testing: '3.4a' % ' 123abc' --- +int(3) +--- testing: '3.4a' % '123 abc' --- +int(3) +--- testing: '3.4a' % '123abc ' --- +int(3) +--- testing: '3.4a' % '3.4a' --- +int(0) +--- testing: '3.4a' % 'a5.9' --- +bool(false) +--- testing: 'a5.9' % '0' --- +bool(false) +--- testing: 'a5.9' % '65' --- +int(0) +--- testing: 'a5.9' % '-44' --- +int(0) +--- testing: 'a5.9' % '1.2' --- +int(0) +--- testing: 'a5.9' % '-7.7' --- +int(0) +--- testing: 'a5.9' % 'abc' --- +bool(false) +--- testing: 'a5.9' % '123abc' --- +int(0) +--- testing: 'a5.9' % '123e5' --- +int(0) +--- testing: 'a5.9' % '123e5xyz' --- +int(0) +--- testing: 'a5.9' % ' 123abc' --- +int(0) +--- testing: 'a5.9' % '123 abc' --- +int(0) +--- testing: 'a5.9' % '123abc ' --- +int(0) +--- testing: 'a5.9' % '3.4a' --- +int(0) +--- testing: 'a5.9' % 'a5.9' --- +bool(false)
+===DONE===
diff --git a/tests/lang/operators/multiply_basiclong_64bit.phpt b/tests/lang/operators/multiply_basiclong_64bit.phpt new file mode 100644 index 0000000..4c7077b --- /dev/null +++ b/tests/lang/operators/multiply_basiclong_64bit.phpt @@ -0,0 +1,582 @@ +--TEST--
+Test * operator : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+$otherVals = array(0, 1, -1, 7, 9, 65, -44, MAX_32Bit, MAX_64Bit);
+
+error_reporting(E_ERROR);
+
+foreach ($longVals as $longVal) {
+ foreach($otherVals as $otherVal) {
+ echo "--- testing: $longVal * $otherVal ---\n";
+ var_dump($longVal*$otherVal);
+ }
+}
+
+foreach ($otherVals as $otherVal) {
+ foreach($longVals as $longVal) {
+ echo "--- testing: $otherVal * $longVal ---\n";
+ var_dump($otherVal*$longVal);
+ }
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 * 0 --- +int(0) +--- testing: 9223372036854775807 * 1 --- +int(9223372036854775807) +--- testing: 9223372036854775807 * -1 --- +int(-9223372036854775807) +--- testing: 9223372036854775807 * 7 --- +float(6.4563604257983E+19) +--- testing: 9223372036854775807 * 9 --- +float(8.3010348331693E+19) +--- testing: 9223372036854775807 * 65 --- +float(5.9951918239556E+20) +--- testing: 9223372036854775807 * -44 --- +float(-4.0582836962161E+20) +--- testing: 9223372036854775807 * 2147483647 --- +float(1.9807040619343E+28) +--- testing: 9223372036854775807 * 9223372036854775807 --- +float(8.5070591730235E+37) +--- testing: -9223372036854775808 * 0 --- +int(0) +--- testing: -9223372036854775808 * 1 --- +int(-9223372036854775808) +--- testing: -9223372036854775808 * -1 --- +float(9.2233720368548E+18) +--- testing: -9223372036854775808 * 7 --- +float(-6.4563604257983E+19) +--- testing: -9223372036854775808 * 9 --- +float(-8.3010348331693E+19) +--- testing: -9223372036854775808 * 65 --- +float(-5.9951918239556E+20) +--- testing: -9223372036854775808 * -44 --- +float(4.0582836962161E+20) +--- testing: -9223372036854775808 * 2147483647 --- +float(-1.9807040619343E+28) +--- testing: -9223372036854775808 * 9223372036854775807 --- +float(-8.5070591730235E+37) +--- testing: 2147483647 * 0 --- +int(0) +--- testing: 2147483647 * 1 --- +int(2147483647) +--- testing: 2147483647 * -1 --- +int(-2147483647) +--- testing: 2147483647 * 7 --- +int(15032385529) +--- testing: 2147483647 * 9 --- +int(19327352823) +--- testing: 2147483647 * 65 --- +int(139586437055) +--- testing: 2147483647 * -44 --- +int(-94489280468) +--- testing: 2147483647 * 2147483647 --- +int(4611686014132420609) +--- testing: 2147483647 * 9223372036854775807 --- +float(1.9807040619343E+28) +--- testing: -2147483648 * 0 --- +int(0) +--- testing: -2147483648 * 1 --- +int(-2147483648) +--- testing: -2147483648 * -1 --- +int(2147483648) +--- testing: -2147483648 * 7 --- +int(-15032385536) +--- testing: -2147483648 * 9 --- +int(-19327352832) +--- testing: -2147483648 * 65 --- +int(-139586437120) +--- testing: -2147483648 * -44 --- +int(94489280512) +--- testing: -2147483648 * 2147483647 --- +int(-4611686016279904256) +--- testing: -2147483648 * 9223372036854775807 --- +float(-1.9807040628566E+28) +--- testing: 9223372034707292160 * 0 --- +int(0) +--- testing: 9223372034707292160 * 1 --- +int(9223372034707292160) +--- testing: 9223372034707292160 * -1 --- +int(-9223372034707292160) +--- testing: 9223372034707292160 * 7 --- +float(6.4563604242951E+19) +--- testing: 9223372034707292160 * 9 --- +float(8.3010348312366E+19) +--- testing: 9223372034707292160 * 65 --- +float(5.9951918225597E+20) +--- testing: 9223372034707292160 * -44 --- +float(-4.0582836952712E+20) +--- testing: 9223372034707292160 * 2147483647 --- +float(1.9807040614731E+28) +--- testing: 9223372034707292160 * 9223372036854775807 --- +float(8.5070591710428E+37) +--- testing: -9223372034707292160 * 0 --- +int(0) +--- testing: -9223372034707292160 * 1 --- +int(-9223372034707292160) +--- testing: -9223372034707292160 * -1 --- +int(9223372034707292160) +--- testing: -9223372034707292160 * 7 --- +float(-6.4563604242951E+19) +--- testing: -9223372034707292160 * 9 --- +float(-8.3010348312366E+19) +--- testing: -9223372034707292160 * 65 --- +float(-5.9951918225597E+20) +--- testing: -9223372034707292160 * -44 --- +float(4.0582836952712E+20) +--- testing: -9223372034707292160 * 2147483647 --- +float(-1.9807040614731E+28) +--- testing: -9223372034707292160 * 9223372036854775807 --- +float(-8.5070591710428E+37) +--- testing: 2147483648 * 0 --- +int(0) +--- testing: 2147483648 * 1 --- +int(2147483648) +--- testing: 2147483648 * -1 --- +int(-2147483648) +--- testing: 2147483648 * 7 --- +int(15032385536) +--- testing: 2147483648 * 9 --- +int(19327352832) +--- testing: 2147483648 * 65 --- +int(139586437120) +--- testing: 2147483648 * -44 --- +int(-94489280512) +--- testing: 2147483648 * 2147483647 --- +int(4611686016279904256) +--- testing: 2147483648 * 9223372036854775807 --- +float(1.9807040628566E+28) +--- testing: -2147483649 * 0 --- +int(0) +--- testing: -2147483649 * 1 --- +int(-2147483649) +--- testing: -2147483649 * -1 --- +int(2147483649) +--- testing: -2147483649 * 7 --- +int(-15032385543) +--- testing: -2147483649 * 9 --- +int(-19327352841) +--- testing: -2147483649 * 65 --- +int(-139586437185) +--- testing: -2147483649 * -44 --- +int(94489280556) +--- testing: -2147483649 * 2147483647 --- +int(-4611686018427387903) +--- testing: -2147483649 * 9223372036854775807 --- +float(-1.9807040637789E+28) +--- testing: 4294967294 * 0 --- +int(0) +--- testing: 4294967294 * 1 --- +int(4294967294) +--- testing: 4294967294 * -1 --- +int(-4294967294) +--- testing: 4294967294 * 7 --- +int(30064771058) +--- testing: 4294967294 * 9 --- +int(38654705646) +--- testing: 4294967294 * 65 --- +int(279172874110) +--- testing: 4294967294 * -44 --- +int(-188978560936) +--- testing: 4294967294 * 2147483647 --- +int(9223372028264841218) +--- testing: 4294967294 * 9223372036854775807 --- +float(3.9614081238685E+28) +--- testing: 4294967295 * 0 --- +int(0) +--- testing: 4294967295 * 1 --- +int(4294967295) +--- testing: 4294967295 * -1 --- +int(-4294967295) +--- testing: 4294967295 * 7 --- +int(30064771065) +--- testing: 4294967295 * 9 --- +int(38654705655) +--- testing: 4294967295 * 65 --- +int(279172874175) +--- testing: 4294967295 * -44 --- +int(-188978560980) +--- testing: 4294967295 * 2147483647 --- +int(9223372030412324865) +--- testing: 4294967295 * 9223372036854775807 --- +float(3.9614081247909E+28) +--- testing: 4294967293 * 0 --- +int(0) +--- testing: 4294967293 * 1 --- +int(4294967293) +--- testing: 4294967293 * -1 --- +int(-4294967293) +--- testing: 4294967293 * 7 --- +int(30064771051) +--- testing: 4294967293 * 9 --- +int(38654705637) +--- testing: 4294967293 * 65 --- +int(279172874045) +--- testing: 4294967293 * -44 --- +int(-188978560892) +--- testing: 4294967293 * 2147483647 --- +int(9223372026117357571) +--- testing: 4294967293 * 9223372036854775807 --- +float(3.9614081229462E+28) +--- testing: 9223372036854775806 * 0 --- +int(0) +--- testing: 9223372036854775806 * 1 --- +int(9223372036854775806) +--- testing: 9223372036854775806 * -1 --- +int(-9223372036854775806) +--- testing: 9223372036854775806 * 7 --- +float(6.4563604257983E+19) +--- testing: 9223372036854775806 * 9 --- +float(8.3010348331693E+19) +--- testing: 9223372036854775806 * 65 --- +float(5.9951918239556E+20) +--- testing: 9223372036854775806 * -44 --- +float(-4.0582836962161E+20) +--- testing: 9223372036854775806 * 2147483647 --- +float(1.9807040619343E+28) +--- testing: 9223372036854775806 * 9223372036854775807 --- +float(8.5070591730235E+37) +--- testing: 9.2233720368548E+18 * 0 --- +float(0) +--- testing: 9.2233720368548E+18 * 1 --- +float(9.2233720368548E+18) +--- testing: 9.2233720368548E+18 * -1 --- +float(-9.2233720368548E+18) +--- testing: 9.2233720368548E+18 * 7 --- +float(6.4563604257983E+19) +--- testing: 9.2233720368548E+18 * 9 --- +float(8.3010348331693E+19) +--- testing: 9.2233720368548E+18 * 65 --- +float(5.9951918239556E+20) +--- testing: 9.2233720368548E+18 * -44 --- +float(-4.0582836962161E+20) +--- testing: 9.2233720368548E+18 * 2147483647 --- +float(1.9807040619343E+28) +--- testing: 9.2233720368548E+18 * 9223372036854775807 --- +float(8.5070591730235E+37) +--- testing: -9223372036854775807 * 0 --- +int(0) +--- testing: -9223372036854775807 * 1 --- +int(-9223372036854775807) +--- testing: -9223372036854775807 * -1 --- +int(9223372036854775807) +--- testing: -9223372036854775807 * 7 --- +float(-6.4563604257983E+19) +--- testing: -9223372036854775807 * 9 --- +float(-8.3010348331693E+19) +--- testing: -9223372036854775807 * 65 --- +float(-5.9951918239556E+20) +--- testing: -9223372036854775807 * -44 --- +float(4.0582836962161E+20) +--- testing: -9223372036854775807 * 2147483647 --- +float(-1.9807040619343E+28) +--- testing: -9223372036854775807 * 9223372036854775807 --- +float(-8.5070591730235E+37) +--- testing: -9.2233720368548E+18 * 0 --- +float(-0) +--- testing: -9.2233720368548E+18 * 1 --- +float(-9.2233720368548E+18) +--- testing: -9.2233720368548E+18 * -1 --- +float(9.2233720368548E+18) +--- testing: -9.2233720368548E+18 * 7 --- +float(-6.4563604257983E+19) +--- testing: -9.2233720368548E+18 * 9 --- +float(-8.3010348331693E+19) +--- testing: -9.2233720368548E+18 * 65 --- +float(-5.9951918239556E+20) +--- testing: -9.2233720368548E+18 * -44 --- +float(4.0582836962161E+20) +--- testing: -9.2233720368548E+18 * 2147483647 --- +float(-1.9807040619343E+28) +--- testing: -9.2233720368548E+18 * 9223372036854775807 --- +float(-8.5070591730235E+37) +--- testing: 0 * 9223372036854775807 --- +int(0) +--- testing: 0 * -9223372036854775808 --- +int(0) +--- testing: 0 * 2147483647 --- +int(0) +--- testing: 0 * -2147483648 --- +int(0) +--- testing: 0 * 9223372034707292160 --- +int(0) +--- testing: 0 * -9223372034707292160 --- +int(0) +--- testing: 0 * 2147483648 --- +int(0) +--- testing: 0 * -2147483649 --- +int(0) +--- testing: 0 * 4294967294 --- +int(0) +--- testing: 0 * 4294967295 --- +int(0) +--- testing: 0 * 4294967293 --- +int(0) +--- testing: 0 * 9223372036854775806 --- +int(0) +--- testing: 0 * 9.2233720368548E+18 --- +float(0) +--- testing: 0 * -9223372036854775807 --- +int(0) +--- testing: 0 * -9.2233720368548E+18 --- +float(-0) +--- testing: 1 * 9223372036854775807 --- +int(9223372036854775807) +--- testing: 1 * -9223372036854775808 --- +int(-9223372036854775808) +--- testing: 1 * 2147483647 --- +int(2147483647) +--- testing: 1 * -2147483648 --- +int(-2147483648) +--- testing: 1 * 9223372034707292160 --- +int(9223372034707292160) +--- testing: 1 * -9223372034707292160 --- +int(-9223372034707292160) +--- testing: 1 * 2147483648 --- +int(2147483648) +--- testing: 1 * -2147483649 --- +int(-2147483649) +--- testing: 1 * 4294967294 --- +int(4294967294) +--- testing: 1 * 4294967295 --- +int(4294967295) +--- testing: 1 * 4294967293 --- +int(4294967293) +--- testing: 1 * 9223372036854775806 --- +int(9223372036854775806) +--- testing: 1 * 9.2233720368548E+18 --- +float(9.2233720368548E+18) +--- testing: 1 * -9223372036854775807 --- +int(-9223372036854775807) +--- testing: 1 * -9.2233720368548E+18 --- +float(-9.2233720368548E+18) +--- testing: -1 * 9223372036854775807 --- +int(-9223372036854775807) +--- testing: -1 * -9223372036854775808 --- +float(9.2233720368548E+18) +--- testing: -1 * 2147483647 --- +int(-2147483647) +--- testing: -1 * -2147483648 --- +int(2147483648) +--- testing: -1 * 9223372034707292160 --- +int(-9223372034707292160) +--- testing: -1 * -9223372034707292160 --- +int(9223372034707292160) +--- testing: -1 * 2147483648 --- +int(-2147483648) +--- testing: -1 * -2147483649 --- +int(2147483649) +--- testing: -1 * 4294967294 --- +int(-4294967294) +--- testing: -1 * 4294967295 --- +int(-4294967295) +--- testing: -1 * 4294967293 --- +int(-4294967293) +--- testing: -1 * 9223372036854775806 --- +int(-9223372036854775806) +--- testing: -1 * 9.2233720368548E+18 --- +float(-9.2233720368548E+18) +--- testing: -1 * -9223372036854775807 --- +int(9223372036854775807) +--- testing: -1 * -9.2233720368548E+18 --- +float(9.2233720368548E+18) +--- testing: 7 * 9223372036854775807 --- +float(6.4563604257983E+19) +--- testing: 7 * -9223372036854775808 --- +float(-6.4563604257983E+19) +--- testing: 7 * 2147483647 --- +int(15032385529) +--- testing: 7 * -2147483648 --- +int(-15032385536) +--- testing: 7 * 9223372034707292160 --- +float(6.4563604242951E+19) +--- testing: 7 * -9223372034707292160 --- +float(-6.4563604242951E+19) +--- testing: 7 * 2147483648 --- +int(15032385536) +--- testing: 7 * -2147483649 --- +int(-15032385543) +--- testing: 7 * 4294967294 --- +int(30064771058) +--- testing: 7 * 4294967295 --- +int(30064771065) +--- testing: 7 * 4294967293 --- +int(30064771051) +--- testing: 7 * 9223372036854775806 --- +float(6.4563604257983E+19) +--- testing: 7 * 9.2233720368548E+18 --- +float(6.4563604257983E+19) +--- testing: 7 * -9223372036854775807 --- +float(-6.4563604257983E+19) +--- testing: 7 * -9.2233720368548E+18 --- +float(-6.4563604257983E+19) +--- testing: 9 * 9223372036854775807 --- +float(8.3010348331693E+19) +--- testing: 9 * -9223372036854775808 --- +float(-8.3010348331693E+19) +--- testing: 9 * 2147483647 --- +int(19327352823) +--- testing: 9 * -2147483648 --- +int(-19327352832) +--- testing: 9 * 9223372034707292160 --- +float(8.3010348312366E+19) +--- testing: 9 * -9223372034707292160 --- +float(-8.3010348312366E+19) +--- testing: 9 * 2147483648 --- +int(19327352832) +--- testing: 9 * -2147483649 --- +int(-19327352841) +--- testing: 9 * 4294967294 --- +int(38654705646) +--- testing: 9 * 4294967295 --- +int(38654705655) +--- testing: 9 * 4294967293 --- +int(38654705637) +--- testing: 9 * 9223372036854775806 --- +float(8.3010348331693E+19) +--- testing: 9 * 9.2233720368548E+18 --- +float(8.3010348331693E+19) +--- testing: 9 * -9223372036854775807 --- +float(-8.3010348331693E+19) +--- testing: 9 * -9.2233720368548E+18 --- +float(-8.3010348331693E+19) +--- testing: 65 * 9223372036854775807 --- +float(5.9951918239556E+20) +--- testing: 65 * -9223372036854775808 --- +float(-5.9951918239556E+20) +--- testing: 65 * 2147483647 --- +int(139586437055) +--- testing: 65 * -2147483648 --- +int(-139586437120) +--- testing: 65 * 9223372034707292160 --- +float(5.9951918225597E+20) +--- testing: 65 * -9223372034707292160 --- +float(-5.9951918225597E+20) +--- testing: 65 * 2147483648 --- +int(139586437120) +--- testing: 65 * -2147483649 --- +int(-139586437185) +--- testing: 65 * 4294967294 --- +int(279172874110) +--- testing: 65 * 4294967295 --- +int(279172874175) +--- testing: 65 * 4294967293 --- +int(279172874045) +--- testing: 65 * 9223372036854775806 --- +float(5.9951918239556E+20) +--- testing: 65 * 9.2233720368548E+18 --- +float(5.9951918239556E+20) +--- testing: 65 * -9223372036854775807 --- +float(-5.9951918239556E+20) +--- testing: 65 * -9.2233720368548E+18 --- +float(-5.9951918239556E+20) +--- testing: -44 * 9223372036854775807 --- +float(-4.0582836962161E+20) +--- testing: -44 * -9223372036854775808 --- +float(4.0582836962161E+20) +--- testing: -44 * 2147483647 --- +int(-94489280468) +--- testing: -44 * -2147483648 --- +int(94489280512) +--- testing: -44 * 9223372034707292160 --- +float(-4.0582836952712E+20) +--- testing: -44 * -9223372034707292160 --- +float(4.0582836952712E+20) +--- testing: -44 * 2147483648 --- +int(-94489280512) +--- testing: -44 * -2147483649 --- +int(94489280556) +--- testing: -44 * 4294967294 --- +int(-188978560936) +--- testing: -44 * 4294967295 --- +int(-188978560980) +--- testing: -44 * 4294967293 --- +int(-188978560892) +--- testing: -44 * 9223372036854775806 --- +float(-4.0582836962161E+20) +--- testing: -44 * 9.2233720368548E+18 --- +float(-4.0582836962161E+20) +--- testing: -44 * -9223372036854775807 --- +float(4.0582836962161E+20) +--- testing: -44 * -9.2233720368548E+18 --- +float(4.0582836962161E+20) +--- testing: 2147483647 * 9223372036854775807 --- +float(1.9807040619343E+28) +--- testing: 2147483647 * -9223372036854775808 --- +float(-1.9807040619343E+28) +--- testing: 2147483647 * 2147483647 --- +int(4611686014132420609) +--- testing: 2147483647 * -2147483648 --- +int(-4611686016279904256) +--- testing: 2147483647 * 9223372034707292160 --- +float(1.9807040614731E+28) +--- testing: 2147483647 * -9223372034707292160 --- +float(-1.9807040614731E+28) +--- testing: 2147483647 * 2147483648 --- +int(4611686016279904256) +--- testing: 2147483647 * -2147483649 --- +int(-4611686018427387903) +--- testing: 2147483647 * 4294967294 --- +int(9223372028264841218) +--- testing: 2147483647 * 4294967295 --- +int(9223372030412324865) +--- testing: 2147483647 * 4294967293 --- +int(9223372026117357571) +--- testing: 2147483647 * 9223372036854775806 --- +float(1.9807040619343E+28) +--- testing: 2147483647 * 9.2233720368548E+18 --- +float(1.9807040619343E+28) +--- testing: 2147483647 * -9223372036854775807 --- +float(-1.9807040619343E+28) +--- testing: 2147483647 * -9.2233720368548E+18 --- +float(-1.9807040619343E+28) +--- testing: 9223372036854775807 * 9223372036854775807 --- +float(8.5070591730235E+37) +--- testing: 9223372036854775807 * -9223372036854775808 --- +float(-8.5070591730235E+37) +--- testing: 9223372036854775807 * 2147483647 --- +float(1.9807040619343E+28) +--- testing: 9223372036854775807 * -2147483648 --- +float(-1.9807040628566E+28) +--- testing: 9223372036854775807 * 9223372034707292160 --- +float(8.5070591710428E+37) +--- testing: 9223372036854775807 * -9223372034707292160 --- +float(-8.5070591710428E+37) +--- testing: 9223372036854775807 * 2147483648 --- +float(1.9807040628566E+28) +--- testing: 9223372036854775807 * -2147483649 --- +float(-1.9807040637789E+28) +--- testing: 9223372036854775807 * 4294967294 --- +float(3.9614081238685E+28) +--- testing: 9223372036854775807 * 4294967295 --- +float(3.9614081247909E+28) +--- testing: 9223372036854775807 * 4294967293 --- +float(3.9614081229462E+28) +--- testing: 9223372036854775807 * 9223372036854775806 --- +float(8.5070591730235E+37) +--- testing: 9223372036854775807 * 9.2233720368548E+18 --- +float(8.5070591730235E+37) +--- testing: 9223372036854775807 * -9223372036854775807 --- +float(-8.5070591730235E+37) +--- testing: 9223372036854775807 * -9.2233720368548E+18 --- +float(-8.5070591730235E+37)
+===DONE===
diff --git a/tests/lang/operators/multiply_variationStr.phpt b/tests/lang/operators/multiply_variationStr.phpt new file mode 100644 index 0000000..30d5f79 --- /dev/null +++ b/tests/lang/operators/multiply_variationStr.phpt @@ -0,0 +1,416 @@ +--TEST--
+Test * operator : various numbers as strings
+--FILE--
+<?php
+
+$strVals = array(
+ "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",
+ "a5.9"
+);
+
+error_reporting(E_ERROR);
+
+foreach ($strVals as $strVal) {
+ foreach($strVals as $otherVal) {
+ echo "--- testing: '$strVal' * '$otherVal' ---\n";
+ var_dump($strVal*$otherVal);
+ }
+}
+
+
+?>
+===DONE===
+--EXPECT--
+--- testing: '0' * '0' --- +int(0) +--- testing: '0' * '65' --- +int(0) +--- testing: '0' * '-44' --- +int(0) +--- testing: '0' * '1.2' --- +float(0) +--- testing: '0' * '-7.7' --- +float(-0) +--- testing: '0' * 'abc' --- +int(0) +--- testing: '0' * '123abc' --- +int(0) +--- testing: '0' * '123e5' --- +float(0) +--- testing: '0' * '123e5xyz' --- +float(0) +--- testing: '0' * ' 123abc' --- +int(0) +--- testing: '0' * '123 abc' --- +int(0) +--- testing: '0' * '123abc ' --- +int(0) +--- testing: '0' * '3.4a' --- +float(0) +--- testing: '0' * 'a5.9' --- +int(0) +--- testing: '65' * '0' --- +int(0) +--- testing: '65' * '65' --- +int(4225) +--- testing: '65' * '-44' --- +int(-2860) +--- testing: '65' * '1.2' --- +float(78) +--- testing: '65' * '-7.7' --- +float(-500.5) +--- testing: '65' * 'abc' --- +int(0) +--- testing: '65' * '123abc' --- +int(7995) +--- testing: '65' * '123e5' --- +float(799500000) +--- testing: '65' * '123e5xyz' --- +float(799500000) +--- testing: '65' * ' 123abc' --- +int(7995) +--- testing: '65' * '123 abc' --- +int(7995) +--- testing: '65' * '123abc ' --- +int(7995) +--- testing: '65' * '3.4a' --- +float(221) +--- testing: '65' * 'a5.9' --- +int(0) +--- testing: '-44' * '0' --- +int(0) +--- testing: '-44' * '65' --- +int(-2860) +--- testing: '-44' * '-44' --- +int(1936) +--- testing: '-44' * '1.2' --- +float(-52.8) +--- testing: '-44' * '-7.7' --- +float(338.8) +--- testing: '-44' * 'abc' --- +int(0) +--- testing: '-44' * '123abc' --- +int(-5412) +--- testing: '-44' * '123e5' --- +float(-541200000) +--- testing: '-44' * '123e5xyz' --- +float(-541200000) +--- testing: '-44' * ' 123abc' --- +int(-5412) +--- testing: '-44' * '123 abc' --- +int(-5412) +--- testing: '-44' * '123abc ' --- +int(-5412) +--- testing: '-44' * '3.4a' --- +float(-149.6) +--- testing: '-44' * 'a5.9' --- +int(0) +--- testing: '1.2' * '0' --- +float(0) +--- testing: '1.2' * '65' --- +float(78) +--- testing: '1.2' * '-44' --- +float(-52.8) +--- testing: '1.2' * '1.2' --- +float(1.44) +--- testing: '1.2' * '-7.7' --- +float(-9.24) +--- testing: '1.2' * 'abc' --- +float(0) +--- testing: '1.2' * '123abc' --- +float(147.6) +--- testing: '1.2' * '123e5' --- +float(14760000) +--- testing: '1.2' * '123e5xyz' --- +float(14760000) +--- testing: '1.2' * ' 123abc' --- +float(147.6) +--- testing: '1.2' * '123 abc' --- +float(147.6) +--- testing: '1.2' * '123abc ' --- +float(147.6) +--- testing: '1.2' * '3.4a' --- +float(4.08) +--- testing: '1.2' * 'a5.9' --- +float(0) +--- testing: '-7.7' * '0' --- +float(-0) +--- testing: '-7.7' * '65' --- +float(-500.5) +--- testing: '-7.7' * '-44' --- +float(338.8) +--- testing: '-7.7' * '1.2' --- +float(-9.24) +--- testing: '-7.7' * '-7.7' --- +float(59.29) +--- testing: '-7.7' * 'abc' --- +float(-0) +--- testing: '-7.7' * '123abc' --- +float(-947.1) +--- testing: '-7.7' * '123e5' --- +float(-94710000) +--- testing: '-7.7' * '123e5xyz' --- +float(-94710000) +--- testing: '-7.7' * ' 123abc' --- +float(-947.1) +--- testing: '-7.7' * '123 abc' --- +float(-947.1) +--- testing: '-7.7' * '123abc ' --- +float(-947.1) +--- testing: '-7.7' * '3.4a' --- +float(-26.18) +--- testing: '-7.7' * 'a5.9' --- +float(-0) +--- testing: 'abc' * '0' --- +int(0) +--- testing: 'abc' * '65' --- +int(0) +--- testing: 'abc' * '-44' --- +int(0) +--- testing: 'abc' * '1.2' --- +float(0) +--- testing: 'abc' * '-7.7' --- +float(-0) +--- testing: 'abc' * 'abc' --- +int(0) +--- testing: 'abc' * '123abc' --- +int(0) +--- testing: 'abc' * '123e5' --- +float(0) +--- testing: 'abc' * '123e5xyz' --- +float(0) +--- testing: 'abc' * ' 123abc' --- +int(0) +--- testing: 'abc' * '123 abc' --- +int(0) +--- testing: 'abc' * '123abc ' --- +int(0) +--- testing: 'abc' * '3.4a' --- +float(0) +--- testing: 'abc' * 'a5.9' --- +int(0) +--- testing: '123abc' * '0' --- +int(0) +--- testing: '123abc' * '65' --- +int(7995) +--- testing: '123abc' * '-44' --- +int(-5412) +--- testing: '123abc' * '1.2' --- +float(147.6) +--- testing: '123abc' * '-7.7' --- +float(-947.1) +--- testing: '123abc' * 'abc' --- +int(0) +--- testing: '123abc' * '123abc' --- +int(15129) +--- testing: '123abc' * '123e5' --- +float(1512900000) +--- testing: '123abc' * '123e5xyz' --- +float(1512900000) +--- testing: '123abc' * ' 123abc' --- +int(15129) +--- testing: '123abc' * '123 abc' --- +int(15129) +--- testing: '123abc' * '123abc ' --- +int(15129) +--- testing: '123abc' * '3.4a' --- +float(418.2) +--- testing: '123abc' * 'a5.9' --- +int(0) +--- testing: '123e5' * '0' --- +float(0) +--- testing: '123e5' * '65' --- +float(799500000) +--- testing: '123e5' * '-44' --- +float(-541200000) +--- testing: '123e5' * '1.2' --- +float(14760000) +--- testing: '123e5' * '-7.7' --- +float(-94710000) +--- testing: '123e5' * 'abc' --- +float(0) +--- testing: '123e5' * '123abc' --- +float(1512900000) +--- testing: '123e5' * '123e5' --- +float(1.5129E+14) +--- testing: '123e5' * '123e5xyz' --- +float(1.5129E+14) +--- testing: '123e5' * ' 123abc' --- +float(1512900000) +--- testing: '123e5' * '123 abc' --- +float(1512900000) +--- testing: '123e5' * '123abc ' --- +float(1512900000) +--- testing: '123e5' * '3.4a' --- +float(41820000) +--- testing: '123e5' * 'a5.9' --- +float(0) +--- testing: '123e5xyz' * '0' --- +float(0) +--- testing: '123e5xyz' * '65' --- +float(799500000) +--- testing: '123e5xyz' * '-44' --- +float(-541200000) +--- testing: '123e5xyz' * '1.2' --- +float(14760000) +--- testing: '123e5xyz' * '-7.7' --- +float(-94710000) +--- testing: '123e5xyz' * 'abc' --- +float(0) +--- testing: '123e5xyz' * '123abc' --- +float(1512900000) +--- testing: '123e5xyz' * '123e5' --- +float(1.5129E+14) +--- testing: '123e5xyz' * '123e5xyz' --- +float(1.5129E+14) +--- testing: '123e5xyz' * ' 123abc' --- +float(1512900000) +--- testing: '123e5xyz' * '123 abc' --- +float(1512900000) +--- testing: '123e5xyz' * '123abc ' --- +float(1512900000) +--- testing: '123e5xyz' * '3.4a' --- +float(41820000) +--- testing: '123e5xyz' * 'a5.9' --- +float(0) +--- testing: ' 123abc' * '0' --- +int(0) +--- testing: ' 123abc' * '65' --- +int(7995) +--- testing: ' 123abc' * '-44' --- +int(-5412) +--- testing: ' 123abc' * '1.2' --- +float(147.6) +--- testing: ' 123abc' * '-7.7' --- +float(-947.1) +--- testing: ' 123abc' * 'abc' --- +int(0) +--- testing: ' 123abc' * '123abc' --- +int(15129) +--- testing: ' 123abc' * '123e5' --- +float(1512900000) +--- testing: ' 123abc' * '123e5xyz' --- +float(1512900000) +--- testing: ' 123abc' * ' 123abc' --- +int(15129) +--- testing: ' 123abc' * '123 abc' --- +int(15129) +--- testing: ' 123abc' * '123abc ' --- +int(15129) +--- testing: ' 123abc' * '3.4a' --- +float(418.2) +--- testing: ' 123abc' * 'a5.9' --- +int(0) +--- testing: '123 abc' * '0' --- +int(0) +--- testing: '123 abc' * '65' --- +int(7995) +--- testing: '123 abc' * '-44' --- +int(-5412) +--- testing: '123 abc' * '1.2' --- +float(147.6) +--- testing: '123 abc' * '-7.7' --- +float(-947.1) +--- testing: '123 abc' * 'abc' --- +int(0) +--- testing: '123 abc' * '123abc' --- +int(15129) +--- testing: '123 abc' * '123e5' --- +float(1512900000) +--- testing: '123 abc' * '123e5xyz' --- +float(1512900000) +--- testing: '123 abc' * ' 123abc' --- +int(15129) +--- testing: '123 abc' * '123 abc' --- +int(15129) +--- testing: '123 abc' * '123abc ' --- +int(15129) +--- testing: '123 abc' * '3.4a' --- +float(418.2) +--- testing: '123 abc' * 'a5.9' --- +int(0) +--- testing: '123abc ' * '0' --- +int(0) +--- testing: '123abc ' * '65' --- +int(7995) +--- testing: '123abc ' * '-44' --- +int(-5412) +--- testing: '123abc ' * '1.2' --- +float(147.6) +--- testing: '123abc ' * '-7.7' --- +float(-947.1) +--- testing: '123abc ' * 'abc' --- +int(0) +--- testing: '123abc ' * '123abc' --- +int(15129) +--- testing: '123abc ' * '123e5' --- +float(1512900000) +--- testing: '123abc ' * '123e5xyz' --- +float(1512900000) +--- testing: '123abc ' * ' 123abc' --- +int(15129) +--- testing: '123abc ' * '123 abc' --- +int(15129) +--- testing: '123abc ' * '123abc ' --- +int(15129) +--- testing: '123abc ' * '3.4a' --- +float(418.2) +--- testing: '123abc ' * 'a5.9' --- +int(0) +--- testing: '3.4a' * '0' --- +float(0) +--- testing: '3.4a' * '65' --- +float(221) +--- testing: '3.4a' * '-44' --- +float(-149.6) +--- testing: '3.4a' * '1.2' --- +float(4.08) +--- testing: '3.4a' * '-7.7' --- +float(-26.18) +--- testing: '3.4a' * 'abc' --- +float(0) +--- testing: '3.4a' * '123abc' --- +float(418.2) +--- testing: '3.4a' * '123e5' --- +float(41820000) +--- testing: '3.4a' * '123e5xyz' --- +float(41820000) +--- testing: '3.4a' * ' 123abc' --- +float(418.2) +--- testing: '3.4a' * '123 abc' --- +float(418.2) +--- testing: '3.4a' * '123abc ' --- +float(418.2) +--- testing: '3.4a' * '3.4a' --- +float(11.56) +--- testing: '3.4a' * 'a5.9' --- +float(0) +--- testing: 'a5.9' * '0' --- +int(0) +--- testing: 'a5.9' * '65' --- +int(0) +--- testing: 'a5.9' * '-44' --- +int(0) +--- testing: 'a5.9' * '1.2' --- +float(0) +--- testing: 'a5.9' * '-7.7' --- +float(-0) +--- testing: 'a5.9' * 'abc' --- +int(0) +--- testing: 'a5.9' * '123abc' --- +int(0) +--- testing: 'a5.9' * '123e5' --- +float(0) +--- testing: 'a5.9' * '123e5xyz' --- +float(0) +--- testing: 'a5.9' * ' 123abc' --- +int(0) +--- testing: 'a5.9' * '123 abc' --- +int(0) +--- testing: 'a5.9' * '123abc ' --- +int(0) +--- testing: 'a5.9' * '3.4a' --- +float(0) +--- testing: 'a5.9' * 'a5.9' --- +int(0)
+===DONE===
diff --git a/tests/lang/operators/negate_basiclong_64bit.phpt b/tests/lang/operators/negate_basiclong_64bit.phpt new file mode 100644 index 0000000..e0cf10d --- /dev/null +++ b/tests/lang/operators/negate_basiclong_64bit.phpt @@ -0,0 +1,60 @@ +--TEST--
+Test -N operator : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(-$longVal);
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 --- +int(-9223372036854775807) +--- testing: -9223372036854775808 --- +float(9.2233720368548E+18) +--- testing: 2147483647 --- +int(-2147483647) +--- testing: -2147483648 --- +int(2147483648) +--- testing: 9223372034707292160 --- +int(-9223372034707292160) +--- testing: -9223372034707292160 --- +int(9223372034707292160) +--- testing: 2147483648 --- +int(-2147483648) +--- testing: -2147483649 --- +int(2147483649) +--- testing: 4294967294 --- +int(-4294967294) +--- testing: 4294967295 --- +int(-4294967295) +--- testing: 4294967293 --- +int(-4294967293) +--- testing: 9223372036854775806 --- +int(-9223372036854775806) +--- testing: 9.2233720368548E+18 --- +float(-9.2233720368548E+18) +--- testing: -9223372036854775807 --- +int(9223372036854775807) +--- testing: -9.2233720368548E+18 --- +float(9.2233720368548E+18)
+===DONE===
diff --git a/tests/lang/operators/negate_variationStr.phpt b/tests/lang/operators/negate_variationStr.phpt new file mode 100644 index 0000000..a25bdda --- /dev/null +++ b/tests/lang/operators/negate_variationStr.phpt @@ -0,0 +1,48 @@ +--TEST--
+Test -N operator : various numbers as strings
+--FILE--
+<?php
+
+$strVals = array(
+ "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",
+ "a5.9"
+);
+
+
+foreach ($strVals as $strVal) {
+ echo "--- testing: '$strVal' ---\n";
+ var_dump(-$strVal);
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: '0' --- +int(0) +--- testing: '65' --- +int(-65) +--- testing: '-44' --- +int(44) +--- testing: '1.2' --- +float(-1.2) +--- testing: '-7.7' --- +float(7.7) +--- testing: 'abc' --- +int(0) +--- testing: '123abc' --- +int(-123) +--- testing: '123e5' --- +float(-12300000) +--- testing: '123e5xyz' --- +float(-12300000) +--- testing: ' 123abc' --- +int(-123) +--- testing: '123 abc' --- +int(-123) +--- testing: '123abc ' --- +int(-123) +--- testing: '3.4a' --- +float(-3.4) +--- testing: 'a5.9' --- +int(0)
+===DONE===
diff --git a/tests/lang/operators/operator_equals_basic.phpt b/tests/lang/operators/operator_equals_basic.phpt new file mode 100644 index 0000000..1b42fc3 --- /dev/null +++ b/tests/lang/operators/operator_equals_basic.phpt @@ -0,0 +1,65 @@ +--TEST--
+Test == operator : different types
+--FILE--
+<?php
+
+$valid_true = array(1, "1", "true", 1.0, array(1));
+$valid_false = array(0, "", 0.0, array(), NULL);
+
+$int1 = 679;
+$int2 = -67835;
+$valid_int1 = array("679", "679abc", " 679", "679 ", 679.0, 6.79E2, "+679", +679);
+$valid_int2 = array("-67835", "-67835abc", " -67835", "-67835 ", -67835.000, -6.7835E4);
+$invalid_int1 = array("6 7 9", "6y79", 678);
+$invalid_int2 = array("- 67835", "-67,835", "-67 835", "-678y35", -76834);
+
+$float1 = 57385.45835;
+$float2 = -67345.76567;
+$valid_float1 = array("57385.45835", "57385.45835aaa", " 57385.45835", 5.738545835e4);
+$valid_float2 = array("-67345.76567", "-67345.76567aaa", " -67345.76567", -6.734576567E4);
+$invalid_float1 = array("57385. 45835", "57,385.45835", 57385.45834, 5.738545834e4);
+$invalid_float2 = array("- 67345.76567", "-67,345.76567", -67345.76566, -6.734576566E4);
+
+
+$toCompare = array(
+ true, $valid_true, $valid_false,
+ false, $valid_false, $valid_true,
+ $int1, $valid_int1, $invalid_int1,
+ $int2, $valid_int2, $invalid_int2,
+ $float1, $valid_float1, $invalid_float1,
+ $float2, $valid_float2, $invalid_float2
+);
+
+$failed = false;
+for ($i = 0; $i < count($toCompare); $i +=3) {
+ $typeToTest = $toCompare[$i];
+ $valid_compares = $toCompare[$i + 1];
+ $invalid_compares = $toCompare[$i + 2];
+
+ foreach($valid_compares as $compareVal) {
+ if ($typeToTest == $compareVal) {
+ // do nothing
+ }
+ else {
+ echo "FAILED: '$typeToTest' != '$compareVal'\n";
+ $failed = true;
+ }
+ }
+
+ foreach($invalid_compares as $compareVal) {
+ if ($typeToTest == $compareVal) {
+ echo "FAILED: '$typeToTest' == '$compareVal'\n";
+ $failed = true;
+ }
+ }
+
+}
+if ($failed == false) {
+ echo "Test Passed\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+Test Passed
+===DONE===
\ No newline at end of file diff --git a/tests/lang/operators/operator_equals_variation.phpt b/tests/lang/operators/operator_equals_variation.phpt new file mode 100644 index 0000000..60e6abb --- /dev/null +++ b/tests/lang/operators/operator_equals_variation.phpt @@ -0,0 +1,63 @@ +--TEST--
+Test == operator : max int 32bit range
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$validEqual = array (
+MAX_32Bit, array(MAX_32Bit, "2147483647", "2147483647.0000000", 2.147483647e9, 2147483647.0),
+MIN_32Bit, array(MIN_32Bit, "-2147483648", "-2147483648.000", -2.147483648e9, -2147483648.0),
+MAX_64Bit, array(MAX_64Bit, MAX_64Bit + 1, MAX_64Bit - 1),
+MIN_64Bit, array(MIN_64Bit, MIN_64Bit - 1, MIN_64Bit + 1),
+);
+
+$invalidEqual = array (
+MAX_32Bit, array("2147483648", 2.1474836470001e9, MAX_32Bit - 1, MAX_32Bit + 1),
+MIN_32Bit, array("-2147483649", -2.1474836480001e9, MIN_32Bit -1, MIN_32Bit + 1),
+);
+
+
+$failed = false;
+// test valid values
+for ($i = 0; $i < count($validEqual); $i +=2) {
+ $typeToTestVal = $validEqual[$i];
+ $compares = $validEqual[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal == $compareVal) {
+ // do nothing
+ }
+ else {
+ echo "FAILED: '$typeToTestVal' != '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+// test invalid values
+for ($i = 0; $i < count($invalidEqual); $i +=2) {
+ $typeToTestVal = $invalidEqual[$i];
+ $compares = $invalidEqual[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal == $compareVal) {
+ echo "FAILED: '$typeToTestVal' == '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+
+if ($failed == false) {
+ echo "Test Passed\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+Test Passed
+===DONE===
\ No newline at end of file diff --git a/tests/lang/operators/operator_equals_variation_64bit.phpt b/tests/lang/operators/operator_equals_variation_64bit.phpt new file mode 100644 index 0000000..b521735 --- /dev/null +++ b/tests/lang/operators/operator_equals_variation_64bit.phpt @@ -0,0 +1,65 @@ +--TEST--
+Test == operator : max int 64bit range
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$validEqual = array (
+MAX_32Bit, array(MAX_32Bit, "2147483647", "2147483647.0000000", 2.147483647e9),
+MIN_32Bit, array(MIN_32Bit, "-2147483648", "-2147483648.000", -2.147483648e9),
+MAX_64Bit, array(MAX_64Bit, MAX_64Bit + 1),
+MIN_64Bit, array(MIN_64Bit, MIN_64Bit - 1),
+);
+
+$invalidEqual = array (
+MAX_32Bit, array("2147483648", 2.1474836470001e9, MAX_32Bit - 1, MAX_32Bit + 1),
+MIN_32Bit, array("-2147483649", -2.1474836480001e9, MIN_32Bit -1, MIN_32Bit + 1),
+MAX_64Bit, array(MAX_64Bit - 1),
+MIN_64Bit, array(MIN_64Bit + 1),
+);
+
+
+$failed = false;
+// test valid values
+for ($i = 0; $i < count($validEqual); $i +=2) {
+ $typeToTestVal = $validEqual[$i];
+ $compares = $validEqual[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal == $compareVal) {
+ // do nothing
+ }
+ else {
+ echo "FAILED: '$typeToTestVal' != '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+// test invalid values
+for ($i = 0; $i < count($invalidEqual); $i +=2) {
+ $typeToTestVal = $invalidEqual[$i];
+ $compares = $invalidEqual[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal == $compareVal) {
+ echo "FAILED: '$typeToTestVal' == '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+
+if ($failed == false) {
+ echo "Test Passed\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+Test Passed
+===DONE===
\ No newline at end of file diff --git a/tests/lang/operators/operator_gt_basic.phpt b/tests/lang/operators/operator_gt_basic.phpt new file mode 100644 index 0000000..06fbcee --- /dev/null +++ b/tests/lang/operators/operator_gt_basic.phpt @@ -0,0 +1,65 @@ +--TEST--
+Test > operator : different types
+--FILE--
+<?php
+$valid_true = array(1, "1", "true", 1.0, array(1));
+$valid_false = array(0, "", 0.0, array(), NULL);
+
+$int1 = 679;
+$int2 = -67835;
+$valid_int1 = array("678", "678abc", " 678", "678 ", 678.0, 6.789E2, "+678", +678);
+$valid_int2 = array("-67836", "-67836abc", " -67836", "-67836 ", -67835.0001, -6.78351E4);
+$invalid_int1 = array(679, "679");
+$invalid_int2 = array(-67835, "-67835");
+
+$float1 = 57385.45835;
+$float2 = -67345.76567;
+$valid_float1 = array("57385.45834", "57385.45834aaa", " 57385.45834", 5.738545834e4);
+$valid_float2 = array("-67345.76568", "-67345.76568aaa", " -67345.76568", -6.734576568E4);
+$invalid_float1 = array(57385.45835, 5.738545835e4);
+$invalid_float2 = array(-67345.76567, -6.734576567E4);
+
+
+$toCompare = array(
+// boolean test will result in both sides being converted to boolean so !0 = true and true is not > true for example
+// also note that a string of "0" is converted to false but a string of "0.0" is converted to true
+// false cannot be tested as 0 can never be > 0 or 1
+ true, $valid_false, $valid_true,
+ $int1, $valid_int1, $invalid_int1,
+ $int2, $valid_int2, $invalid_int2,
+ $float1, $valid_float1, $invalid_float1,
+ $float2, $valid_float2, $invalid_float2
+);
+
+$failed = false;
+for ($i = 0; $i < count($toCompare); $i +=3) {
+ $typeToTest = $toCompare[$i];
+ $valid_compares = $toCompare[$i + 1];
+ $invalid_compares = $toCompare[$i + 2];
+
+ foreach($valid_compares as $compareVal) {
+ if ($typeToTest > $compareVal) {
+ // do nothing
+ }
+ else {
+ echo "FAILED: '$typeToTest' <= '$compareVal'\n";
+ $failed = true;
+ }
+ }
+
+ foreach($invalid_compares as $compareVal) {
+ if ($typeToTest > $compareVal) {
+ echo "FAILED: '$typeToTest' > '$compareVal'\n";
+ $failed = true;
+ }
+ }
+
+}
+if ($failed == false) {
+ echo "Test Passed\n";
+}
+?>
+===DONE===
+--EXPECT--
+Test Passed
+===DONE===
\ No newline at end of file diff --git a/tests/lang/operators/operator_gt_or_equal_basic.phpt b/tests/lang/operators/operator_gt_or_equal_basic.phpt new file mode 100644 index 0000000..02a561c --- /dev/null +++ b/tests/lang/operators/operator_gt_or_equal_basic.phpt @@ -0,0 +1,65 @@ +--TEST--
+Test >= operator : different types
+--FILE--
+<?php
+$valid_true = array(1, "1", "true", 1.0, array(1));
+$valid_false = array(0, "", 0.0, array(), NULL);
+
+$int1 = 679;
+$int2 = -67835;
+$valid_int1 = array("679", "679abc", " 679", 679.0, 6.79E2, "678", "678abc", " 678", 678.0, 6.78E2, 6.789E2, "+678", +678);
+$valid_int2 = array("-67835", "-67835abc", " -67835", -67835.000, -6.7835E4, "-67836", "-67836abc". " -67836", -67835.0001, -6.78351E4, "-67836", -67835.0001, -6.78351E4);
+$invalid_int1 = array(680, "680");
+$invalid_int2 = array(-67834, "-67834");
+
+$float1 = 57385.45835;
+$float2 = -67345.76567;
+$valid_float1 = array("57385.45835", "57385.45835aaa", " 57385.45835", 5.738545835e4, "57385.45834", "57385.45834aaa", " 57385.45834", 5.738545834e4);
+$valid_float2 = array("-67345.76567", "-67345.76567aaa", " -67345.76567", -6.734576567E4, "-67345.76568", "-67345.76568aaa", " -67345.76568", -6.734576568E4);
+$invalid_float1 = array(57385.45836, 5.738545836e4);
+$invalid_float2 = array(-67345.76564, -6.734576564E4);
+
+$toCompare = array(
+
+ true, array_merge($valid_false, $valid_true), NULL,
+ false, $valid_false, $valid_true,
+ $int1, $valid_int1, $invalid_int1,
+ $int2, $valid_int2, $invalid_int2,
+ $float1, $valid_float1, $invalid_float1,
+ $float2, $valid_float2, $invalid_float2
+);
+
+$failed = false;
+for ($i = 0; $i < count($toCompare); $i +=3) {
+ $typeToTest = $toCompare[$i];
+ $valid_compares = $toCompare[$i + 1];
+ $invalid_compares = $toCompare[$i + 2];
+
+ foreach($valid_compares as $compareVal) {
+ if ($typeToTest >= $compareVal) {
+ // do nothing
+ }
+ else {
+ echo "FAILED: '$typeToTest' < '$compareVal'\n";
+ $failed = true;
+ }
+ }
+
+ if ($invalid_compares != NULL) {
+ foreach($invalid_compares as $compareVal) {
+ if ($typeToTest >= $compareVal) {
+ echo "FAILED: '$typeToTest' >= '$compareVal'\n";
+ $failed = true;
+ }
+ }
+ }
+
+}
+if ($failed == false) {
+ echo "Test Passed\n";
+}
+?>
+===DONE===
+--EXPECT--
+Test Passed
+===DONE===
\ No newline at end of file diff --git a/tests/lang/operators/operator_gt_or_equal_variation.phpt b/tests/lang/operators/operator_gt_or_equal_variation.phpt new file mode 100644 index 0000000..c4253b5 --- /dev/null +++ b/tests/lang/operators/operator_gt_or_equal_variation.phpt @@ -0,0 +1,63 @@ +--TEST--
+Test >= operator : max int 32bit range
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$validGtOrEqual = array (
+MAX_32Bit, array(MAX_32Bit, "2147483647", "2147483647.0000000", 2.147483647e9, 2147483647.0, MAX_32Bit - 1),
+MIN_32Bit, array(MIN_32Bit, "-2147483648", "-2147483648.000", -2.147483648e9, -2147483648.0, MIN_32Bit - 1),
+MAX_64Bit, array(MAX_64Bit, MAX_64Bit + 1, MAX_64Bit - 1),
+MIN_64Bit, array(MIN_64Bit, MIN_64Bit - 1, MIN_64Bit + 1),
+);
+
+$invalidGtOrEqual = array (
+MAX_32Bit, array("2147483648", 2.1474836470001e9, MAX_32Bit + 1),
+MIN_32Bit, array(MIN_32Bit + 1,"-2147483646", -2.1474836460001e9)
+);
+
+
+$failed = false;
+// test valid values
+for ($i = 0; $i < count($validGtOrEqual); $i +=2) {
+ $typeToTestVal = $validGtOrEqual[$i];
+ $compares = $validGtOrEqual[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal >= $compareVal) {
+ // do nothing
+ }
+ else {
+ echo "FAILED: '$typeToTestVal' < '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+// test for invalid values
+for ($i = 0; $i < count($invalidGtOrEqual); $i +=2) {
+ $typeToTestVal = $invalidGtOrEqual[$i];
+ $compares = $invalidGtOrEqual[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal >= $compareVal) {
+ echo "FAILED: '$typeToTestVal' >= '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+
+if ($failed == false) {
+ echo "Test Passed\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+Test Passed
+===DONE===
\ No newline at end of file diff --git a/tests/lang/operators/operator_gt_or_equal_variation_64bit.phpt b/tests/lang/operators/operator_gt_or_equal_variation_64bit.phpt new file mode 100644 index 0000000..a2f7aa4 --- /dev/null +++ b/tests/lang/operators/operator_gt_or_equal_variation_64bit.phpt @@ -0,0 +1,63 @@ +--TEST--
+Test >= operator : max int 64bit range
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$validGtOrEqual = array (
+MAX_32Bit, array(MAX_32Bit, "2147483647", "2147483647.0000000", 2.147483647e9, 2147483647.0, MAX_32Bit - 1),
+MIN_32Bit, array(MIN_32Bit, "-2147483648", "-2147483648.000", -2.147483648e9, -2147483648.0, MIN_32Bit - 1),
+MAX_64Bit, array(MAX_64Bit, MAX_64Bit + 1, MAX_64Bit - 1),
+MIN_64Bit, array(MIN_64Bit, MIN_64Bit - 1),
+);
+
+$invalidGtOrEqual = array (
+MAX_32Bit, array("2147483648", 2.1474836470001e9, MAX_32Bit + 1),
+MIN_32Bit, array(MIN_32Bit + 1,"-2147483646", -2.1474836460001e9)
+);
+
+
+$failed = false;
+// test valid values
+for ($i = 0; $i < count($validGtOrEqual); $i +=2) {
+ $typeToTestVal = $validGtOrEqual[$i];
+ $compares = $validGtOrEqual[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal >= $compareVal) {
+ // do nothing
+ }
+ else {
+ echo "FAILED: '$typeToTestVal' < '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+// test for invalid values
+for ($i = 0; $i < count($invalidGtOrEqual); $i +=2) {
+ $typeToTestVal = $invalidGtOrEqual[$i];
+ $compares = $invalidGtOrEqual[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal >= $compareVal) {
+ echo "FAILED: '$typeToTestVal' >= '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+
+if ($failed == false) {
+ echo "Test Passed\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+Test Passed
+===DONE===
\ No newline at end of file diff --git a/tests/lang/operators/operator_gt_variation.phpt b/tests/lang/operators/operator_gt_variation.phpt new file mode 100644 index 0000000..a158824 --- /dev/null +++ b/tests/lang/operators/operator_gt_variation.phpt @@ -0,0 +1,62 @@ +--TEST--
+Test > operator : max int 32bit range
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$validGreaterThan = array (
+MAX_32Bit, array(MAX_32Bit - 1, "2147483646", "2147483646.999", 2.147483646e9, 2147483646.9, MIN_32Bit),
+-2147483647, array(MIN_32Bit, "-2147483648", "-2147483647.001", -2.1474836471e9, -2147483647.9),
+);
+
+$invalidGreaterThan = array (
+MAX_32Bit, array(2e33, MAX_32Bit + 1),
+MIN_32Bit, array(MIN_32Bit + 1, MAX_32Bit)
+);
+
+
+
+$failed = false;
+// test valid values
+for ($i = 0; $i < count($validGreaterThan); $i +=2) {
+ $typeToTestVal = $validGreaterThan[$i];
+ $compares = $validGreaterThan[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal > $compareVal) {
+ // do nothing
+ }
+ else {
+ echo "FAILED: '$typeToTestVal' <= '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+// test for invalid values
+for ($i = 0; $i < count($invalidGreaterThan); $i +=2) {
+ $typeToTestVal = $invalidGreaterThan[$i];
+ $compares = $invalidGreaterThan[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal > $compareVal) {
+ echo "FAILED: '$typeToTestVal' > '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+
+if ($failed == false) {
+ echo "Test Passed\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+Test Passed
+===DONE===
\ No newline at end of file diff --git a/tests/lang/operators/operator_gt_variation_64bit.phpt b/tests/lang/operators/operator_gt_variation_64bit.phpt new file mode 100644 index 0000000..6223e07 --- /dev/null +++ b/tests/lang/operators/operator_gt_variation_64bit.phpt @@ -0,0 +1,62 @@ +--TEST--
+Test > operator : max int 64bit range
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$validGreaterThan = array (
+MAX_32Bit, array(MAX_32Bit - 1, "2147483646", "2147483646.999", 2.147483646e9, 2147483646.9, MIN_32Bit),
+-2147483647, array(MIN_32Bit, "-2147483648", "-2147483647.001", -2.1474836471e9, -2147483647.9),
+);
+
+$invalidGreaterThan = array (
+MAX_32Bit, array(2e33, MAX_32Bit + 1),
+MIN_32Bit, array(MIN_32Bit + 1, MAX_32Bit)
+);
+
+
+
+$failed = false;
+// test valid values
+for ($i = 0; $i < count($validGreaterThan); $i +=2) {
+ $typeToTestVal = $validGreaterThan[$i];
+ $compares = $validGreaterThan[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal > $compareVal) {
+ // do nothing
+ }
+ else {
+ echo "FAILED: '$typeToTestVal' <= '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+// test for invalid values
+for ($i = 0; $i < count($invalidGreaterThan); $i +=2) {
+ $typeToTestVal = $invalidGreaterThan[$i];
+ $compares = $invalidGreaterThan[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal > $compareVal) {
+ echo "FAILED: '$typeToTestVal' > '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+
+if ($failed == false) {
+ echo "Test Passed\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+Test Passed
+===DONE===
\ No newline at end of file diff --git a/tests/lang/operators/operator_identical_basic.phpt b/tests/lang/operators/operator_identical_basic.phpt new file mode 100644 index 0000000..a4cd8a0 --- /dev/null +++ b/tests/lang/operators/operator_identical_basic.phpt @@ -0,0 +1,65 @@ +--TEST--
+Test === operator : different types
+--FILE--
+<?php
+
+$valid_true = array(1, "1", "true", 1.0, array(1));
+$valid_false = array(0, "", 0.0, array(), NULL);
+
+$int1 = 679;
+$int2 = -67835;
+$valid_int1 = array(679, +679);
+$valid_int2 = array(-67835);
+$invalid_int1 = array("679", "679abc", " 679", "679 ", 679.0, 6.79E2, "+679", "6 7 9", "6y79", 678);
+$invalid_int2 = array("-67835", "-67835abc", " -67835", "-67835 ", -67835.000, -6.7835E4, "- 67835", "-67,835", "-67 835", "-678y35", -76834);
+
+$float1 = 57385.45835;
+$float2 = -67345.76567;
+$valid_float1 = array(57385.45835, 5.738545835e4);
+$valid_float2 = array(-67345.76567, -6.734576567E4);
+$invalid_float1 = array("57385.45835", "57385.45835aaa", " 57385.45835", "57385. 45835", "57,385.45835", 57385.45834, 5.738545834e4);
+$invalid_float2 = array("-67345.76567", "-67345.76567aaa", " -67345.76567", "- 67345.76567", "-67,345.76567", -67345.76566, -6.734576566E4);
+
+
+$toCompare = array(
+ true, array(true), array_merge($valid_true, $valid_false),
+ false, array(false), array_merge($valid_true, $valid_false),
+ $int1, $valid_int1, $invalid_int1,
+ $int2, $valid_int2, $invalid_int2,
+ $float1, $valid_float1, $invalid_float1,
+ $float2, $valid_float2, $invalid_float2
+);
+
+$failed = false;
+for ($i = 0; $i < count($toCompare); $i +=3) {
+ $typeToTest = $toCompare[$i];
+ $valid_compares = $toCompare[$i + 1];
+ $invalid_compares = $toCompare[$i + 2];
+
+ foreach($valid_compares as $compareVal) {
+ if ($typeToTest === $compareVal) {
+ // do nothing
+ }
+ else {
+ echo "FAILED: '$typeToTest' != '$compareVal'\n";
+ $failed = true;
+ }
+ }
+
+ foreach($invalid_compares as $compareVal) {
+ if ($typeToTest === $compareVal) {
+ echo "FAILED: '$typeToTest' == '$compareVal'\n";
+ $failed = true;
+ }
+ }
+
+}
+if ($failed == false) {
+ echo "Test Passed\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+Test Passed
+===DONE===
\ No newline at end of file diff --git a/tests/lang/operators/operator_identical_variation.phpt b/tests/lang/operators/operator_identical_variation.phpt new file mode 100644 index 0000000..76639c7 --- /dev/null +++ b/tests/lang/operators/operator_identical_variation.phpt @@ -0,0 +1,63 @@ +--TEST--
+Test === operator : max int 32bit range
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$validIdentical = array (
+MAX_32Bit, array(MAX_32Bit),
+MIN_32Bit, array(MIN_32Bit),
+MAX_64Bit, array(MAX_64Bit, MAX_64Bit + 1, MAX_64Bit - 1),
+MIN_64Bit, array(MIN_64Bit, MIN_64Bit - 1, MIN_64Bit + 1),
+);
+
+$invalidIdentical = array (
+MAX_32Bit, array("2147483647", "2147483647.0000000", 2.147483647e9, 2147483647.0, "2147483648", 2.1474836470001e9, MAX_32Bit - 1, MAX_32Bit + 1),
+MIN_32Bit, array("-2147483648", "-2147483648.000", -2.147483648e9, -2147483648.0, "-2147483649", -2.1474836480001e9, MIN_32Bit -1, MIN_32Bit + 1),
+);
+
+
+$failed = false;
+// test for valid values
+for ($i = 0; $i < count($validIdentical); $i +=2) {
+ $typeToTestVal = $validIdentical[$i];
+ $compares = $validIdentical[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal === $compareVal) {
+ // do nothing
+ }
+ else {
+ echo "FAILED: '$typeToTestVal' !== '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+// test for invalid values
+for ($i = 0; $i < count($invalidIdentical); $i +=2) {
+ $typeToTestVal = $invalidIdentical[$i];
+ $compares = $invalidIdentical[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal === $compareVal) {
+ echo "FAILED: '$typeToTestVal' === '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+
+if ($failed == false) {
+ echo "Test Passed\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+Test Passed
+===DONE===
\ No newline at end of file diff --git a/tests/lang/operators/operator_identical_variation_64bit.phpt b/tests/lang/operators/operator_identical_variation_64bit.phpt new file mode 100644 index 0000000..0909c44 --- /dev/null +++ b/tests/lang/operators/operator_identical_variation_64bit.phpt @@ -0,0 +1,65 @@ +--TEST--
+Test === operator : max int 64bit range
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$validIdentical = array (
+MAX_32Bit, array(MAX_32Bit),
+MIN_32Bit, array(MIN_32Bit),
+MAX_64Bit, array(MAX_64Bit),
+MIN_64Bit, array(MIN_64Bit),
+);
+
+$invalidIdentical = array (
+MAX_32Bit, array("2147483647", "2147483647.0000000", 2.147483647e9, 2147483647.0, "2147483648", 2.1474836470001e9, MAX_32Bit - 1, MAX_32Bit + 1),
+MIN_32Bit, array("-2147483648", "-2147483648.000", -2.147483648e9, -2147483648.0, "-2147483649", -2.1474836480001e9, MIN_32Bit -1, MIN_32Bit + 1),
+MAX_64Bit, array(MAX_64Bit - 1, MAX_64Bit + 1),
+MIN_64Bit, array(MIN_64Bit + 1, MIN_64Bit - 1),
+);
+
+
+$failed = false;
+// test for valid values
+for ($i = 0; $i < count($validIdentical); $i +=2) {
+ $typeToTestVal = $validIdentical[$i];
+ $compares = $validIdentical[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal === $compareVal) {
+ // do nothing
+ }
+ else {
+ echo "FAILED: '$typeToTestVal' !== '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+// test for invalid values
+for ($i = 0; $i < count($invalidIdentical); $i +=2) {
+ $typeToTestVal = $invalidIdentical[$i];
+ $compares = $invalidIdentical[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal === $compareVal) {
+ echo "FAILED: '$typeToTestVal' === '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+
+if ($failed == false) {
+ echo "Test Passed\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+Test Passed
+===DONE===
\ No newline at end of file diff --git a/tests/lang/operators/operator_lt_basic.phpt b/tests/lang/operators/operator_lt_basic.phpt new file mode 100644 index 0000000..137adf2 --- /dev/null +++ b/tests/lang/operators/operator_lt_basic.phpt @@ -0,0 +1,62 @@ +--TEST--
+Test < operator : different types
+--FILE--
+<?php
+$valid_true = array(1, "1", "true", 1.0, array(1));
+$valid_false = array(0, "", 0.0, array(), NULL);
+
+$int1 = 677;
+$int2 = -67837;
+$valid_int1 = array("678", "678abc", " 678", "678 ", 678.0, 6.789E2, "+678", +678);
+$valid_int2 = array("-67836", "-67836abc", " -67836", "-67836 ", -67835.0001, -6.78351E4);
+$invalid_int1 = array(676, "676");
+$invalid_int2 = array(-67837, "-67837");
+
+$float1 = 57385.45835;
+$float2 = -67345.76567;
+$valid_float1 = array("57385.45836", "57385.45836aaa", " 57385.45836", 5.738545836e4);
+$valid_float2 = array("-67345.76566", "-67345.76566aaa", " -67345.76566", -6.734576566E4);
+$invalid_float1 = array(57385.45835, 5.738545835e4);
+$invalid_float2 = array(-67345.76567, -6.734576567E4);
+
+
+$toCompare = array(
+ false, $valid_true, $valid_false,
+ $int1, $valid_int1, $invalid_int1,
+ $int2, $valid_int2, $invalid_int2,
+ $float1, $valid_float1, $invalid_float1,
+ $float2, $valid_float2, $invalid_float2
+);
+
+$failed = false;
+for ($i = 0; $i < count($toCompare); $i +=3) {
+ $typeToTest = $toCompare[$i];
+ $valid_compares = $toCompare[$i + 1];
+ $invalid_compares = $toCompare[$i + 2];
+
+ foreach($valid_compares as $compareVal) {
+ if ($typeToTest < $compareVal) {
+ // do nothing
+ }
+ else {
+ echo "FAILED: '$typeToTest' >= '$compareVal'\n";
+ $failed = true;
+ }
+ }
+
+ foreach($invalid_compares as $compareVal) {
+ if ($typeToTest < $compareVal) {
+ echo "FAILED: '$typeToTest' < '$compareVal'\n";
+ $failed = true;
+ }
+ }
+
+}
+if ($failed == false) {
+ echo "Test Passed\n";
+}
+?>
+===DONE===
+--EXPECT--
+Test Passed
+===DONE===
\ No newline at end of file diff --git a/tests/lang/operators/operator_lt_or_equal_basic.phpt b/tests/lang/operators/operator_lt_or_equal_basic.phpt new file mode 100644 index 0000000..381b813 --- /dev/null +++ b/tests/lang/operators/operator_lt_or_equal_basic.phpt @@ -0,0 +1,64 @@ +--TEST--
+Test <= operator : different types
+--FILE--
+<?php
+$valid_true = array(1, "1", "true", 1.0, array(1));
+$valid_false = array(0, "", 0.0, array(), NULL);
+
+$int1 = 678;
+$int2 = -67836;
+$valid_int1 = array("679", "679abc", " 679", 679.0, 6.79E2, "678", "678abc", " 678", 678.0, 6.78E2, 6.789E2, "+678", +678);
+$valid_int2 = array("-67835", "-67835abc", " -67835", -67835.000, -6.7835E4, "-67836", "-67836abc". " -67836", -67835.0001, -6.78351E4, "-67836", -67835.0001, -6.78351E4);
+$invalid_int1 = array(677, "677");
+$invalid_int2 = array(-67874, "-67837");
+
+$float1 = 57385.45834;
+$float2 = -67345.76568;
+$valid_float1 = array("57385.45835", "57385.45835aaa", " 57385.45835", 5.738545835e4, "57385.45834", "57385.45834aaa", " 57385.45834", 5.738545834e4);
+$valid_float2 = array("-67345.76567", "-67345.76567aaa", " -67345.76567", -6.734576567E4, "-67345.76568", "-67345.76568aaa", " -67345.76568", -6.734576568E4);
+$invalid_float1 = array(57385.45833, 5.738545833e4);
+$invalid_float2 = array(-67345.76569, -6.734576569E4);
+
+$toCompare = array(
+ true, $valid_true, $valid_false,
+ false, array_merge($valid_false, $valid_true), NULL,
+ $int1, $valid_int1, $invalid_int1,
+ $int2, $valid_int2, $invalid_int2,
+ $float1, $valid_float1, $invalid_float1,
+ $float2, $valid_float2, $invalid_float2
+);
+
+$failed = false;
+for ($i = 0; $i < count($toCompare); $i +=3) {
+ $typeToTest = $toCompare[$i];
+ $valid_compares = $toCompare[$i + 1];
+ $invalid_compares = $toCompare[$i + 2];
+
+ foreach($valid_compares as $compareVal) {
+ if ($typeToTest <= $compareVal) {
+ // do nothing
+ }
+ else {
+ echo "FAILED: '$typeToTest' > '$compareVal'\n";
+ $failed = true;
+ }
+ }
+
+ if ($invalid_compares != NULL) {
+ foreach($invalid_compares as $compareVal) {
+ if ($typeToTest <= $compareVal) {
+ echo "FAILED: '$typeToTest' <= '$compareVal'\n";
+ $failed = true;
+ }
+ }
+ }
+
+}
+if ($failed == false) {
+ echo "Test Passed\n";
+}
+?>
+===DONE===
+--EXPECT--
+Test Passed
+===DONE===
\ No newline at end of file diff --git a/tests/lang/operators/operator_lt_or_equal_variation.phpt b/tests/lang/operators/operator_lt_or_equal_variation.phpt new file mode 100644 index 0000000..8f5f945 --- /dev/null +++ b/tests/lang/operators/operator_lt_or_equal_variation.phpt @@ -0,0 +1,63 @@ +--TEST--
+Test <= operator : max int 32bit range
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$validLtOrEqual = array (
+MAX_32Bit, array(MAX_32Bit, "2147483647", "2147483647.0000000", 2.147483647e9, 2147483647.0, MAX_32Bit + 1),
+MIN_32Bit, array(MIN_32Bit, "-2147483648", "-2147483648.000", -2.147483648e9, -2147483648.0, MIN_32Bit + 1),
+MAX_64Bit, array(MAX_64Bit, MAX_64Bit + 1, MAX_64Bit - 1),
+MIN_64Bit, array(MIN_64Bit, MIN_64Bit - 1, MIN_64Bit + 1),
+);
+
+$invalidLtOrEqual = array (
+MAX_32Bit, array("2147483646", 2.1474836460001e9, MAX_32Bit - 1),
+MIN_32Bit, array(MIN_32Bit - 1, "-2147483649", -2.1474836480001e9)
+);
+
+
+$failed = false;
+// test valid values
+for ($i = 0; $i < count($validLtOrEqual); $i +=2) {
+ $typeToTestVal = $validLtOrEqual[$i];
+ $compares = $validLtOrEqual[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal <= $compareVal) {
+ // do nothing
+ }
+ else {
+ echo "FAILED: '$typeToTestVal' > '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+// test invalid values
+for ($i = 0; $i < count($invalidLtOrEqual); $i +=2) {
+ $typeToTestVal = $invalidLtOrEqual[$i];
+ $compares = $invalidLtOrEqual[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal <= $compareVal) {
+ echo "FAILED: '$typeToTestVal' <= '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+
+if ($failed == false) {
+ echo "Test Passed\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+Test Passed
+===DONE===
\ No newline at end of file diff --git a/tests/lang/operators/operator_lt_or_equal_variation_64bit.phpt b/tests/lang/operators/operator_lt_or_equal_variation_64bit.phpt new file mode 100644 index 0000000..03c974f --- /dev/null +++ b/tests/lang/operators/operator_lt_or_equal_variation_64bit.phpt @@ -0,0 +1,63 @@ +--TEST--
+Test <= operator : max int 64bit range
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$validLtOrEqual = array (
+MAX_32Bit, array(MAX_32Bit, "2147483647", "2147483647.0000000", 2.147483647e9, 2147483647.0, MAX_32Bit + 1),
+MIN_32Bit, array(MIN_32Bit, "-2147483648", "-2147483648.000", -2.147483648e9, -2147483648.0, MIN_32Bit + 1),
+MAX_64Bit, array(MAX_64Bit, MAX_64Bit + 1),
+MIN_64Bit, array(MIN_64Bit, MIN_64Bit - 1, MIN_64Bit + 1),
+);
+
+$invalidLtOrEqual = array (
+MAX_32Bit, array("2147483646", 2.1474836460001e9, MAX_32Bit - 1),
+MIN_32Bit, array(MIN_32Bit - 1, "-2147483649", -2.1474836480001e9)
+);
+
+
+$failed = false;
+// test valid values
+for ($i = 0; $i < count($validLtOrEqual); $i +=2) {
+ $typeToTestVal = $validLtOrEqual[$i];
+ $compares = $validLtOrEqual[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal <= $compareVal) {
+ // do nothing
+ }
+ else {
+ echo "FAILED: '$typeToTestVal' > '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+// test invalid values
+for ($i = 0; $i < count($invalidLtOrEqual); $i +=2) {
+ $typeToTestVal = $invalidLtOrEqual[$i];
+ $compares = $invalidLtOrEqual[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal <= $compareVal) {
+ echo "FAILED: '$typeToTestVal' <= '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+
+if ($failed == false) {
+ echo "Test Passed\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+Test Passed
+===DONE===
\ No newline at end of file diff --git a/tests/lang/operators/operator_lt_variation.phpt b/tests/lang/operators/operator_lt_variation.phpt new file mode 100644 index 0000000..a2a8f6a --- /dev/null +++ b/tests/lang/operators/operator_lt_variation.phpt @@ -0,0 +1,60 @@ +--TEST--
+Test < operator : max int 32bit range
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$validLessThan = array (
+2147483646, array(MAX_32Bit, "2147483647", "2147483647.001", 2.147483647e9, 2147483647.9),
+MIN_32Bit, array(MIN_32Bit + 1, "-2147483647", "-2147483646.001", -2.1474836461e9, -2147483646.9),
+);
+
+$invalidLessThan = array (
+MAX_32Bit, array("2147483646", 2.1474836460001e9, MAX_32Bit - 1),
+MIN_32Bit, array(MIN_32Bit - 1, "-2147483649", -2.1474836480001e9)
+);
+
+$failed = false;
+// test for equality
+for ($i = 0; $i < count($validLessThan); $i +=2) {
+ $typeToTestVal = $validLessThan[$i];
+ $compares = $validLessThan[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal < $compareVal) {
+ // do nothing
+ }
+ else {
+ echo "FAILED: '$typeToTestVal' >= '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+// test for invalid values
+for ($i = 0; $i < count($invalidLessThan); $i +=2) {
+ $typeToTestVal = $invalidLessThan[$i];
+ $compares = $invalidLessThan[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal < $compareVal) {
+ echo "FAILED: '$typeToTestVal' < '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+
+if ($failed == false) {
+ echo "Test Passed\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+Test Passed
+===DONE===
\ No newline at end of file diff --git a/tests/lang/operators/operator_lt_variation_64bit.phpt b/tests/lang/operators/operator_lt_variation_64bit.phpt new file mode 100644 index 0000000..172ef39 --- /dev/null +++ b/tests/lang/operators/operator_lt_variation_64bit.phpt @@ -0,0 +1,60 @@ +--TEST--
+Test < operator : max int 64bit range
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$validLessThan = array (
+2147483646, array(MAX_32Bit, "2147483647", "2147483647.001", 2.147483647e9, 2147483647.9),
+MIN_32Bit, array(MIN_32Bit + 1, "-2147483647", "-2147483646.001", -2.1474836461e9, -2147483646.9),
+);
+
+$invalidLessThan = array (
+MAX_32Bit, array("2147483646", 2.1474836460001e9, MAX_32Bit - 1),
+MIN_32Bit, array(MIN_32Bit - 1, "-2147483649", -2.1474836480001e9)
+);
+
+$failed = false;
+// test for equality
+for ($i = 0; $i < count($validLessThan); $i +=2) {
+ $typeToTestVal = $validLessThan[$i];
+ $compares = $validLessThan[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal < $compareVal) {
+ // do nothing
+ }
+ else {
+ echo "FAILED: '$typeToTestVal' >= '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+// test for invalid values
+for ($i = 0; $i < count($invalidLessThan); $i +=2) {
+ $typeToTestVal = $invalidLessThan[$i];
+ $compares = $invalidLessThan[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal < $compareVal) {
+ echo "FAILED: '$typeToTestVal' < '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+
+if ($failed == false) {
+ echo "Test Passed\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+Test Passed
+===DONE===
\ No newline at end of file diff --git a/tests/lang/operators/operator_notequals_basic.phpt b/tests/lang/operators/operator_notequals_basic.phpt new file mode 100644 index 0000000..059c99d --- /dev/null +++ b/tests/lang/operators/operator_notequals_basic.phpt @@ -0,0 +1,65 @@ +--TEST--
+Test != operator : different types
+--FILE--
+<?php
+
+$valid_true = array(1, "1", "true", 1.0, array(1));
+$valid_false = array(0, "", 0.0, array(), NULL);
+
+$int1 = 679;
+$int2 = -67835;
+$valid_int1 = array("6 7 9", "6y79", 678);
+$valid_int2 = array("- 67835", "-67,835", "-67 835", "-678y35", -76834);
+$invalid_int1 = array("679", "679abc", " 679", "679 ", 679.0, 6.79E2, "+679", +679);
+$invalid_int2 = array("-67835", "-67835abc", " -67835", "-67835 ", -67835.000, -6.7835E4);
+
+$float1 = 57385.45835;
+$float2 = -67345.76567;
+$valid_float1 = array("57385. 45835", "57,385.45835", 57385.45834, 5.738545834e4);
+$valid_float2 = array("- 67345.76567", "-67,345.76567", -67345.76566, -6.734576566E4);
+$invalid_float1 = array("57385.45835", "57385.45835aaa", " 57385.45835", 5.738545835e4);
+$invalid_float2 = array("-67345.76567", "-67345.76567aaa", " -67345.76567", -6.734576567E4);
+
+
+$toCompare = array(
+ true, $valid_false, $valid_true,
+ false, $valid_true, $valid_false,
+ $int1, $valid_int1, $invalid_int1,
+ $int2, $valid_int2, $invalid_int2,
+ $float1, $valid_float1, $invalid_float1,
+ $float2, $valid_float2, $invalid_float2
+);
+
+$failed = false;
+for ($i = 0; $i < count($toCompare); $i +=3) {
+ $typeToTest = $toCompare[$i];
+ $valid_compares = $toCompare[$i + 1];
+ $invalid_compares = $toCompare[$i + 2];
+
+ foreach($valid_compares as $compareVal) {
+ if ($typeToTest != $compareVal && $typeToTest <> $compareVal) {
+ // do nothing
+ }
+ else {
+ echo "FAILED: '$typeToTest' == '$compareVal'\n";
+ $failed = true;
+ }
+ }
+
+ foreach($invalid_compares as $compareVal) {
+ if ($typeToTest != $compareVal || $typeToTest <> $compareVal) {
+ echo "FAILED: '$typeToTest' != '$compareVal'\n";
+ $failed = true;
+ }
+ }
+
+}
+if ($failed == false) {
+ echo "Test Passed\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+Test Passed
+===DONE===
\ No newline at end of file diff --git a/tests/lang/operators/operator_notequals_variation.phpt b/tests/lang/operators/operator_notequals_variation.phpt new file mode 100644 index 0000000..a7827b4 --- /dev/null +++ b/tests/lang/operators/operator_notequals_variation.phpt @@ -0,0 +1,63 @@ +--TEST--
+Test != operator : max int 32bit range
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$invalidNotEquals = array (
+MAX_32Bit, array(MAX_32Bit, "2147483647", "2147483647.0000000", 2.147483647e9),
+MIN_32Bit, array(MIN_32Bit, "-2147483648", "-2147483648.000", -2.147483648e9),
+MAX_64Bit, array(MAX_64Bit, MAX_64Bit + 1, MAX_64Bit - 1),
+MIN_64Bit, array(MIN_64Bit, MIN_64Bit - 1, MIN_64Bit + 1),
+);
+
+$validNotEquals = array (
+MAX_32Bit, array("2147483648", 2.1474836470001e9, MAX_32Bit - 1, MAX_32Bit + 1),
+MIN_32Bit, array("-2147483649", -2.1474836480001e9, MIN_32Bit -1, MIN_32Bit + 1),
+);
+
+
+$failed = false;
+// test valid values
+for ($i = 0; $i < count($validNotEquals); $i +=2) {
+ $typeToTestVal = $validNotEquals[$i];
+ $compares = $validNotEquals[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal != $compareVal && $typeToTestVal != $compareVal) {
+ // do nothing
+ }
+ else {
+ echo "FAILED: '$typeToTestVal' == '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+// test invalid values
+for ($i = 0; $i < count($invalidNotEquals); $i +=2) {
+ $typeToTestVal = $invalidNotEquals[$i];
+ $compares = $invalidNotEquals[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal != $compareVal || $typeToTestVal != $compareVal) {
+ echo "FAILED: '$typeToTestVal' != '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+
+if ($failed == false) {
+ echo "Test Passed\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+Test Passed
+===DONE===
\ No newline at end of file diff --git a/tests/lang/operators/operator_notequals_variation_64bit.phpt b/tests/lang/operators/operator_notequals_variation_64bit.phpt new file mode 100644 index 0000000..ed26b52 --- /dev/null +++ b/tests/lang/operators/operator_notequals_variation_64bit.phpt @@ -0,0 +1,65 @@ +--TEST--
+Test == operator : max int 64bit range
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$invalidNotEquals = array (
+MAX_32Bit, array(MAX_32Bit, "2147483647", "2147483647.0000000", 2.147483647e9),
+MIN_32Bit, array(MIN_32Bit, "-2147483648", "-2147483648.000", -2.147483648e9),
+MAX_64Bit, array(MAX_64Bit, MAX_64Bit + 1),
+MIN_64Bit, array(MIN_64Bit, MIN_64Bit - 1),
+);
+
+$validNotEquals = array (
+MAX_32Bit, array("2147483648", 2.1474836470001e9, MAX_32Bit - 1, MAX_32Bit + 1),
+MIN_32Bit, array("-2147483649", -2.1474836480001e9, MIN_32Bit -1, MIN_32Bit + 1),
+MAX_64Bit, array(MAX_64Bit - 1),
+MIN_64Bit, array(MIN_64Bit + 1),
+);
+
+
+$failed = false;
+// test valid values
+for ($i = 0; $i < count($validNotEquals); $i +=2) {
+ $typeToTestVal = $validNotEquals[$i];
+ $compares = $validNotEquals[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal != $compareVal && $typeToTestVal <> $compareVal) {
+ // do nothing
+ }
+ else {
+ echo "FAILED: '$typeToTestVal' == '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+// test invalid values
+for ($i = 0; $i < count($invalidNotEquals); $i +=2) {
+ $typeToTestVal = $invalidNotEquals[$i];
+ $compares = $invalidNotEquals[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal != $compareVal || $typeToTestVal <> $compareVal) {
+ echo "FAILED: '$typeToTestVal' != '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+
+if ($failed == false) {
+ echo "Test Passed\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+Test Passed
+===DONE===
\ No newline at end of file diff --git a/tests/lang/operators/operator_notidentical_basic.phpt b/tests/lang/operators/operator_notidentical_basic.phpt new file mode 100644 index 0000000..d433289 --- /dev/null +++ b/tests/lang/operators/operator_notidentical_basic.phpt @@ -0,0 +1,65 @@ +--TEST--
+Test !== operator : different types
+--FILE--
+<?php
+
+$valid_true = array(1, "1", "true", 1.0, array(1));
+$valid_false = array(0, "", 0.0, array(), NULL);
+
+$int1 = 679;
+$int2 = -67835;
+$valid_int1 = array("679", "679abc", " 679", "679 ", 679.0, 6.79E2, "+679", "6 7 9", "6y79", 678);
+$valid_int2 = array("-67835", "-67835abc", " -67835", "-67835 ", -67835.000, -6.7835E4, "- 67835", "-67,835", "-67 835", "-678y35", -76834);
+$invalid_int1 = array(679, +679);
+$invalid_int2 = array(-67835);
+
+$float1 = 57385.45835;
+$float2 = -67345.76567;
+$valid_float1 = array("57385.45835", "57385.45835aaa", " 57385.45835", "57385. 45835", "57,385.45835", 57385.45834, 5.738545834e4);
+$valid_float2 = array("-67345.76567", "-67345.76567aaa", " -67345.76567", "- 67345.76567", "-67,345.76567", -67345.76566, -6.734576566E4);
+$invalid_float1 = array(57385.45835, 5.738545835e4);
+$invalid_float2 = array(-67345.76567, -6.734576567E4);
+
+
+$toCompare = array(
+ true, array_merge($valid_true, $valid_false), array(true),
+ false, array_merge($valid_true, $valid_false), array(false),
+ $int1, $valid_int1, $invalid_int1,
+ $int2, $valid_int2, $invalid_int2,
+ $float1, $valid_float1, $invalid_float1,
+ $float2, $valid_float2, $invalid_float2
+);
+
+$failed = false;
+for ($i = 0; $i < count($toCompare); $i +=3) {
+ $typeToTest = $toCompare[$i];
+ $valid_compares = $toCompare[$i + 1];
+ $invalid_compares = $toCompare[$i + 2];
+
+ foreach($valid_compares as $compareVal) {
+ if ($typeToTest !== $compareVal) {
+ // do nothing
+ }
+ else {
+ echo "FAILED: '$typeToTest' === '$compareVal'\n";
+ $failed = true;
+ }
+ }
+
+ foreach($invalid_compares as $compareVal) {
+ if ($typeToTest !== $compareVal) {
+ echo "FAILED: '$typeToTest' !== '$compareVal'\n";
+ $failed = true;
+ }
+ }
+
+}
+if ($failed == false) {
+ echo "Test Passed\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+Test Passed
+===DONE===
\ No newline at end of file diff --git a/tests/lang/operators/operator_notidentical_variation.phpt b/tests/lang/operators/operator_notidentical_variation.phpt new file mode 100644 index 0000000..9af6f8d --- /dev/null +++ b/tests/lang/operators/operator_notidentical_variation.phpt @@ -0,0 +1,64 @@ +--TEST--
+Test !== operator : max int 32bit range
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$invalidNotIdentical = array (
+MAX_32Bit, array(MAX_32Bit),
+MIN_32Bit, array(MIN_32Bit),
+MAX_64Bit, array(MAX_64Bit, MAX_64Bit + 1, MAX_64Bit - 1),
+MIN_64Bit, array(MIN_64Bit, MIN_64Bit - 1, MIN_64Bit + 1),
+);
+
+$validNotIdentical = array (
+MAX_32Bit, array("2147483647", "2147483647.0000000", 2.147483647e9, 2147483647.0, "2147483648", 2.1474836470001e9, MAX_32Bit - 1, MAX_32Bit + 1),
+MIN_32Bit, array("-2147483648", "-2147483648.000", -2.147483648e9, -2147483648.0, "-2147483649", -2.1474836480001e9, MIN_32Bit -1, MIN_32Bit + 1),
+);
+
+
+$failed = false;
+// test for valid values
+for ($i = 0; $i < count($validNotIdentical); $i +=2) {
+ $typeToTestVal = $validNotIdentical[$i];
+ $compares = $validNotIdentical[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal !== $compareVal) {
+ //Do Nothing
+ }
+ else {
+ echo "FAILED: '$typeToTestVal' === '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+// test for invalid values
+for ($i = 0; $i < count($invalidNotIdentical); $i +=2) {
+ $typeToTestVal = $invalidNotIdentical[$i];
+ $compares = $invalidNotIdentical[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal !== $compareVal) {
+ echo "FAILED: '$typeToTestVal' !== '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+
+
+if ($failed == false) {
+ echo "Test Passed\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+Test Passed
+===DONE===
\ No newline at end of file diff --git a/tests/lang/operators/operator_notidentical_variation_64bit.phpt b/tests/lang/operators/operator_notidentical_variation_64bit.phpt new file mode 100644 index 0000000..e8f2c7e --- /dev/null +++ b/tests/lang/operators/operator_notidentical_variation_64bit.phpt @@ -0,0 +1,65 @@ +--TEST--
+Test !== operator : max int 64bit range
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$invalidNotIdentical = array (
+MAX_32Bit, array(MAX_32Bit),
+MIN_32Bit, array(MIN_32Bit),
+MAX_64Bit, array(MAX_64Bit),
+MIN_64Bit, array(MIN_64Bit),
+);
+
+$validNotIdentical = array (
+MAX_32Bit, array("2147483647", "2147483647.0000000", 2.147483647e9, 2147483647.0, "2147483648", 2.1474836470001e9, MAX_32Bit - 1, MAX_32Bit + 1),
+MIN_32Bit, array("-2147483648", "-2147483648.000", -2.147483648e9, -2147483648.0, "-2147483649", -2.1474836480001e9, MIN_32Bit -1, MIN_32Bit + 1),
+MAX_64Bit, array(MAX_64Bit - 1, MAX_64Bit + 1),
+MIN_64Bit, array(MIN_64Bit + 1, MIN_64Bit - 1),
+);
+
+
+$failed = false;
+// test for valid values
+for ($i = 0; $i < count($validNotIdentical); $i +=2) {
+ $typeToTestVal = $validNotIdentical[$i];
+ $compares = $validNotIdentical[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal !== $compareVal) {
+ //Do Nothing
+ }
+ else {
+ echo "FAILED: '$typeToTestVal' === '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+// test for invalid values
+for ($i = 0; $i < count($invalidNotIdentical); $i +=2) {
+ $typeToTestVal = $invalidNotIdentical[$i];
+ $compares = $invalidNotIdentical[$i + 1];
+ foreach($compares as $compareVal) {
+ if ($typeToTestVal !== $compareVal) {
+ echo "FAILED: '$typeToTestVal' !== '$compareVal'\n";
+ $failed = true;
+ }
+ }
+}
+
+if ($failed == false) {
+ echo "Test Passed\n";
+}
+
+?>
+===DONE===
+--EXPECT--
+Test Passed
+===DONE===
\ No newline at end of file diff --git a/tests/lang/operators/postdec_basiclong_64bit.phpt b/tests/lang/operators/postdec_basiclong_64bit.phpt new file mode 100644 index 0000000..9875df8 --- /dev/null +++ b/tests/lang/operators/postdec_basiclong_64bit.phpt @@ -0,0 +1,61 @@ +--TEST--
+Test N-- operator : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ $longVal--;
+ var_dump($longVal);
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+int(9223372036854775806)
+--- testing: -9223372036854775808 ---
+float(-9.2233720368548E+18)
+--- testing: 2147483647 ---
+int(2147483646)
+--- testing: -2147483648 ---
+int(-2147483649)
+--- testing: 9223372034707292160 ---
+int(9223372034707292159)
+--- testing: -9223372034707292160 ---
+int(-9223372034707292161)
+--- testing: 2147483648 ---
+int(2147483647)
+--- testing: -2147483649 ---
+int(-2147483650)
+--- testing: 4294967294 ---
+int(4294967293)
+--- testing: 4294967295 ---
+int(4294967294)
+--- testing: 4294967293 ---
+int(4294967292)
+--- testing: 9223372036854775806 ---
+int(9223372036854775805)
+--- testing: 9.2233720368548E+18 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775807 ---
+int(-9223372036854775808)
+--- testing: -9.2233720368548E+18 ---
+float(-9.2233720368548E+18)
+===DONE===
diff --git a/tests/lang/operators/postdec_variationStr.phpt b/tests/lang/operators/postdec_variationStr.phpt new file mode 100644 index 0000000..ee5a8cd --- /dev/null +++ b/tests/lang/operators/postdec_variationStr.phpt @@ -0,0 +1,49 @@ +--TEST--
+Test N-- operator : various numbers as strings
+--FILE--
+<?php
+
+$strVals = array(
+ "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",
+ "a5.9"
+);
+
+
+foreach ($strVals as $strVal) {
+ echo "--- testing: '$strVal' ---\n";
+ $strVal--;
+ var_dump($strVal);
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: '0' ---
+int(-1)
+--- testing: '65' ---
+int(64)
+--- testing: '-44' ---
+int(-45)
+--- testing: '1.2' ---
+float(0.2)
+--- testing: '-7.7' ---
+float(-8.7)
+--- testing: 'abc' ---
+string(3) "abc"
+--- testing: '123abc' ---
+string(6) "123abc"
+--- testing: '123e5' ---
+float(12299999)
+--- testing: '123e5xyz' ---
+string(8) "123e5xyz"
+--- testing: ' 123abc' ---
+string(7) " 123abc"
+--- testing: '123 abc' ---
+string(7) "123 abc"
+--- testing: '123abc ' ---
+string(7) "123abc "
+--- testing: '3.4a' ---
+string(4) "3.4a"
+--- testing: 'a5.9' ---
+string(4) "a5.9"
+===DONE===
diff --git a/tests/lang/operators/postinc_basiclong_64bit.phpt b/tests/lang/operators/postinc_basiclong_64bit.phpt new file mode 100644 index 0000000..494259a --- /dev/null +++ b/tests/lang/operators/postinc_basiclong_64bit.phpt @@ -0,0 +1,61 @@ +--TEST--
+Test N++ operator : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ $longVal++;
+ var_dump($longVal);
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775808 ---
+int(-9223372036854775807)
+--- testing: 2147483647 ---
+int(2147483648)
+--- testing: -2147483648 ---
+int(-2147483647)
+--- testing: 9223372034707292160 ---
+int(9223372034707292161)
+--- testing: -9223372034707292160 ---
+int(-9223372034707292159)
+--- testing: 2147483648 ---
+int(2147483649)
+--- testing: -2147483649 ---
+int(-2147483648)
+--- testing: 4294967294 ---
+int(4294967295)
+--- testing: 4294967295 ---
+int(4294967296)
+--- testing: 4294967293 ---
+int(4294967294)
+--- testing: 9223372036854775806 ---
+int(9223372036854775807)
+--- testing: 9.2233720368548E+18 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775807 ---
+int(-9223372036854775806)
+--- testing: -9.2233720368548E+18 ---
+float(-9.2233720368548E+18)
+===DONE===
diff --git a/tests/lang/operators/postinc_variationStr.phpt b/tests/lang/operators/postinc_variationStr.phpt new file mode 100644 index 0000000..6fbe804 --- /dev/null +++ b/tests/lang/operators/postinc_variationStr.phpt @@ -0,0 +1,49 @@ +--TEST--
+Test N++ operator : various numbers as strings
+--FILE--
+<?php
+
+$strVals = array(
+ "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",
+ "a5.9"
+);
+
+
+foreach ($strVals as $strVal) {
+ echo "--- testing: '$strVal' ---\n";
+ $strVal++;
+ var_dump($strVal);
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: '0' ---
+int(1)
+--- testing: '65' ---
+int(66)
+--- testing: '-44' ---
+int(-43)
+--- testing: '1.2' ---
+float(2.2)
+--- testing: '-7.7' ---
+float(-6.7)
+--- testing: 'abc' ---
+string(3) "abd"
+--- testing: '123abc' ---
+string(6) "123abd"
+--- testing: '123e5' ---
+float(12300001)
+--- testing: '123e5xyz' ---
+string(8) "123e5xza"
+--- testing: ' 123abc' ---
+string(7) " 123abd"
+--- testing: '123 abc' ---
+string(7) "123 abd"
+--- testing: '123abc ' ---
+string(7) "123abc "
+--- testing: '3.4a' ---
+string(4) "3.4b"
+--- testing: 'a5.9' ---
+string(4) "a5.0"
+===DONE===
diff --git a/tests/lang/operators/predec_basiclong_64bit.phpt b/tests/lang/operators/predec_basiclong_64bit.phpt new file mode 100644 index 0000000..c1b15fd --- /dev/null +++ b/tests/lang/operators/predec_basiclong_64bit.phpt @@ -0,0 +1,60 @@ +--TEST--
+Test --N operator : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(--$longVal);
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 --- +int(9223372036854775806) +--- testing: -9223372036854775808 --- +float(-9.2233720368548E+18) +--- testing: 2147483647 --- +int(2147483646) +--- testing: -2147483648 --- +int(-2147483649) +--- testing: 9223372034707292160 --- +int(9223372034707292159) +--- testing: -9223372034707292160 --- +int(-9223372034707292161) +--- testing: 2147483648 --- +int(2147483647) +--- testing: -2147483649 --- +int(-2147483650) +--- testing: 4294967294 --- +int(4294967293) +--- testing: 4294967295 --- +int(4294967294) +--- testing: 4294967293 --- +int(4294967292) +--- testing: 9223372036854775806 --- +int(9223372036854775805) +--- testing: 9.2233720368548E+18 --- +float(9.2233720368548E+18) +--- testing: -9223372036854775807 --- +int(-9223372036854775808) +--- testing: -9.2233720368548E+18 --- +float(-9.2233720368548E+18)
+===DONE===
diff --git a/tests/lang/operators/predec_variationStr.phpt b/tests/lang/operators/predec_variationStr.phpt new file mode 100644 index 0000000..c7fb574 --- /dev/null +++ b/tests/lang/operators/predec_variationStr.phpt @@ -0,0 +1,48 @@ +--TEST--
+Test --N operator : various numbers as strings
+--FILE--
+<?php
+
+$strVals = array(
+ "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",
+ "a5.9"
+);
+
+
+foreach ($strVals as $strVal) {
+ echo "--- testing: '$strVal' ---\n";
+ var_dump(--$strVal);
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: '0' --- +int(-1) +--- testing: '65' --- +int(64) +--- testing: '-44' --- +int(-45) +--- testing: '1.2' --- +float(0.2) +--- testing: '-7.7' --- +float(-8.7) +--- testing: 'abc' --- +string(3) "abc" +--- testing: '123abc' --- +string(6) "123abc" +--- testing: '123e5' --- +float(12299999) +--- testing: '123e5xyz' --- +string(8) "123e5xyz" +--- testing: ' 123abc' --- +string(7) " 123abc" +--- testing: '123 abc' --- +string(7) "123 abc" +--- testing: '123abc ' --- +string(7) "123abc " +--- testing: '3.4a' --- +string(4) "3.4a" +--- testing: 'a5.9' --- +string(4) "a5.9"
+===DONE===
diff --git a/tests/lang/operators/preinc_basiclong_64bit.phpt b/tests/lang/operators/preinc_basiclong_64bit.phpt new file mode 100644 index 0000000..599aa4e --- /dev/null +++ b/tests/lang/operators/preinc_basiclong_64bit.phpt @@ -0,0 +1,60 @@ +--TEST--
+Test ++N operator : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(++$longVal);
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 --- +float(9.2233720368548E+18) +--- testing: -9223372036854775808 --- +int(-9223372036854775807) +--- testing: 2147483647 --- +int(2147483648) +--- testing: -2147483648 --- +int(-2147483647) +--- testing: 9223372034707292160 --- +int(9223372034707292161) +--- testing: -9223372034707292160 --- +int(-9223372034707292159) +--- testing: 2147483648 --- +int(2147483649) +--- testing: -2147483649 --- +int(-2147483648) +--- testing: 4294967294 --- +int(4294967295) +--- testing: 4294967295 --- +int(4294967296) +--- testing: 4294967293 --- +int(4294967294) +--- testing: 9223372036854775806 --- +int(9223372036854775807) +--- testing: 9.2233720368548E+18 --- +float(9.2233720368548E+18) +--- testing: -9223372036854775807 --- +int(-9223372036854775806) +--- testing: -9.2233720368548E+18 --- +float(-9.2233720368548E+18)
+===DONE===
diff --git a/tests/lang/operators/preinc_variationStr.phpt b/tests/lang/operators/preinc_variationStr.phpt new file mode 100644 index 0000000..010a237 --- /dev/null +++ b/tests/lang/operators/preinc_variationStr.phpt @@ -0,0 +1,48 @@ +--TEST--
+Test ++N operator : various numbers as strings
+--FILE--
+<?php
+
+$strVals = array(
+ "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",
+ "a5.9"
+);
+
+
+foreach ($strVals as $strVal) {
+ echo "--- testing: '$strVal' ---\n";
+ var_dump(++$strVal);
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: '0' --- +int(1) +--- testing: '65' --- +int(66) +--- testing: '-44' --- +int(-43) +--- testing: '1.2' --- +float(2.2) +--- testing: '-7.7' --- +float(-6.7) +--- testing: 'abc' --- +string(3) "abd" +--- testing: '123abc' --- +string(6) "123abd" +--- testing: '123e5' --- +float(12300001) +--- testing: '123e5xyz' --- +string(8) "123e5xza" +--- testing: ' 123abc' --- +string(7) " 123abd" +--- testing: '123 abc' --- +string(7) "123 abd" +--- testing: '123abc ' --- +string(7) "123abc " +--- testing: '3.4a' --- +string(4) "3.4b" +--- testing: 'a5.9' --- +string(4) "a5.0"
+===DONE===
diff --git a/tests/lang/operators/subtract_basiclong_64bit.phpt b/tests/lang/operators/subtract_basiclong_64bit.phpt new file mode 100644 index 0000000..f52b951 --- /dev/null +++ b/tests/lang/operators/subtract_basiclong_64bit.phpt @@ -0,0 +1,582 @@ +--TEST--
+Test - operator : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+$otherVals = array(0, 1, -1, 7, 9, 65, -44, MAX_32Bit, MAX_64Bit);
+
+error_reporting(E_ERROR);
+
+foreach ($longVals as $longVal) {
+ foreach($otherVals as $otherVal) {
+ echo "--- testing: $longVal - $otherVal ---\n";
+ var_dump($longVal-$otherVal);
+ }
+}
+
+foreach ($otherVals as $otherVal) {
+ foreach($longVals as $longVal) {
+ echo "--- testing: $otherVal - $longVal ---\n";
+ var_dump($otherVal-$longVal);
+ }
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 - 0 --- +int(9223372036854775807) +--- testing: 9223372036854775807 - 1 --- +int(9223372036854775806) +--- testing: 9223372036854775807 - -1 --- +float(9.2233720368548E+18) +--- testing: 9223372036854775807 - 7 --- +int(9223372036854775800) +--- testing: 9223372036854775807 - 9 --- +int(9223372036854775798) +--- testing: 9223372036854775807 - 65 --- +int(9223372036854775742) +--- testing: 9223372036854775807 - -44 --- +float(9.2233720368548E+18) +--- testing: 9223372036854775807 - 2147483647 --- +int(9223372034707292160) +--- testing: 9223372036854775807 - 9223372036854775807 --- +int(0) +--- testing: -9223372036854775808 - 0 --- +int(-9223372036854775808) +--- testing: -9223372036854775808 - 1 --- +float(-9.2233720368548E+18) +--- testing: -9223372036854775808 - -1 --- +int(-9223372036854775807) +--- testing: -9223372036854775808 - 7 --- +float(-9.2233720368548E+18) +--- testing: -9223372036854775808 - 9 --- +float(-9.2233720368548E+18) +--- testing: -9223372036854775808 - 65 --- +float(-9.2233720368548E+18) +--- testing: -9223372036854775808 - -44 --- +int(-9223372036854775764) +--- testing: -9223372036854775808 - 2147483647 --- +float(-9.2233720390023E+18) +--- testing: -9223372036854775808 - 9223372036854775807 --- +float(-1.844674407371E+19) +--- testing: 2147483647 - 0 --- +int(2147483647) +--- testing: 2147483647 - 1 --- +int(2147483646) +--- testing: 2147483647 - -1 --- +int(2147483648) +--- testing: 2147483647 - 7 --- +int(2147483640) +--- testing: 2147483647 - 9 --- +int(2147483638) +--- testing: 2147483647 - 65 --- +int(2147483582) +--- testing: 2147483647 - -44 --- +int(2147483691) +--- testing: 2147483647 - 2147483647 --- +int(0) +--- testing: 2147483647 - 9223372036854775807 --- +int(-9223372034707292160) +--- testing: -2147483648 - 0 --- +int(-2147483648) +--- testing: -2147483648 - 1 --- +int(-2147483649) +--- testing: -2147483648 - -1 --- +int(-2147483647) +--- testing: -2147483648 - 7 --- +int(-2147483655) +--- testing: -2147483648 - 9 --- +int(-2147483657) +--- testing: -2147483648 - 65 --- +int(-2147483713) +--- testing: -2147483648 - -44 --- +int(-2147483604) +--- testing: -2147483648 - 2147483647 --- +int(-4294967295) +--- testing: -2147483648 - 9223372036854775807 --- +float(-9.2233720390023E+18) +--- testing: 9223372034707292160 - 0 --- +int(9223372034707292160) +--- testing: 9223372034707292160 - 1 --- +int(9223372034707292159) +--- testing: 9223372034707292160 - -1 --- +int(9223372034707292161) +--- testing: 9223372034707292160 - 7 --- +int(9223372034707292153) +--- testing: 9223372034707292160 - 9 --- +int(9223372034707292151) +--- testing: 9223372034707292160 - 65 --- +int(9223372034707292095) +--- testing: 9223372034707292160 - -44 --- +int(9223372034707292204) +--- testing: 9223372034707292160 - 2147483647 --- +int(9223372032559808513) +--- testing: 9223372034707292160 - 9223372036854775807 --- +int(-2147483647) +--- testing: -9223372034707292160 - 0 --- +int(-9223372034707292160) +--- testing: -9223372034707292160 - 1 --- +int(-9223372034707292161) +--- testing: -9223372034707292160 - -1 --- +int(-9223372034707292159) +--- testing: -9223372034707292160 - 7 --- +int(-9223372034707292167) +--- testing: -9223372034707292160 - 9 --- +int(-9223372034707292169) +--- testing: -9223372034707292160 - 65 --- +int(-9223372034707292225) +--- testing: -9223372034707292160 - -44 --- +int(-9223372034707292116) +--- testing: -9223372034707292160 - 2147483647 --- +int(-9223372036854775807) +--- testing: -9223372034707292160 - 9223372036854775807 --- +float(-1.8446744071562E+19) +--- testing: 2147483648 - 0 --- +int(2147483648) +--- testing: 2147483648 - 1 --- +int(2147483647) +--- testing: 2147483648 - -1 --- +int(2147483649) +--- testing: 2147483648 - 7 --- +int(2147483641) +--- testing: 2147483648 - 9 --- +int(2147483639) +--- testing: 2147483648 - 65 --- +int(2147483583) +--- testing: 2147483648 - -44 --- +int(2147483692) +--- testing: 2147483648 - 2147483647 --- +int(1) +--- testing: 2147483648 - 9223372036854775807 --- +int(-9223372034707292159) +--- testing: -2147483649 - 0 --- +int(-2147483649) +--- testing: -2147483649 - 1 --- +int(-2147483650) +--- testing: -2147483649 - -1 --- +int(-2147483648) +--- testing: -2147483649 - 7 --- +int(-2147483656) +--- testing: -2147483649 - 9 --- +int(-2147483658) +--- testing: -2147483649 - 65 --- +int(-2147483714) +--- testing: -2147483649 - -44 --- +int(-2147483605) +--- testing: -2147483649 - 2147483647 --- +int(-4294967296) +--- testing: -2147483649 - 9223372036854775807 --- +float(-9.2233720390023E+18) +--- testing: 4294967294 - 0 --- +int(4294967294) +--- testing: 4294967294 - 1 --- +int(4294967293) +--- testing: 4294967294 - -1 --- +int(4294967295) +--- testing: 4294967294 - 7 --- +int(4294967287) +--- testing: 4294967294 - 9 --- +int(4294967285) +--- testing: 4294967294 - 65 --- +int(4294967229) +--- testing: 4294967294 - -44 --- +int(4294967338) +--- testing: 4294967294 - 2147483647 --- +int(2147483647) +--- testing: 4294967294 - 9223372036854775807 --- +int(-9223372032559808513) +--- testing: 4294967295 - 0 --- +int(4294967295) +--- testing: 4294967295 - 1 --- +int(4294967294) +--- testing: 4294967295 - -1 --- +int(4294967296) +--- testing: 4294967295 - 7 --- +int(4294967288) +--- testing: 4294967295 - 9 --- +int(4294967286) +--- testing: 4294967295 - 65 --- +int(4294967230) +--- testing: 4294967295 - -44 --- +int(4294967339) +--- testing: 4294967295 - 2147483647 --- +int(2147483648) +--- testing: 4294967295 - 9223372036854775807 --- +int(-9223372032559808512) +--- testing: 4294967293 - 0 --- +int(4294967293) +--- testing: 4294967293 - 1 --- +int(4294967292) +--- testing: 4294967293 - -1 --- +int(4294967294) +--- testing: 4294967293 - 7 --- +int(4294967286) +--- testing: 4294967293 - 9 --- +int(4294967284) +--- testing: 4294967293 - 65 --- +int(4294967228) +--- testing: 4294967293 - -44 --- +int(4294967337) +--- testing: 4294967293 - 2147483647 --- +int(2147483646) +--- testing: 4294967293 - 9223372036854775807 --- +int(-9223372032559808514) +--- testing: 9223372036854775806 - 0 --- +int(9223372036854775806) +--- testing: 9223372036854775806 - 1 --- +int(9223372036854775805) +--- testing: 9223372036854775806 - -1 --- +int(9223372036854775807) +--- testing: 9223372036854775806 - 7 --- +int(9223372036854775799) +--- testing: 9223372036854775806 - 9 --- +int(9223372036854775797) +--- testing: 9223372036854775806 - 65 --- +int(9223372036854775741) +--- testing: 9223372036854775806 - -44 --- +float(9.2233720368548E+18) +--- testing: 9223372036854775806 - 2147483647 --- +int(9223372034707292159) +--- testing: 9223372036854775806 - 9223372036854775807 --- +int(-1) +--- testing: 9.2233720368548E+18 - 0 --- +float(9.2233720368548E+18) +--- testing: 9.2233720368548E+18 - 1 --- +float(9.2233720368548E+18) +--- testing: 9.2233720368548E+18 - -1 --- +float(9.2233720368548E+18) +--- testing: 9.2233720368548E+18 - 7 --- +float(9.2233720368548E+18) +--- testing: 9.2233720368548E+18 - 9 --- +float(9.2233720368548E+18) +--- testing: 9.2233720368548E+18 - 65 --- +float(9.2233720368548E+18) +--- testing: 9.2233720368548E+18 - -44 --- +float(9.2233720368548E+18) +--- testing: 9.2233720368548E+18 - 2147483647 --- +float(9.2233720347073E+18) +--- testing: 9.2233720368548E+18 - 9223372036854775807 --- +float(0) +--- testing: -9223372036854775807 - 0 --- +int(-9223372036854775807) +--- testing: -9223372036854775807 - 1 --- +int(-9223372036854775808) +--- testing: -9223372036854775807 - -1 --- +int(-9223372036854775806) +--- testing: -9223372036854775807 - 7 --- +float(-9.2233720368548E+18) +--- testing: -9223372036854775807 - 9 --- +float(-9.2233720368548E+18) +--- testing: -9223372036854775807 - 65 --- +float(-9.2233720368548E+18) +--- testing: -9223372036854775807 - -44 --- +int(-9223372036854775763) +--- testing: -9223372036854775807 - 2147483647 --- +float(-9.2233720390023E+18) +--- testing: -9223372036854775807 - 9223372036854775807 --- +float(-1.844674407371E+19) +--- testing: -9.2233720368548E+18 - 0 --- +float(-9.2233720368548E+18) +--- testing: -9.2233720368548E+18 - 1 --- +float(-9.2233720368548E+18) +--- testing: -9.2233720368548E+18 - -1 --- +float(-9.2233720368548E+18) +--- testing: -9.2233720368548E+18 - 7 --- +float(-9.2233720368548E+18) +--- testing: -9.2233720368548E+18 - 9 --- +float(-9.2233720368548E+18) +--- testing: -9.2233720368548E+18 - 65 --- +float(-9.2233720368548E+18) +--- testing: -9.2233720368548E+18 - -44 --- +float(-9.2233720368548E+18) +--- testing: -9.2233720368548E+18 - 2147483647 --- +float(-9.2233720390023E+18) +--- testing: -9.2233720368548E+18 - 9223372036854775807 --- +float(-1.844674407371E+19) +--- testing: 0 - 9223372036854775807 --- +int(-9223372036854775807) +--- testing: 0 - -9223372036854775808 --- +float(9.2233720368548E+18) +--- testing: 0 - 2147483647 --- +int(-2147483647) +--- testing: 0 - -2147483648 --- +int(2147483648) +--- testing: 0 - 9223372034707292160 --- +int(-9223372034707292160) +--- testing: 0 - -9223372034707292160 --- +int(9223372034707292160) +--- testing: 0 - 2147483648 --- +int(-2147483648) +--- testing: 0 - -2147483649 --- +int(2147483649) +--- testing: 0 - 4294967294 --- +int(-4294967294) +--- testing: 0 - 4294967295 --- +int(-4294967295) +--- testing: 0 - 4294967293 --- +int(-4294967293) +--- testing: 0 - 9223372036854775806 --- +int(-9223372036854775806) +--- testing: 0 - 9.2233720368548E+18 --- +float(-9.2233720368548E+18) +--- testing: 0 - -9223372036854775807 --- +int(9223372036854775807) +--- testing: 0 - -9.2233720368548E+18 --- +float(9.2233720368548E+18) +--- testing: 1 - 9223372036854775807 --- +int(-9223372036854775806) +--- testing: 1 - -9223372036854775808 --- +float(9.2233720368548E+18) +--- testing: 1 - 2147483647 --- +int(-2147483646) +--- testing: 1 - -2147483648 --- +int(2147483649) +--- testing: 1 - 9223372034707292160 --- +int(-9223372034707292159) +--- testing: 1 - -9223372034707292160 --- +int(9223372034707292161) +--- testing: 1 - 2147483648 --- +int(-2147483647) +--- testing: 1 - -2147483649 --- +int(2147483650) +--- testing: 1 - 4294967294 --- +int(-4294967293) +--- testing: 1 - 4294967295 --- +int(-4294967294) +--- testing: 1 - 4294967293 --- +int(-4294967292) +--- testing: 1 - 9223372036854775806 --- +int(-9223372036854775805) +--- testing: 1 - 9.2233720368548E+18 --- +float(-9.2233720368548E+18) +--- testing: 1 - -9223372036854775807 --- +float(9.2233720368548E+18) +--- testing: 1 - -9.2233720368548E+18 --- +float(9.2233720368548E+18) +--- testing: -1 - 9223372036854775807 --- +int(-9223372036854775808) +--- testing: -1 - -9223372036854775808 --- +int(9223372036854775807) +--- testing: -1 - 2147483647 --- +int(-2147483648) +--- testing: -1 - -2147483648 --- +int(2147483647) +--- testing: -1 - 9223372034707292160 --- +int(-9223372034707292161) +--- testing: -1 - -9223372034707292160 --- +int(9223372034707292159) +--- testing: -1 - 2147483648 --- +int(-2147483649) +--- testing: -1 - -2147483649 --- +int(2147483648) +--- testing: -1 - 4294967294 --- +int(-4294967295) +--- testing: -1 - 4294967295 --- +int(-4294967296) +--- testing: -1 - 4294967293 --- +int(-4294967294) +--- testing: -1 - 9223372036854775806 --- +int(-9223372036854775807) +--- testing: -1 - 9.2233720368548E+18 --- +float(-9.2233720368548E+18) +--- testing: -1 - -9223372036854775807 --- +int(9223372036854775806) +--- testing: -1 - -9.2233720368548E+18 --- +float(9.2233720368548E+18) +--- testing: 7 - 9223372036854775807 --- +int(-9223372036854775800) +--- testing: 7 - -9223372036854775808 --- +float(9.2233720368548E+18) +--- testing: 7 - 2147483647 --- +int(-2147483640) +--- testing: 7 - -2147483648 --- +int(2147483655) +--- testing: 7 - 9223372034707292160 --- +int(-9223372034707292153) +--- testing: 7 - -9223372034707292160 --- +int(9223372034707292167) +--- testing: 7 - 2147483648 --- +int(-2147483641) +--- testing: 7 - -2147483649 --- +int(2147483656) +--- testing: 7 - 4294967294 --- +int(-4294967287) +--- testing: 7 - 4294967295 --- +int(-4294967288) +--- testing: 7 - 4294967293 --- +int(-4294967286) +--- testing: 7 - 9223372036854775806 --- +int(-9223372036854775799) +--- testing: 7 - 9.2233720368548E+18 --- +float(-9.2233720368548E+18) +--- testing: 7 - -9223372036854775807 --- +float(9.2233720368548E+18) +--- testing: 7 - -9.2233720368548E+18 --- +float(9.2233720368548E+18) +--- testing: 9 - 9223372036854775807 --- +int(-9223372036854775798) +--- testing: 9 - -9223372036854775808 --- +float(9.2233720368548E+18) +--- testing: 9 - 2147483647 --- +int(-2147483638) +--- testing: 9 - -2147483648 --- +int(2147483657) +--- testing: 9 - 9223372034707292160 --- +int(-9223372034707292151) +--- testing: 9 - -9223372034707292160 --- +int(9223372034707292169) +--- testing: 9 - 2147483648 --- +int(-2147483639) +--- testing: 9 - -2147483649 --- +int(2147483658) +--- testing: 9 - 4294967294 --- +int(-4294967285) +--- testing: 9 - 4294967295 --- +int(-4294967286) +--- testing: 9 - 4294967293 --- +int(-4294967284) +--- testing: 9 - 9223372036854775806 --- +int(-9223372036854775797) +--- testing: 9 - 9.2233720368548E+18 --- +float(-9.2233720368548E+18) +--- testing: 9 - -9223372036854775807 --- +float(9.2233720368548E+18) +--- testing: 9 - -9.2233720368548E+18 --- +float(9.2233720368548E+18) +--- testing: 65 - 9223372036854775807 --- +int(-9223372036854775742) +--- testing: 65 - -9223372036854775808 --- +float(9.2233720368548E+18) +--- testing: 65 - 2147483647 --- +int(-2147483582) +--- testing: 65 - -2147483648 --- +int(2147483713) +--- testing: 65 - 9223372034707292160 --- +int(-9223372034707292095) +--- testing: 65 - -9223372034707292160 --- +int(9223372034707292225) +--- testing: 65 - 2147483648 --- +int(-2147483583) +--- testing: 65 - -2147483649 --- +int(2147483714) +--- testing: 65 - 4294967294 --- +int(-4294967229) +--- testing: 65 - 4294967295 --- +int(-4294967230) +--- testing: 65 - 4294967293 --- +int(-4294967228) +--- testing: 65 - 9223372036854775806 --- +int(-9223372036854775741) +--- testing: 65 - 9.2233720368548E+18 --- +float(-9.2233720368548E+18) +--- testing: 65 - -9223372036854775807 --- +float(9.2233720368548E+18) +--- testing: 65 - -9.2233720368548E+18 --- +float(9.2233720368548E+18) +--- testing: -44 - 9223372036854775807 --- +float(-9.2233720368548E+18) +--- testing: -44 - -9223372036854775808 --- +int(9223372036854775764) +--- testing: -44 - 2147483647 --- +int(-2147483691) +--- testing: -44 - -2147483648 --- +int(2147483604) +--- testing: -44 - 9223372034707292160 --- +int(-9223372034707292204) +--- testing: -44 - -9223372034707292160 --- +int(9223372034707292116) +--- testing: -44 - 2147483648 --- +int(-2147483692) +--- testing: -44 - -2147483649 --- +int(2147483605) +--- testing: -44 - 4294967294 --- +int(-4294967338) +--- testing: -44 - 4294967295 --- +int(-4294967339) +--- testing: -44 - 4294967293 --- +int(-4294967337) +--- testing: -44 - 9223372036854775806 --- +float(-9.2233720368548E+18) +--- testing: -44 - 9.2233720368548E+18 --- +float(-9.2233720368548E+18) +--- testing: -44 - -9223372036854775807 --- +int(9223372036854775763) +--- testing: -44 - -9.2233720368548E+18 --- +float(9.2233720368548E+18) +--- testing: 2147483647 - 9223372036854775807 --- +int(-9223372034707292160) +--- testing: 2147483647 - -9223372036854775808 --- +float(9.2233720390023E+18) +--- testing: 2147483647 - 2147483647 --- +int(0) +--- testing: 2147483647 - -2147483648 --- +int(4294967295) +--- testing: 2147483647 - 9223372034707292160 --- +int(-9223372032559808513) +--- testing: 2147483647 - -9223372034707292160 --- +int(9223372036854775807) +--- testing: 2147483647 - 2147483648 --- +int(-1) +--- testing: 2147483647 - -2147483649 --- +int(4294967296) +--- testing: 2147483647 - 4294967294 --- +int(-2147483647) +--- testing: 2147483647 - 4294967295 --- +int(-2147483648) +--- testing: 2147483647 - 4294967293 --- +int(-2147483646) +--- testing: 2147483647 - 9223372036854775806 --- +int(-9223372034707292159) +--- testing: 2147483647 - 9.2233720368548E+18 --- +float(-9.2233720347073E+18) +--- testing: 2147483647 - -9223372036854775807 --- +float(9.2233720390023E+18) +--- testing: 2147483647 - -9.2233720368548E+18 --- +float(9.2233720390023E+18) +--- testing: 9223372036854775807 - 9223372036854775807 --- +int(0) +--- testing: 9223372036854775807 - -9223372036854775808 --- +float(1.844674407371E+19) +--- testing: 9223372036854775807 - 2147483647 --- +int(9223372034707292160) +--- testing: 9223372036854775807 - -2147483648 --- +float(9.2233720390023E+18) +--- testing: 9223372036854775807 - 9223372034707292160 --- +int(2147483647) +--- testing: 9223372036854775807 - -9223372034707292160 --- +float(1.8446744071562E+19) +--- testing: 9223372036854775807 - 2147483648 --- +int(9223372034707292159) +--- testing: 9223372036854775807 - -2147483649 --- +float(9.2233720390023E+18) +--- testing: 9223372036854775807 - 4294967294 --- +int(9223372032559808513) +--- testing: 9223372036854775807 - 4294967295 --- +int(9223372032559808512) +--- testing: 9223372036854775807 - 4294967293 --- +int(9223372032559808514) +--- testing: 9223372036854775807 - 9223372036854775806 --- +int(1) +--- testing: 9223372036854775807 - 9.2233720368548E+18 --- +float(0) +--- testing: 9223372036854775807 - -9223372036854775807 --- +float(1.844674407371E+19) +--- testing: 9223372036854775807 - -9.2233720368548E+18 --- +float(1.844674407371E+19)
+===DONE===
diff --git a/tests/lang/operators/subtract_variationStr.phpt b/tests/lang/operators/subtract_variationStr.phpt new file mode 100644 index 0000000..5b5bae2 --- /dev/null +++ b/tests/lang/operators/subtract_variationStr.phpt @@ -0,0 +1,416 @@ +--TEST--
+Test - operator : various numbers as strings
+--FILE--
+<?php
+
+$strVals = array(
+ "0","65","-44", "1.2", "-7.7", "abc", "123abc", "123e5", "123e5xyz", " 123abc", "123 abc", "123abc ", "3.4a",
+ "a5.9"
+);
+
+error_reporting(E_ERROR);
+
+foreach ($strVals as $strVal) {
+ foreach($strVals as $otherVal) {
+ echo "--- testing: '$strVal' - '$otherVal' ---\n";
+ var_dump($strVal-$otherVal);
+ }
+}
+
+
+?>
+===DONE===
+--EXPECT--
+--- testing: '0' - '0' --- +int(0) +--- testing: '0' - '65' --- +int(-65) +--- testing: '0' - '-44' --- +int(44) +--- testing: '0' - '1.2' --- +float(-1.2) +--- testing: '0' - '-7.7' --- +float(7.7) +--- testing: '0' - 'abc' --- +int(0) +--- testing: '0' - '123abc' --- +int(-123) +--- testing: '0' - '123e5' --- +float(-12300000) +--- testing: '0' - '123e5xyz' --- +float(-12300000) +--- testing: '0' - ' 123abc' --- +int(-123) +--- testing: '0' - '123 abc' --- +int(-123) +--- testing: '0' - '123abc ' --- +int(-123) +--- testing: '0' - '3.4a' --- +float(-3.4) +--- testing: '0' - 'a5.9' --- +int(0) +--- testing: '65' - '0' --- +int(65) +--- testing: '65' - '65' --- +int(0) +--- testing: '65' - '-44' --- +int(109) +--- testing: '65' - '1.2' --- +float(63.8) +--- testing: '65' - '-7.7' --- +float(72.7) +--- testing: '65' - 'abc' --- +int(65) +--- testing: '65' - '123abc' --- +int(-58) +--- testing: '65' - '123e5' --- +float(-12299935) +--- testing: '65' - '123e5xyz' --- +float(-12299935) +--- testing: '65' - ' 123abc' --- +int(-58) +--- testing: '65' - '123 abc' --- +int(-58) +--- testing: '65' - '123abc ' --- +int(-58) +--- testing: '65' - '3.4a' --- +float(61.6) +--- testing: '65' - 'a5.9' --- +int(65) +--- testing: '-44' - '0' --- +int(-44) +--- testing: '-44' - '65' --- +int(-109) +--- testing: '-44' - '-44' --- +int(0) +--- testing: '-44' - '1.2' --- +float(-45.2) +--- testing: '-44' - '-7.7' --- +float(-36.3) +--- testing: '-44' - 'abc' --- +int(-44) +--- testing: '-44' - '123abc' --- +int(-167) +--- testing: '-44' - '123e5' --- +float(-12300044) +--- testing: '-44' - '123e5xyz' --- +float(-12300044) +--- testing: '-44' - ' 123abc' --- +int(-167) +--- testing: '-44' - '123 abc' --- +int(-167) +--- testing: '-44' - '123abc ' --- +int(-167) +--- testing: '-44' - '3.4a' --- +float(-47.4) +--- testing: '-44' - 'a5.9' --- +int(-44) +--- testing: '1.2' - '0' --- +float(1.2) +--- testing: '1.2' - '65' --- +float(-63.8) +--- testing: '1.2' - '-44' --- +float(45.2) +--- testing: '1.2' - '1.2' --- +float(0) +--- testing: '1.2' - '-7.7' --- +float(8.9) +--- testing: '1.2' - 'abc' --- +float(1.2) +--- testing: '1.2' - '123abc' --- +float(-121.8) +--- testing: '1.2' - '123e5' --- +float(-12299998.8) +--- testing: '1.2' - '123e5xyz' --- +float(-12299998.8) +--- testing: '1.2' - ' 123abc' --- +float(-121.8) +--- testing: '1.2' - '123 abc' --- +float(-121.8) +--- testing: '1.2' - '123abc ' --- +float(-121.8) +--- testing: '1.2' - '3.4a' --- +float(-2.2) +--- testing: '1.2' - 'a5.9' --- +float(1.2) +--- testing: '-7.7' - '0' --- +float(-7.7) +--- testing: '-7.7' - '65' --- +float(-72.7) +--- testing: '-7.7' - '-44' --- +float(36.3) +--- testing: '-7.7' - '1.2' --- +float(-8.9) +--- testing: '-7.7' - '-7.7' --- +float(0) +--- testing: '-7.7' - 'abc' --- +float(-7.7) +--- testing: '-7.7' - '123abc' --- +float(-130.7) +--- testing: '-7.7' - '123e5' --- +float(-12300007.7) +--- testing: '-7.7' - '123e5xyz' --- +float(-12300007.7) +--- testing: '-7.7' - ' 123abc' --- +float(-130.7) +--- testing: '-7.7' - '123 abc' --- +float(-130.7) +--- testing: '-7.7' - '123abc ' --- +float(-130.7) +--- testing: '-7.7' - '3.4a' --- +float(-11.1) +--- testing: '-7.7' - 'a5.9' --- +float(-7.7) +--- testing: 'abc' - '0' --- +int(0) +--- testing: 'abc' - '65' --- +int(-65) +--- testing: 'abc' - '-44' --- +int(44) +--- testing: 'abc' - '1.2' --- +float(-1.2) +--- testing: 'abc' - '-7.7' --- +float(7.7) +--- testing: 'abc' - 'abc' --- +int(0) +--- testing: 'abc' - '123abc' --- +int(-123) +--- testing: 'abc' - '123e5' --- +float(-12300000) +--- testing: 'abc' - '123e5xyz' --- +float(-12300000) +--- testing: 'abc' - ' 123abc' --- +int(-123) +--- testing: 'abc' - '123 abc' --- +int(-123) +--- testing: 'abc' - '123abc ' --- +int(-123) +--- testing: 'abc' - '3.4a' --- +float(-3.4) +--- testing: 'abc' - 'a5.9' --- +int(0) +--- testing: '123abc' - '0' --- +int(123) +--- testing: '123abc' - '65' --- +int(58) +--- testing: '123abc' - '-44' --- +int(167) +--- testing: '123abc' - '1.2' --- +float(121.8) +--- testing: '123abc' - '-7.7' --- +float(130.7) +--- testing: '123abc' - 'abc' --- +int(123) +--- testing: '123abc' - '123abc' --- +int(0) +--- testing: '123abc' - '123e5' --- +float(-12299877) +--- testing: '123abc' - '123e5xyz' --- +float(-12299877) +--- testing: '123abc' - ' 123abc' --- +int(0) +--- testing: '123abc' - '123 abc' --- +int(0) +--- testing: '123abc' - '123abc ' --- +int(0) +--- testing: '123abc' - '3.4a' --- +float(119.6) +--- testing: '123abc' - 'a5.9' --- +int(123) +--- testing: '123e5' - '0' --- +float(12300000) +--- testing: '123e5' - '65' --- +float(12299935) +--- testing: '123e5' - '-44' --- +float(12300044) +--- testing: '123e5' - '1.2' --- +float(12299998.8) +--- testing: '123e5' - '-7.7' --- +float(12300007.7) +--- testing: '123e5' - 'abc' --- +float(12300000) +--- testing: '123e5' - '123abc' --- +float(12299877) +--- testing: '123e5' - '123e5' --- +float(0) +--- testing: '123e5' - '123e5xyz' --- +float(0) +--- testing: '123e5' - ' 123abc' --- +float(12299877) +--- testing: '123e5' - '123 abc' --- +float(12299877) +--- testing: '123e5' - '123abc ' --- +float(12299877) +--- testing: '123e5' - '3.4a' --- +float(12299996.6) +--- testing: '123e5' - 'a5.9' --- +float(12300000) +--- testing: '123e5xyz' - '0' --- +float(12300000) +--- testing: '123e5xyz' - '65' --- +float(12299935) +--- testing: '123e5xyz' - '-44' --- +float(12300044) +--- testing: '123e5xyz' - '1.2' --- +float(12299998.8) +--- testing: '123e5xyz' - '-7.7' --- +float(12300007.7) +--- testing: '123e5xyz' - 'abc' --- +float(12300000) +--- testing: '123e5xyz' - '123abc' --- +float(12299877) +--- testing: '123e5xyz' - '123e5' --- +float(0) +--- testing: '123e5xyz' - '123e5xyz' --- +float(0) +--- testing: '123e5xyz' - ' 123abc' --- +float(12299877) +--- testing: '123e5xyz' - '123 abc' --- +float(12299877) +--- testing: '123e5xyz' - '123abc ' --- +float(12299877) +--- testing: '123e5xyz' - '3.4a' --- +float(12299996.6) +--- testing: '123e5xyz' - 'a5.9' --- +float(12300000) +--- testing: ' 123abc' - '0' --- +int(123) +--- testing: ' 123abc' - '65' --- +int(58) +--- testing: ' 123abc' - '-44' --- +int(167) +--- testing: ' 123abc' - '1.2' --- +float(121.8) +--- testing: ' 123abc' - '-7.7' --- +float(130.7) +--- testing: ' 123abc' - 'abc' --- +int(123) +--- testing: ' 123abc' - '123abc' --- +int(0) +--- testing: ' 123abc' - '123e5' --- +float(-12299877) +--- testing: ' 123abc' - '123e5xyz' --- +float(-12299877) +--- testing: ' 123abc' - ' 123abc' --- +int(0) +--- testing: ' 123abc' - '123 abc' --- +int(0) +--- testing: ' 123abc' - '123abc ' --- +int(0) +--- testing: ' 123abc' - '3.4a' --- +float(119.6) +--- testing: ' 123abc' - 'a5.9' --- +int(123) +--- testing: '123 abc' - '0' --- +int(123) +--- testing: '123 abc' - '65' --- +int(58) +--- testing: '123 abc' - '-44' --- +int(167) +--- testing: '123 abc' - '1.2' --- +float(121.8) +--- testing: '123 abc' - '-7.7' --- +float(130.7) +--- testing: '123 abc' - 'abc' --- +int(123) +--- testing: '123 abc' - '123abc' --- +int(0) +--- testing: '123 abc' - '123e5' --- +float(-12299877) +--- testing: '123 abc' - '123e5xyz' --- +float(-12299877) +--- testing: '123 abc' - ' 123abc' --- +int(0) +--- testing: '123 abc' - '123 abc' --- +int(0) +--- testing: '123 abc' - '123abc ' --- +int(0) +--- testing: '123 abc' - '3.4a' --- +float(119.6) +--- testing: '123 abc' - 'a5.9' --- +int(123) +--- testing: '123abc ' - '0' --- +int(123) +--- testing: '123abc ' - '65' --- +int(58) +--- testing: '123abc ' - '-44' --- +int(167) +--- testing: '123abc ' - '1.2' --- +float(121.8) +--- testing: '123abc ' - '-7.7' --- +float(130.7) +--- testing: '123abc ' - 'abc' --- +int(123) +--- testing: '123abc ' - '123abc' --- +int(0) +--- testing: '123abc ' - '123e5' --- +float(-12299877) +--- testing: '123abc ' - '123e5xyz' --- +float(-12299877) +--- testing: '123abc ' - ' 123abc' --- +int(0) +--- testing: '123abc ' - '123 abc' --- +int(0) +--- testing: '123abc ' - '123abc ' --- +int(0) +--- testing: '123abc ' - '3.4a' --- +float(119.6) +--- testing: '123abc ' - 'a5.9' --- +int(123) +--- testing: '3.4a' - '0' --- +float(3.4) +--- testing: '3.4a' - '65' --- +float(-61.6) +--- testing: '3.4a' - '-44' --- +float(47.4) +--- testing: '3.4a' - '1.2' --- +float(2.2) +--- testing: '3.4a' - '-7.7' --- +float(11.1) +--- testing: '3.4a' - 'abc' --- +float(3.4) +--- testing: '3.4a' - '123abc' --- +float(-119.6) +--- testing: '3.4a' - '123e5' --- +float(-12299996.6) +--- testing: '3.4a' - '123e5xyz' --- +float(-12299996.6) +--- testing: '3.4a' - ' 123abc' --- +float(-119.6) +--- testing: '3.4a' - '123 abc' --- +float(-119.6) +--- testing: '3.4a' - '123abc ' --- +float(-119.6) +--- testing: '3.4a' - '3.4a' --- +float(0) +--- testing: '3.4a' - 'a5.9' --- +float(3.4) +--- testing: 'a5.9' - '0' --- +int(0) +--- testing: 'a5.9' - '65' --- +int(-65) +--- testing: 'a5.9' - '-44' --- +int(44) +--- testing: 'a5.9' - '1.2' --- +float(-1.2) +--- testing: 'a5.9' - '-7.7' --- +float(7.7) +--- testing: 'a5.9' - 'abc' --- +int(0) +--- testing: 'a5.9' - '123abc' --- +int(-123) +--- testing: 'a5.9' - '123e5' --- +float(-12300000) +--- testing: 'a5.9' - '123e5xyz' --- +float(-12300000) +--- testing: 'a5.9' - ' 123abc' --- +int(-123) +--- testing: 'a5.9' - '123 abc' --- +int(-123) +--- testing: 'a5.9' - '123abc ' --- +int(-123) +--- testing: 'a5.9' - '3.4a' --- +float(-3.4) +--- testing: 'a5.9' - 'a5.9' --- +int(0)
+===DONE===
diff --git a/tests/lang/passByReference_001.phpt b/tests/lang/passByReference_001.phpt new file mode 100644 index 0000000..c73eacc --- /dev/null +++ b/tests/lang/passByReference_001.phpt @@ -0,0 +1,37 @@ +--TEST-- +passing of function parameters by reference +--FILE-- +<?php +function f($arg1, &$arg2) +{ + var_dump($arg1++); + var_dump($arg2++); +} + +function g (&$arg1, &$arg2) +{ + var_dump($arg1); + var_dump($arg2); +} +$a = 7; +$b = 15; + +f($a, $b); + +var_dump($a); +var_dump($b); + +$c=array(1); +g($c,$c[0]); + +?> +--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 0000000..d1968a3 --- /dev/null +++ b/tests/lang/passByReference_002.phpt @@ -0,0 +1,15 @@ +--TEST-- +Attempt to pass a constant by reference +--FILE-- +<?php + +function f(&$arg1) +{ + var_dump($arg1++); +} + +f(2); + +?> +--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 0000000..bbbc564 --- /dev/null +++ b/tests/lang/passByReference_003.phpt @@ -0,0 +1,48 @@ +--TEST-- +Implicit initialisation when passing by reference +--FILE-- +<?php +function passbyVal($val) { + echo "\nInside passbyVal call:\n"; + var_dump($val); +} + +function passbyRef(&$ref) { + echo "\nInside passbyRef call:\n"; + var_dump($ref); +} + +echo "\nPassing undefined by value\n"; +passbyVal($undef1[0]); +echo "\nAfter call\n"; +var_dump($undef1); + +echo "\nPassing undefined by reference\n"; +passbyRef($undef2[0]); +echo "\nAfter call\n"; +var_dump($undef2) +?> +--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 0000000..e8a7963 --- /dev/null +++ b/tests/lang/passByReference_004.phpt @@ -0,0 +1,21 @@ +--TEST-- +passing the return value from a function by reference +--FILE-- +<?php + +function foo(&$ref) +{ + var_dump($ref); +} + +function bar($value) +{ + return $value; +} + +foo(bar(5)); + +?> +--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 0000000..52ddeeb --- /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-- +<?php + +function v($val) { + $val = "Val changed"; +} + +function r(&$ref) { + $ref = "Ref changed"; +} + + +function vv($val1, $val2) { + $val1 = "Val1 changed"; + $val2 = "Val2 changed"; +} + +function vr($val, &$ref) { + $val = "Val changed"; + $ref = "Ref changed"; +} + +function rv(&$ref, $val) { + $val = "Val changed"; + $ref = "Ref changed"; +} + +function rr(&$ref1, &$ref2) { + $ref1 = "Ref1 changed"; + $ref2 = "Ref2 changed"; +} + + +class C { + + function __construct($val, &$ref) { + $val = "Val changed"; + $ref = "Ref changed"; + } + + function v($val) { + $val = "Val changed"; + } + + function r(&$ref) { + $ref = "Ref changed"; + } + + function vv($val1, $val2) { + $val1 = "Val1 changed"; + $val2 = "Val2 changed"; + } + + function vr($val, &$ref) { + $val = "Val changed"; + $ref = "Ref changed"; + } + + function rv(&$ref, $val) { + $val = "Val changed"; + $ref = "Ref changed"; + } + + function rr(&$ref1, &$ref2) { + $ref1 = "Ref1 changed"; + $ref2 = "Ref2 changed"; + } + +} + +echo "\n ---- Pass by ref / pass by val: functions ----\n"; +unset($u1, $u2); +v($u1); +r($u2); +var_dump($u1, $u2); + +unset($u1, $u2); +vv($u1, $u2); +var_dump($u1, $u2); + +unset($u1, $u2); +vr($u1, $u2); +var_dump($u1, $u2); + +unset($u1, $u2); +rv($u1, $u2); +var_dump($u1, $u2); + +unset($u1, $u2); +rr($u1, $u2); +var_dump($u1, $u2); + + +echo "\n\n ---- Pass by ref / pass by val: static method calls ----\n"; +unset($u1, $u2); +C::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); + +echo "\n\n ---- Pass by ref / pass by val: instance method calls ----\n"; +unset($u1, $u2); +$c = new C($u1, $u2); +var_dump($u1, $u2); + +unset($u1, $u2); +$c->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 0000000..248be88 --- /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-- +<?php + +function refs(&$ref1, &$ref2, &$ref3, &$ref4, &$ref5) { + $ref1 = "Ref1 changed"; + $ref2 = "Ref2 changed"; + $ref3 = "Ref3 changed"; + $ref4 = "Ref4 changed"; + $ref5 = "Ref5 changed"; +} + + +class C { + + function __construct(&$ref1, &$ref2, &$ref3, &$ref4, &$ref5) { + $ref1 = "Ref1 changed"; + $ref2 = "Ref2 changed"; + $ref3 = "Ref3 changed"; + $ref4 = "Ref4 changed"; + $ref5 = "Ref5 changed"; + } + + function refs(&$ref1, &$ref2, &$ref3, &$ref4, &$ref5) { + $ref1 = "Ref1 changed"; + $ref2 = "Ref2 changed"; + $ref3 = "Ref3 changed"; + $ref4 = "Ref4 changed"; + $ref5 = "Ref5 changed"; + } + +} + +echo "\n ---- Pass uninitialised array & object by ref: function call ---\n"; +unset($u1, $u2, $u3, $u4, $u5); +refs($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: 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 0000000..558ceae --- /dev/null +++ b/tests/lang/passByReference_007.phpt @@ -0,0 +1,105 @@ +--TEST-- +Pass function and method calls by reference and by value. +--FILE-- +<?php +class C { + static function sreturnVal() { + global $a; + return $a; + } + + static function &sreturnReference() { + global $a; + return $a; + } + + function returnVal() { + global $a; + return $a; + } + + function &returnReference() { + global $a; + return $a; + } +} + +function returnVal() { + global $a; + return $a; +} + +function &returnReference() { + global $a; + return $a; +} + + + +function foo(&$ref) { + var_dump($ref); + $ref = "changed"; +} + + +echo "Pass a function call that returns a value:\n"; +$a = "original"; +foo(returnVal()); +var_dump($a); + +echo "Pass a function call that returns a reference:\n"; +$a = "original"; +foo(returnReference()); +var_dump($a); + + +echo "\nPass a static method call that returns a value:\n"; +$a = "original"; +foo(C::sreturnVal()); +var_dump($a); + +echo "Pass a static method call that returns a reference:\n"; +$a = "original"; +foo(C::sreturnReference()); +var_dump($a); + + +$myC = new C; +echo "\nPass a method call that returns a value:\n"; +$a = "original"; +foo($myC->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 0000000..3685217 --- /dev/null +++ b/tests/lang/passByReference_008.phpt @@ -0,0 +1,40 @@ +--TEST-- +Pass same variable by ref and by value. +--FILE-- +<?php +function valRef($x, &$y) { + var_dump($x, $y); + $x = 'changed.x'; + $y = 'changed.y'; +} + +function refVal(&$x, $y) { + var_dump($x, $y); + $x = 'changed.x'; + $y = 'changed.y'; +} + + +echo "\n\n-- Val, Ref --\n"; +$a = 'original.a'; +valRef($a, $a); +var_dump($a); + +echo "\n\n-- Ref, Val --\n"; +$b = 'original.b'; +refVal($b, $b); +var_dump($b); +?> +--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 0000000..1cbd87d --- /dev/null +++ b/tests/lang/passByReference_009.phpt @@ -0,0 +1,24 @@ +--TEST-- +Assignement as argument +--FILE-- +<?php + function foo(&$x, &$y) { $x = 1; echo $y ; } + + $x = 0; + foo($x, $x); // prints 1 .. + + + function foo2($x, &$y, $z) + { + echo $x; // 0 + echo $y; // 1 + $y = 2; + } + + $x = 0; + + foo2($x, $x, $x = 1); + echo $x; // 2 +?> +--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 0000000..0393cce --- /dev/null +++ b/tests/lang/passByReference_010.phpt @@ -0,0 +1,61 @@ +--TEST-- +Passing assignments by reference +--FILE-- +<?php + +function f(&$a) { + var_dump($a); + $a = "a.changed"; +} + +echo "\n\n---> 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/passByReference_012.phpt b/tests/lang/passByReference_012.phpt new file mode 100644 index 0000000..c6ce705 --- /dev/null +++ b/tests/lang/passByReference_012.phpt @@ -0,0 +1,25 @@ +--TEST-- +Test pass by reference semantics +--FILE-- +<?php +error_reporting(E_ALL | E_STRICT | E_NOTICE); + +// Simplified array_shift_variation5.phpt +// Showing warning: +// "Only variables should be passed by reference in %s on line %d" +$stack = array ( array ( 'two' )); +var_dump(array_shift(array_shift($stack))); + +// This should show the identical warning +$original = array ( array ( 'one' )); +$stack = $original; +var_dump(array_shift(array_shift($stack))); +?> +===DONE=== +--EXPECTF-- +Strict Standards: Only variables should be passed by reference in %s on line %d +string(3) "two" + +Strict Standards: Only variables should be passed by reference in %s on line %d +string(3) "one" +===DONE=== diff --git a/tests/lang/returnByReference.001.phpt b/tests/lang/returnByReference.001.phpt new file mode 100644 index 0000000..4abc3c7 --- /dev/null +++ b/tests/lang/returnByReference.001.phpt @@ -0,0 +1,20 @@ +--TEST--
+Returning a reference from a function
+--FILE--
+<?php
+
+function &returnByRef(&$arg1)
+{
+ return $arg1;
+}
+
+$a = 7;
+$b =& returnByRef($a);
+var_dump($b);
+$a++;
+var_dump($b);
+
+?>
+--EXPECT--
+int(7)
+int(8)
\ No newline at end of file diff --git a/tests/lang/returnByReference.002.phpt b/tests/lang/returnByReference.002.phpt new file mode 100644 index 0000000..3494eb5 --- /dev/null +++ b/tests/lang/returnByReference.002.phpt @@ -0,0 +1,29 @@ +--TEST--
+Returning a reference from a function.
+--FILE--
+<?php
+function &returnRef() {
+ global $a;
+ return $a;
+}
+
+function returnVal() {
+ global $a;
+ return $a;
+}
+
+$a = "original";
+$b =& returnVal();
+$b = "changed";
+var_dump($a); //expecting warning + "original"
+
+$a = "original";
+$b =& returnRef();
+$b = "changed";
+var_dump($a); //expecting "changed"
+?>
+--EXPECTF--
+
+Strict Standards: Only variables should be assigned by reference in %s on line 13
+string(8) "original"
+string(7) "changed"
diff --git a/tests/lang/returnByReference.003.phpt b/tests/lang/returnByReference.003.phpt new file mode 100644 index 0000000..04a6338 --- /dev/null +++ b/tests/lang/returnByReference.003.phpt @@ -0,0 +1,55 @@ +--TEST--
+Returning a reference from a function
+--FILE--
+<?php
+function returnConstantByValue() {
+ return 100;
+}
+
+function &returnConstantByRef() {
+ return 100;
+}
+
+function &returnVariableByRef() {
+ return $GLOBALS['a'];
+}
+
+echo "\n---> 1. Trying to assign by reference the return value of a function that returns by value:\n";
+unset($a, $b);
+$a = 4;
+$b = &returnConstantByValue();
+$a++;
+var_dump($a, $b);
+
+echo "\n---> 2. Trying to assign by reference the return value of a function that returns a constant by ref:\n";
+unset($a, $b);
+$a = 4;
+$b = &returnConstantByRef();
+$a++;
+var_dump($a, $b);
+
+echo "\n---> 3. Trying to assign by reference the return value of a function that returns by ref:\n";
+unset($a, $b);
+$a = 4;
+$b = &returnVariableByRef();
+$a++;
+var_dump($a, $b);
+
+?>
+--EXPECTF--
+
+---> 1. Trying to assign by reference the return value of a function that returns by value:
+
+Strict Standards: Only variables should be assigned by reference in %s on line 17
+int(5)
+int(100)
+
+---> 2. Trying to assign by reference the return value of a function that returns a constant by ref:
+
+Notice: Only variable references should be returned by reference in %s on line 7
+int(5)
+int(100)
+
+---> 3. Trying to assign by reference the return value of a function that returns by ref:
+int(5)
+int(5)
diff --git a/tests/lang/returnByReference.004.phpt b/tests/lang/returnByReference.004.phpt new file mode 100644 index 0000000..f185c12 --- /dev/null +++ b/tests/lang/returnByReference.004.phpt @@ -0,0 +1,57 @@ +--TEST--
+Returning a reference from a static method
+--FILE--
+<?php
+Class C {
+ static function returnConstantByValue() {
+ return 100;
+ }
+
+ static function &returnConstantByRef() {
+ return 100;
+ }
+
+ static function &returnVariableByRef() {
+ return $GLOBALS['a'];
+ }
+}
+
+echo "\n---> 1. Trying to assign by reference the return value of a function that returns by value:\n";
+unset($a, $b);
+$a = 4;
+$b = &C::returnConstantByValue();
+$a++;
+var_dump($a, $b);
+
+echo "\n---> 2. Trying to assign by reference the return value of a function that returns a constant by ref:\n";
+unset($a, $b);
+$a = 4;
+$b = &C::returnConstantByRef();
+$a++;
+var_dump($a, $b);
+
+echo "\n---> 3. Trying to assign by reference the return value of a function that returns by ref:\n";
+unset($a, $b);
+$a = 4;
+$b = &C::returnVariableByRef();
+$a++;
+var_dump($a, $b);
+
+?>
+--EXPECTF--
+
+---> 1. Trying to assign by reference the return value of a function that returns by value:
+
+Strict Standards: Only variables should be assigned by reference in %s on line 19
+int(5)
+int(100)
+
+---> 2. Trying to assign by reference the return value of a function that returns a constant by ref:
+
+Notice: Only variable references should be returned by reference in %s on line 8
+int(5)
+int(100)
+
+---> 3. Trying to assign by reference the return value of a function that returns by ref:
+int(5)
+int(5)
diff --git a/tests/lang/returnByReference.005.phpt b/tests/lang/returnByReference.005.phpt new file mode 100644 index 0000000..a7b6da2 --- /dev/null +++ b/tests/lang/returnByReference.005.phpt @@ -0,0 +1,58 @@ +--TEST--
+Returning a reference from a method
+--FILE--
+<?php
+Class C {
+ function returnConstantByValue() {
+ return 100;
+ }
+
+ function &returnConstantByRef() {
+ return 100;
+ }
+
+ static function &returnVariableByRef() {
+ return $GLOBALS['a'];
+ }
+}
+$c = new C;
+
+echo "\n---> 1. Trying to assign by reference the return value of a function that returns by value:\n";
+unset($a, $b);
+$a = 4;
+$b = &$c->returnConstantByValue();
+$a++;
+var_dump($a, $b);
+
+echo "\n---> 2. Trying to assign by reference the return value of a function that returns a constant by ref:\n";
+unset($a, $b);
+$a = 4;
+$b = &$c->returnConstantByRef();
+$a++;
+var_dump($a, $b);
+
+echo "\n---> 3. Trying to assign by reference the return value of a function that returns by ref:\n";
+unset($a, $b);
+$a = 4;
+$b = &$c->returnVariableByRef();
+$a++;
+var_dump($a, $b);
+
+?>
+--EXPECTF--
+
+---> 1. Trying to assign by reference the return value of a function that returns by value:
+
+Strict Standards: Only variables should be assigned by reference in %s on line 20
+int(5)
+int(100)
+
+---> 2. Trying to assign by reference the return value of a function that returns a constant by ref:
+
+Notice: Only variable references should be returned by reference in %s on line 8
+int(5)
+int(100)
+
+---> 3. Trying to assign by reference the return value of a function that returns by ref:
+int(5)
+int(5)
diff --git a/tests/lang/returnByReference.006.phpt b/tests/lang/returnByReference.006.phpt new file mode 100644 index 0000000..4019f3a --- /dev/null +++ b/tests/lang/returnByReference.006.phpt @@ -0,0 +1,60 @@ +--TEST--
+Returning a reference from a function via another function
+--INI--
+error_reporting = E_ALL & ~E_STRICT
+--FILE--
+<?php
+function returnConstantByValue() {
+ return 100;
+}
+
+function &returnConstantByRef() {
+ return 100;
+}
+
+function &returnVariableByRef() {
+ return $GLOBALS['a'];
+}
+
+function &returnFunctionCallByRef($functionToCall) {
+ return $functionToCall();
+}
+
+echo "\n---> 1. Via a return by ref function call, assign by reference the return value of a function that returns by value:\n";
+unset($a, $b);
+$a = 4;
+$b = &returnFunctionCallByRef('returnConstantByValue');
+$a++;
+var_dump($a, $b);
+
+echo "\n---> 2. Via a return by ref function call, assign by reference the return value of a function that returns a constant by ref:\n";
+unset($a, $b);
+$a = 4;
+$b = &returnFunctionCallByRef('returnConstantByRef');
+$a++;
+var_dump($a, $b);
+
+echo "\n---> 3. Via a return by ref function call, assign by reference the return value of a function that returns by ref:\n";
+unset($a, $b);
+$a = 4;
+$b = &returnFunctionCallByRef('returnVariableByRef');
+$a++;
+var_dump($a, $b);
+
+?>
+--EXPECTF--
+---> 1. Via a return by ref function call, assign by reference the return value of a function that returns by value:
+
+Notice: Only variable references should be returned by reference in %s on line 15
+int(5)
+int(100)
+
+---> 2. Via a return by ref function call, assign by reference the return value of a function that returns a constant by ref:
+
+Notice: Only variable references should be returned by reference in %s on line 7
+int(5)
+int(100)
+
+---> 3. Via a return by ref function call, assign by reference the return value of a function that returns by ref:
+int(5)
+int(5)
diff --git a/tests/lang/returnByReference.007.phpt b/tests/lang/returnByReference.007.phpt new file mode 100644 index 0000000..1247e55 --- /dev/null +++ b/tests/lang/returnByReference.007.phpt @@ -0,0 +1,63 @@ +--TEST--
+Returning a reference from a static method via another static method
+--INI--
+error_reporting = E_ALL & ~E_STRICT
+--FILE--
+<?php
+class C {
+ static function returnConstantByValue() {
+ return 100;
+ }
+
+ static function &returnConstantByRef() {
+ return 100;
+ }
+
+ static function &returnVariableByRef() {
+ return $GLOBALS['a'];
+ }
+
+ static function &returnFunctionCallByRef($functionToCall) {
+ return C::$functionToCall();
+ }
+}
+
+echo "\n---> 1. Via a return by ref function call, assign by reference the return value of a function that returns by value:\n";
+unset($a, $b);
+$a = 4;
+$b = &C::returnFunctionCallByRef('returnConstantByValue');
+$a++;
+var_dump($a, $b);
+
+echo "\n---> 2. Via a return by ref function call, assign by reference the return value of a function that returns a constant by ref:\n";
+unset($a, $b);
+$a = 4;
+$b = &C::returnFunctionCallByRef('returnConstantByRef');
+$a++;
+var_dump($a, $b);
+
+echo "\n---> 3. Via a return by ref function call, assign by reference the return value of a function that returns by ref:\n";
+unset($a, $b);
+$a = 4;
+$b = &C::returnFunctionCallByRef('returnVariableByRef');
+$a++;
+var_dump($a, $b);
+
+?>
+--EXPECTF--
+
+---> 1. Via a return by ref function call, assign by reference the return value of a function that returns by value:
+
+Notice: Only variable references should be returned by reference in %s on line 16
+int(5)
+int(100)
+
+---> 2. Via a return by ref function call, assign by reference the return value of a function that returns a constant by ref:
+
+Notice: Only variable references should be returned by reference in %s on line 8
+int(5)
+int(100)
+
+---> 3. Via a return by ref function call, assign by reference the return value of a function that returns by ref:
+int(5)
+int(5)
\ No newline at end of file diff --git a/tests/lang/returnByReference.008.phpt b/tests/lang/returnByReference.008.phpt new file mode 100644 index 0000000..d595de2 --- /dev/null +++ b/tests/lang/returnByReference.008.phpt @@ -0,0 +1,64 @@ +--TEST--
+Returning a reference from a non-static method via another non-static method
+--INI--
+error_reporting = E_ALL & ~E_STRICT
+--FILE--
+<?php
+class C {
+ function returnConstantByValue() {
+ return 100;
+ }
+
+ function &returnConstantByRef() {
+ return 100;
+ }
+
+ function &returnVariableByRef() {
+ return $GLOBALS['a'];
+ }
+
+ function &returnFunctionCallByRef($functionToCall) {
+ return $this->$functionToCall();
+ }
+}
+$c = new C;
+
+echo "\n---> 1. Via a return by ref function call, assign by reference the return value of a function that returns by value:\n";
+unset($a, $b);
+$a = 4;
+$b = &$c->returnFunctionCallByRef('returnConstantByValue');
+$a++;
+var_dump($a, $b);
+
+echo "\n---> 2. Via a return by ref function call, assign by reference the return value of a function that returns a constant by ref:\n";
+unset($a, $b);
+$a = 4;
+$b = &$c->returnFunctionCallByRef('returnConstantByRef');
+$a++;
+var_dump($a, $b);
+
+echo "\n---> 3. Via a return by ref function call, assign by reference the return value of a function that returns by ref:\n";
+unset($a, $b);
+$a = 4;
+$b = &$c->returnFunctionCallByRef('returnVariableByRef');
+$a++;
+var_dump($a, $b);
+
+?>
+--EXPECTF--
+
+---> 1. Via a return by ref function call, assign by reference the return value of a function that returns by value:
+
+Notice: Only variable references should be returned by reference in %s on line 16
+int(5)
+int(100)
+
+---> 2. Via a return by ref function call, assign by reference the return value of a function that returns a constant by ref:
+
+Notice: Only variable references should be returned by reference in %s on line 8
+int(5)
+int(100)
+
+---> 3. Via a return by ref function call, assign by reference the return value of a function that returns by ref:
+int(5)
+int(5)
\ No newline at end of file diff --git a/tests/lang/returnByReference.009.phpt b/tests/lang/returnByReference.009.phpt new file mode 100644 index 0000000..6320375 --- /dev/null +++ b/tests/lang/returnByReference.009.phpt @@ -0,0 +1,39 @@ +--TEST--
+Returning a references returned by another function
+--FILE--
+<?php
+
+
+function &returnVarByRef () {
+ $b=1;
+ return $b;
+}
+
+function &testReturnVarByRef() {
+ return returnVarByRef();
+}
+
+function returnVal () {
+return 1;
+}
+
+function &testReturnValByRef() {
+ return returnVal();
+}
+
+echo "\n---> 1. Return a variable by reference -> No warning:\n";
+
+var_dump (testReturnVarByRef());
+
+echo "\n---> 2. Return a value by reference -> Warning:\n";
+
+var_dump (testReturnValByRef());
+
+--EXPECTF--
+---> 1. Return a variable by reference -> No warning:
+int(1)
+
+---> 2. Return a value by reference -> Warning:
+
+Notice: Only variable references should be returned by reference in %s on line %d
+int(1)
diff --git a/tests/lang/script_tag.phpt b/tests/lang/script_tag.phpt new file mode 100644 index 0000000..1b5c696 --- /dev/null +++ b/tests/lang/script_tag.phpt @@ -0,0 +1,17 @@ +--TEST-- +<script> tag +--FILE-- +<script language=php> echo "ola\n";</script> +<script language="php"> echo "ola2\n";</script> +<script language='php'> echo "ola3\n";</script> +texto <sc <s <script> <script language> <script language=> +<script language=php> +#comment +echo "oi\n"; //ignore here +# 2nd comment +--EXPECT-- +ola +ola2 +ola3 +texto <sc <s <script> <script language> <script language=> +oi diff --git a/tests/lang/short_tags.001.phpt b/tests/lang/short_tags.001.phpt new file mode 100644 index 0000000..522018e --- /dev/null +++ b/tests/lang/short_tags.001.phpt @@ -0,0 +1,12 @@ +--TEST-- +short_open_tag: On +--INI-- +short_open_tag=on +--FILE-- +<? +echo "Used a short tag\n"; +?> +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 0000000..6a3d5e0 --- /dev/null +++ b/tests/lang/short_tags.002.phpt @@ -0,0 +1,14 @@ +--TEST-- +short_open_tag: Off +--INI-- +short_open_tag=off +--FILE-- +<? +echo "Used a short tag\n"; +?> +Finished +--EXPECT-- +<? +echo "Used a short tag\n"; +?> +Finished diff --git a/tests/lang/short_tags.003.phpt b/tests/lang/short_tags.003.phpt new file mode 100644 index 0000000..8894bf5 --- /dev/null +++ b/tests/lang/short_tags.003.phpt @@ -0,0 +1,32 @@ +--TEST-- +short_open_tag: On, asp_tags: On +--INI-- +short_open_tag=on +asp_tags=on +--FILE-- +<?='this should get echoed'?> + +<%= 'so should this' %> + +<?php +$a = 'This gets echoed twice'; +?> + +<?= $a?> + +<%= $a%> + +<? $b=3; ?> + +<?php + echo "{$b}"; +?> +--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 0000000..ff33087 --- /dev/null +++ b/tests/lang/short_tags.004.phpt @@ -0,0 +1,35 @@ +--TEST-- +short_open_tag: Off, asp_tags: Off +--INI-- +short_open_tag=off +asp_tags=off +--FILE-- +<%= 'so should this' %> + +<?php +$a = 'This gets echoed twice'; +?> + +<?= $a?> + +<%= $a%> + +<? $b=3; ?> + +<?php + echo "{$b}"; +?> +<?= "{$b}"?> +--EXPECTF-- +<%= 'so should this' %> + + +This gets echoed twice +<%= $a%> + +<? $b=3; ?> + + +Notice: Undefined variable: b in %s on line %d + +Notice: Undefined variable: b in %s on line %d diff --git a/tests/lang/static_basic_001.phpt b/tests/lang/static_basic_001.phpt new file mode 100644 index 0000000..45fc1b2 --- /dev/null +++ b/tests/lang/static_basic_001.phpt @@ -0,0 +1,84 @@ +--TEST-- +Static keyword - basic tests +--FILE-- +<?php + +echo "\nSame variable used as static and non static.\n"; +function staticNonStatic() { + echo "---------\n"; + $a=0; + echo "$a\n"; + static $a=10; + echo "$a\n"; + $a++; +} +staticNonStatic(); +staticNonStatic(); +staticNonStatic(); + +echo "\nLots of initialisations in the same statement.\n"; +function manyInits() { + static $counter=0; + echo "------------- Call $counter --------------\n"; + static $a, $b=10, $c=20, $d, $e=30; + echo "Unitialised : $a\n"; + echo "Initialised to 10: $b\n"; + echo "Initialised to 20: $c\n"; + echo "Unitialised : $d\n"; + echo "Initialised to 30: $e\n"; + $a++; + $b++; + $c++; + $d++; + $e++; + $counter++; +} +manyInits(); +manyInits(); +manyInits(); + +echo "\nUsing static keyword at global scope\n"; +for ($i=0; $i<3; $i++) { + static $s, $k=10; + echo "$s $k\n"; + $s++; + $k++; +} +?> +--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 0000000..06e2f72 --- /dev/null +++ b/tests/lang/static_basic_002.phpt @@ -0,0 +1,28 @@ +--TEST-- +Multiple declarations of the same static variable +--FILE-- +<?php + +$a = 5; + +var_dump($a); + +static $a = 10; +static $a = 11; + +var_dump($a); + +function foo() { + static $a = 13; + static $a = 14; + + var_dump($a); +} + +foo(); + +?> +--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 0000000..a27b9fa --- /dev/null +++ b/tests/lang/static_variation_001.phpt @@ -0,0 +1,112 @@ +--TEST-- +Statics in nested functions & evals. +--FILE-- +<?php + +static $a = array(7,8,9); + +function f1() { + static $a = array(1,2,3); + + function g1() { + static $a = array(4,5,6); + var_dump($a); + } + + var_dump($a); + +} + +f1(); +g1(); +var_dump($a); + +eval(' static $b = array(10,11,12); '); + +function f2() { + eval(' static $b = array(1,2,3); '); + + function g2a() { + eval(' static $b = array(4,5,6); '); + var_dump($b); + } + + eval('function g2b() { static $b = array(7, 8, 9); var_dump($b); } '); + var_dump($b); +} + +f2(); +g2a(); +g2b(); +var_dump($b); + + +eval(' function f3() { static $c = array(1,2,3); var_dump($c); }'); +f3(); + +?> +--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 0000000..b8933fd --- /dev/null +++ b/tests/lang/static_variation_002.phpt @@ -0,0 +1,84 @@ +--TEST-- +Static variables in methods & nested functions & evals. +--FILE-- +<?php + +Class C { + function f() { + static $a = array(1,2,3); + eval(' static $k = array(4,5,6); '); + + function cfg() { + static $a = array(7,8,9); + eval(' static $k = array(10,11,12); '); + var_dump($a, $k); + } + var_dump($a, $k); + } +} +$c = new C; +$c->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 diff --git a/tests/lang/string_decimals_001.phpt b/tests/lang/string_decimals_001.phpt new file mode 100644 index 0000000..3a509b2 --- /dev/null +++ b/tests/lang/string_decimals_001.phpt @@ -0,0 +1,45 @@ +--TEST-- +String conversion with multiple decimal points +--FILE-- +<?php +function test($str) { + echo "\n--> Testing $str:\n"; + var_dump((int)$str); + var_dump((float)$str); + var_dump($str > 0); +} + +test("..9"); +test(".9."); +test("9.."); +test("9.9."); +test("9.9.9"); +?> +===DONE=== +--EXPECTF-- + +--> Testing ..9: +int(0) +float(0) +bool(false) + +--> Testing .9.: +int(0) +float(0.9) +bool(true) + +--> Testing 9..: +int(9) +float(9) +bool(true) + +--> Testing 9.9.: +int(9) +float(9.9) +bool(true) + +--> Testing 9.9.9: +int(9) +float(9.9) +bool(true) +===DONE===
\ No newline at end of file diff --git a/tests/lang/this_assignment.phpt b/tests/lang/this_assignment.phpt new file mode 100644 index 0000000..7158a34 --- /dev/null +++ b/tests/lang/this_assignment.phpt @@ -0,0 +1,43 @@ +--TEST-- +Test to catch early assignment of $this +--FILE-- +<?php +class first { + + function me() { echo "first"; } + + function who() { + global $a,$b; + $this->me(); + $a->me(); + $b->me(); + $b = new second(); + $this->me(); + $a->me(); + $b->me(); + } +} + +class second { + + function who() { + global $a,$b; + $this->me(); + $a->me(); + $b->me(); + } + function me() { echo "second"; } +} + +$a = new first(); +$b = &$a; + +$a->who(); +$b->who(); + +echo "\n"; +?> +===DONE=== +--EXPECT-- +firstfirstfirstfirstsecondsecondsecondsecondsecond +===DONE===
\ No newline at end of file diff --git a/tests/lang/throw_variation_001.phpt b/tests/lang/throw_variation_001.phpt new file mode 100644 index 0000000..d942a87 --- /dev/null +++ b/tests/lang/throw_variation_001.phpt @@ -0,0 +1,14 @@ +--TEST-- +Catching an exception thrown from an included file +--FILE-- +<?php + +try { + include "inc_throw.inc"; +} catch (Exception $e) { + echo "caught exception\n"; +} + +?> +--EXPECT-- +caught exception diff --git a/tests/lang/type_hints_001.phpt b/tests/lang/type_hints_001.phpt new file mode 100644 index 0000000..57808d4 --- /dev/null +++ b/tests/lang/type_hints_001.phpt @@ -0,0 +1,26 @@ +--TEST-- +ZE2 type hinting +--SKIPIF-- +<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> +--FILE-- +<?php + +class Foo { +} + +class Bar { +} + +function type_hint_foo(Foo $a) { +} + +$foo = new Foo; +$bar = new Bar; + +type_hint_foo($foo); +type_hint_foo($bar); + +?> +--EXPECTF-- + +Catchable fatal error: Argument 1 passed to type_hint_foo() must be an instance of Foo, instance of Bar given, called in %s on line 16 and defined in %s on line 9 diff --git a/tests/lang/type_hints_002.phpt b/tests/lang/type_hints_002.phpt new file mode 100644 index 0000000..b21240a --- /dev/null +++ b/tests/lang/type_hints_002.phpt @@ -0,0 +1,28 @@ +--TEST-- +ZE2 type hinting +--SKIPIF-- +<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> +--FILE-- +<?php +class P { } +class T { + function f(P $p = NULL) { + var_dump($p); + echo "-\n"; + } +} + +$o=new T(); +$o->f(new P); +$o->f(); +$o->f(NULL); +?> +--EXPECT-- +object(P)#2 (0) { +} +- +NULL +- +NULL +- + diff --git a/tests/lang/type_hints_003.phpt b/tests/lang/type_hints_003.phpt new file mode 100644 index 0000000..0ef3e35 --- /dev/null +++ b/tests/lang/type_hints_003.phpt @@ -0,0 +1,14 @@ +--TEST-- +ZE2 type hinting +--SKIPIF-- +<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> +--FILE-- +<?php +class T { + function f(P $p = 42) { + } +} +?> +--EXPECTF-- + +Fatal error: Default value for parameters with a class type hint can only be NULL in %stype_hints_003.php on line 3 |