diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 15:01:31 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 15:01:31 +0000 |
commit | c9cf025fadfe043f0f2f679e10d1207d8a158bb6 (patch) | |
tree | 3a94effe0bdc0a6814d8134f4ed840d7cc6b6f19 /debian/perl-framework/t/htdocs/php | |
parent | Adding upstream version 2.4.57. (diff) | |
download | apache2-c9cf025fadfe043f0f2f679e10d1207d8a158bb6.tar.xz apache2-c9cf025fadfe043f0f2f679e10d1207d8a158bb6.zip |
Adding debian version 2.4.57-2.debian/2.4.57-2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/perl-framework/t/htdocs/php')
78 files changed, 1750 insertions, 0 deletions
diff --git a/debian/perl-framework/t/htdocs/php/add.php b/debian/perl-framework/t/htdocs/php/add.php new file mode 100644 index 0000000..2a4a69d --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/add.php @@ -0,0 +1 @@ +<?php $a=1; $b=2; $c=3; $d=$a+$b+$c; echo $d?> diff --git a/debian/perl-framework/t/htdocs/php/arg.php b/debian/perl-framework/t/htdocs/php/arg.php new file mode 100644 index 0000000..9e88267 --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/arg.php @@ -0,0 +1,5 @@ +<?php + for($i=0;$i<$_SERVER["argc"];$i++) { + echo "$i: ".$_SERVER["argv"][$i]."\n"; + } +?> diff --git a/debian/perl-framework/t/htdocs/php/cfunctions.php b/debian/perl-framework/t/htdocs/php/cfunctions.php new file mode 100644 index 0000000..3655cd6 --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/cfunctions.php @@ -0,0 +1,50 @@ +<?php + +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"; + +?> diff --git a/debian/perl-framework/t/htdocs/php/classes.php b/debian/perl-framework/t/htdocs/php/classes.php new file mode 100644 index 0000000..3821ef2 --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/classes.php @@ -0,0 +1,46 @@ +<?php + +/* pretty nifty object oriented code! */ + +class user { + var $first_name,$family_name,$address,$phone_num; + function display() + { + echo "User information\n"; + echo "----------------\n\n"; + echo "First name:\t ".$this->first_name."\n"; + echo "Family name:\t ".$this->family_name."\n"; + echo "Address:\t ".$this->address."\n"; + echo "Phone:\t\t ".$this->phone_num."\n"; + echo "\n\n"; + } + function initialize($first_name,$family_name,$address,$phone_num) + { + $this->first_name = $first_name; + $this->family_name = $family_name; + $this->address = $address; + $this->phone_num = $phone_num; + } +}; + + +function test($u) +{ /* one can pass classes as arguments */ + $u->display(); + $t = $u; + $t->address = "New address..."; + return $t; /* and also return them as return values */ +} + +$user1 = new user; +$user2 = new user; + +$user1->initialize("Zeev","Suraski","Ben Gourion 3, Kiryat Bialik, Israel","+972-4-8713139"); +$user2->initialize("Andi","Gutmans","Haifa, Israel","+972-4-8231621"); +$user1->display(); +$user2->display(); + +$tmp = test($user2); +$tmp->display(); + +?> diff --git a/debian/perl-framework/t/htdocs/php/construct.php b/debian/perl-framework/t/htdocs/php/construct.php new file mode 100644 index 0000000..4186c9b --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/construct.php @@ -0,0 +1,30 @@ +<?php +class obj { + function method() {} + } + +function test($o_copy) { + $o_copy->root->set_in_copied_o=TRUE; + var_dump($o_copy);?><BR><?php } + +$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(); + +// $o->root->method() makes ob_get_contents() have a '&' in front of object +// so this does not work. +// echo ($x==$y) ? 'success':'failure'; + +echo "x = $x"; +echo "y = $y"; +?> diff --git a/debian/perl-framework/t/htdocs/php/dirname.php b/debian/perl-framework/t/htdocs/php/dirname.php new file mode 100644 index 0000000..26f5845 --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/dirname.php @@ -0,0 +1,17 @@ +<?php + + function check_dirname($path) + { + print "dirname($path) == " . dirname($path) . "\n"; + } + + check_dirname("/foo/"); + check_dirname("/foo"); + check_dirname("/foo/bar"); + check_dirname("d:\\foo\\bar.inc"); + check_dirname("/"); + check_dirname(".../foo"); + check_dirname("./foo"); + check_dirname("foobar///"); + check_dirname("c:\\foo"); +?> diff --git a/debian/perl-framework/t/htdocs/php/divide.php b/debian/perl-framework/t/htdocs/php/divide.php new file mode 100644 index 0000000..3cbc5be --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/divide.php @@ -0,0 +1 @@ +<?php $a=27; $b=3; $c=3; $d=$a/$b/$c; echo $d?> diff --git a/debian/perl-framework/t/htdocs/php/do-while.php b/debian/perl-framework/t/htdocs/php/do-while.php new file mode 100644 index 0000000..b824bfb --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/do-while.php @@ -0,0 +1,7 @@ +<?php +$i=3; +do { + echo $i; + $i--; +} while($i>0); +?> diff --git a/debian/perl-framework/t/htdocs/php/else.php b/debian/perl-framework/t/htdocs/php/else.php new file mode 100644 index 0000000..0bdb1a3 --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/else.php @@ -0,0 +1,7 @@ +<?php $a=1; + if($a==0): + echo "bad"; + else: + echo "good"; + endif?> + diff --git a/debian/perl-framework/t/htdocs/php/elseif.php b/debian/perl-framework/t/htdocs/php/elseif.php new file mode 100644 index 0000000..e5223bf --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/elseif.php @@ -0,0 +1,9 @@ +<?php $a=1; + if($a==0): + echo "bad"; + elseif($a==3): + echo "bad"; + else: + echo "good"; + endif?> + diff --git a/debian/perl-framework/t/htdocs/php/eval.php b/debian/perl-framework/t/htdocs/php/eval.php new file mode 100644 index 0000000..991185e --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/eval.php @@ -0,0 +1,5 @@ +<?php + error_reporting(0); + $a="echo \"Hello\";"; + eval($a); +?> diff --git a/debian/perl-framework/t/htdocs/php/eval2.php b/debian/perl-framework/t/htdocs/php/eval2.php new file mode 100644 index 0000000..53d16a0 --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/eval2.php @@ -0,0 +1,8 @@ +<?php +old_function F $a ( + eval($a); +); + +error_reporting(0); +F("echo \"Hello\";"); +?> diff --git a/debian/perl-framework/t/htdocs/php/eval3.php b/debian/perl-framework/t/htdocs/php/eval3.php new file mode 100644 index 0000000..c8041fd --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/eval3.php @@ -0,0 +1,10 @@ +<?php + +error_reporting(0); + +$message = "echo \"hey\n\";"; + +for ($i=0; $i<10; $i++) { + eval($message); + echo $i."\n"; +} diff --git a/debian/perl-framework/t/htdocs/php/eval4.php b/debian/perl-framework/t/htdocs/php/eval4.php new file mode 100644 index 0000000..f19c1c8 --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/eval4.php @@ -0,0 +1,13 @@ +<?php + +error_reporting(0); + +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++; +} diff --git a/debian/perl-framework/t/htdocs/php/fpm/action/sub2/test.php b/debian/perl-framework/t/htdocs/php/fpm/action/sub2/test.php new file mode 100644 index 0000000..4314e0d --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/fpm/action/sub2/test.php @@ -0,0 +1,4 @@ +<?php + foreach ($_SERVER as $key => $value) { + echo "$key=$value\n"; + }
\ No newline at end of file diff --git a/debian/perl-framework/t/htdocs/php/fpm/pp/sub1/test.php b/debian/perl-framework/t/htdocs/php/fpm/pp/sub1/test.php new file mode 100644 index 0000000..4314e0d --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/fpm/pp/sub1/test.php @@ -0,0 +1,4 @@ +<?php + foreach ($_SERVER as $key => $value) { + echo "$key=$value\n"; + }
\ No newline at end of file diff --git a/debian/perl-framework/t/htdocs/php/fpm/test.php b/debian/perl-framework/t/htdocs/php/fpm/test.php new file mode 100644 index 0000000..ccce0c3 --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/fpm/test.php @@ -0,0 +1 @@ +<?php var_export($_SERVER)?> diff --git a/debian/perl-framework/t/htdocs/php/func1.php b/debian/perl-framework/t/htdocs/php/func1.php new file mode 100644 index 0000000..525b791 --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/func1.php @@ -0,0 +1 @@ +<?php echo strlen("abcdef")?> diff --git a/debian/perl-framework/t/htdocs/php/func2.php b/debian/perl-framework/t/htdocs/php/func2.php new file mode 100644 index 0000000..64ea795 --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/func2.php @@ -0,0 +1,13 @@ +<?php +old_function blah ( + static $hey=0,$yo=0; + + echo "hey=".$hey++.", ",$yo--."\n"; +); + +blah(); +blah(); +blah(); +if (isset($hey) || isset($yo)) { + echo "Local variables became global :(\n"; +} diff --git a/debian/perl-framework/t/htdocs/php/func3.php b/debian/perl-framework/t/htdocs/php/func3.php new file mode 100644 index 0000000..62cee15 --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/func3.php @@ -0,0 +1,89 @@ +<?php + +old_function a ( + echo "hey\n"; +); + +function b($i) +{ + echo "$i\n"; +} + + +function c($i,$j) +{ + echo "Counting from $i to $j\n"; + for ($k=$i; $k<=$j; $k++) { + echo "$k\n"; + } +} + +a(); +b("blah"); +a(); +b("blah","blah"); +c(7,14); + +a(); + + +old_function factorial $n ( + if ($n==0 || $n==1) { + return 1; + } else { + return factorial($n-1)*$n; + } +); + +function factorial2($start, $n) +{ + if ($n<=$start) { + return $start; + } else { + return factorial2($start,$n-1)*$n; + } +} + + +for ($k=0; $k<10; $k++) { + for ($i=0; $i<=10; $i++) { + $n=factorial($i); + echo "factorial($i) = $n\n"; + } +} + + +echo "and now, from a function...\n"; + +old_function call_fact ( + echo "(it should break at 5...)\n"; + for ($i=0; $i<=10; $i++) { + if ($i == 5) break; + $n=factorial($i); + echo "factorial($i) = $n\n"; + } +); + +old_function return4 ( return 4; ); +old_function return7 ( return 7; ); + +for ($k=0; $k<10; $k++) { + call_fact(); +} + +echo "------\n"; +$result = factorial(factorial(3)); +echo "$result\n"; + +$result=factorial2(return4(),return7()); +echo "$result\n"; + +old_function andi $i, $j ( + for ($k=$i ; $k<=$j ; $k++) { + if ($k >5) continue; + echo "$k\n"; + } +); + +andi (3,10); + diff --git a/debian/perl-framework/t/htdocs/php/func4.php b/debian/perl-framework/t/htdocs/php/func4.php new file mode 100644 index 0000000..b1dc39c --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/func4.php @@ -0,0 +1,30 @@ +<?php + +echo "Before function declaration...\n"; + +old_function print_something_multiple_times $something,$times ( + echo "----\nIn function, printing the string \"$something\" $times times\n"; + for ($i=0; $i<$times; $i++) { + echo "$i) $something\n"; + } + echo "Done with function...\n-----\n"; +); + +old_function some_other_function ( + echo "This is some other function, to ensure more than just one function works fine...\n"; +); + +echo "After function declaration...\n"; + +echo "Calling function for the first time...\n"; +print_something_multiple_times("This works!",10); +echo "Returned from function call...\n"; + +echo "Calling the function for the second time...\n"; +print_something_multiple_times("This like, really works and stuff...",3); +echo "Returned from function call...\n"; + +some_other_function(); + +?> + diff --git a/debian/perl-framework/t/htdocs/php/func5.php b/debian/perl-framework/t/htdocs/php/func5.php new file mode 100644 index 0000000..dfc86bb --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/func5.php @@ -0,0 +1,25 @@ +<?php + +$file = $_SERVER["argv"][0]; + +function foo() +{ + global $file; + + $fp = fopen($file, "w"); + if( $fp ) + { + fclose($fp); + } + else + { + // Attempt to alert the user + error_log("can't write $file.", 0); + } +} + +register_shutdown_function("foo"); + +print "foo() will be called on shutdown...\n"; + +?> diff --git a/debian/perl-framework/t/htdocs/php/func6.php b/debian/perl-framework/t/htdocs/php/func6.php new file mode 100644 index 0000000..8ac8e1f --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/func6.php @@ -0,0 +1,18 @@ +<?php +function F() +{ + $a = "Hello "; + return($a); +} + +function G() +{ + static $myvar = 4; + + echo "$myvar "; + echo F(); + echo "$myvar"; +} + +G(); +?> diff --git a/debian/perl-framework/t/htdocs/php/getenv.php b/debian/perl-framework/t/htdocs/php/getenv.php new file mode 100644 index 0000000..5d0dffd --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/getenv.php @@ -0,0 +1 @@ +<?php echo getenv("REQUEST_METHOD"); ?> diff --git a/debian/perl-framework/t/htdocs/php/getlastmod.php b/debian/perl-framework/t/htdocs/php/getlastmod.php new file mode 100644 index 0000000..e10a7eb --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/getlastmod.php @@ -0,0 +1 @@ +<?php echo date("F", getlastmod()); ?> diff --git a/debian/perl-framework/t/htdocs/php/globals.php b/debian/perl-framework/t/htdocs/php/globals.php new file mode 100644 index 0000000..619ea73 --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/globals.php @@ -0,0 +1,19 @@ +<?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()?> + diff --git a/debian/perl-framework/t/htdocs/php/hello.php b/debian/perl-framework/t/htdocs/php/hello.php new file mode 100644 index 0000000..e2c0484 --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/hello.php @@ -0,0 +1 @@ +<?php echo "Hello World"?> diff --git a/debian/perl-framework/t/htdocs/php/if.php b/debian/perl-framework/t/htdocs/php/if.php new file mode 100644 index 0000000..8a25e82 --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/if.php @@ -0,0 +1 @@ +<?php $a=1; if($a>0) { echo "Yes"; } ?> diff --git a/debian/perl-framework/t/htdocs/php/if2.php b/debian/perl-framework/t/htdocs/php/if2.php new file mode 100644 index 0000000..612718c --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/if2.php @@ -0,0 +1,11 @@ +<?php $a = 1; +old_function Test $a ( + if($a<3): + return(3); + endif; +); + +if($a < Test($a)): + echo "$a\n"; + $a++; +endif?> diff --git a/debian/perl-framework/t/htdocs/php/include.inc b/debian/perl-framework/t/htdocs/php/include.inc new file mode 100644 index 0000000..d436a7b --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/include.inc @@ -0,0 +1,3 @@ +<?php + echo "Hello"; +?> diff --git a/debian/perl-framework/t/htdocs/php/include.php b/debian/perl-framework/t/htdocs/php/include.php new file mode 100644 index 0000000..2f2eac6 --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/include.php @@ -0,0 +1,3 @@ +<?php + include "include.inc"; +?> diff --git a/debian/perl-framework/t/htdocs/php/include2.inc b/debian/perl-framework/t/htdocs/php/include2.inc new file mode 100644 index 0000000..7039e3f --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/include2.inc @@ -0,0 +1,5 @@ +<?php + old_function MyFunc $a ( + echo $a; + ); +?> diff --git a/debian/perl-framework/t/htdocs/php/include2.php b/debian/perl-framework/t/htdocs/php/include2.php new file mode 100644 index 0000000..b529569 --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/include2.php @@ -0,0 +1,4 @@ +<?php + include "include2.inc"; + MyFunc("Hello"); +?> diff --git a/debian/perl-framework/t/htdocs/php/inheritance.php b/debian/perl-framework/t/htdocs/php/inheritance.php new file mode 100644 index 0000000..a0944b1 --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/inheritance.php @@ -0,0 +1,43 @@ +<?php + +/* Inheritance test. Pretty nifty if I do say so myself! */ + +class foo { + var $a; + var $b; + function display() { + echo "This is class foo\n"; + echo "a = ".$this->a."\n"; + echo "b = ".$this->b."\n"; + } + function mul() { + return $this->a*$this->b; + } +}; + +class bar extends foo { + var $c; + function display() { /* alternative display function for class bar */ + echo "This is class bar\n"; + echo "a = ".$this->a."\n"; + echo "b = ".$this->b."\n"; + echo "c = ".$this->c."\n"; + } +}; + + +$foo1 = new foo; +$foo1->a = 2; +$foo1->b = 5; +$foo1->display(); +echo $foo1->mul()."\n"; + +echo "-----\n"; + +$bar1 = new bar; +$bar1->a = 4; +$bar1->b = 3; +$bar1->c = 12; +$bar1->display(); +echo $bar1->mul()."\n"; +?> diff --git a/debian/perl-framework/t/htdocs/php/lookup.php b/debian/perl-framework/t/htdocs/php/lookup.php new file mode 100644 index 0000000..bbdfa43 --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/lookup.php @@ -0,0 +1,5 @@ +<?php +$r = apache_lookup_uri("target.php"); +printf("status=%d:method=%s:uri=%s", + $r->status, $r->method, $r->uri); +?> diff --git a/debian/perl-framework/t/htdocs/php/lookup2.php b/debian/perl-framework/t/htdocs/php/lookup2.php new file mode 100644 index 0000000..f4f74ef --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/lookup2.php @@ -0,0 +1,8 @@ +<?php +header("X-Before: foobar"); +$r = apache_lookup_uri("target.php"); +header("X-After: foobar"); + +printf("status=%d:method=%s:uri=%s", + $r->status, $r->method, $r->uri); +?> diff --git a/debian/perl-framework/t/htdocs/php/multiply.php b/debian/perl-framework/t/htdocs/php/multiply.php new file mode 100644 index 0000000..4ed88c5 --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/multiply.php @@ -0,0 +1 @@ +<?php $a=2; $b=4; $c=8; $d=$a*$b*$c; echo $d?> diff --git a/debian/perl-framework/t/htdocs/php/multiviews/file.html b/debian/perl-framework/t/htdocs/php/multiviews/file.html new file mode 100644 index 0000000..3c36ced --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/multiviews/file.html @@ -0,0 +1 @@ +file.html
\ No newline at end of file diff --git a/debian/perl-framework/t/htdocs/php/nestif.php b/debian/perl-framework/t/htdocs/php/nestif.php new file mode 100644 index 0000000..6b0654a --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/nestif.php @@ -0,0 +1,15 @@ +<?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"; + endif; + endif?> + diff --git a/debian/perl-framework/t/htdocs/php/ops.php b/debian/perl-framework/t/htdocs/php/ops.php new file mode 100644 index 0000000..912ba33 --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/ops.php @@ -0,0 +1 @@ +<?php $a=8; $b=4; $c=8; echo $a|$b&$c?> diff --git a/debian/perl-framework/t/htdocs/php/param.php b/debian/perl-framework/t/htdocs/php/param.php new file mode 100644 index 0000000..0bc2bf0 --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/param.php @@ -0,0 +1,5 @@ +<?php old_function Test $a,$b ( + echo $a+$b; + ); + Test(1,2)?> + diff --git a/debian/perl-framework/t/htdocs/php/param2.php b/debian/perl-framework/t/htdocs/php/param2.php new file mode 100644 index 0000000..4a8fe74 --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/param2.php @@ -0,0 +1,7 @@ +<?php old_function Test $b ( + $b++; + return($b); + ); + $a = Test(1); + echo $a?> + diff --git a/debian/perl-framework/t/htdocs/php/recurse.php b/debian/perl-framework/t/htdocs/php/recurse.php new file mode 100644 index 0000000..3378bfb --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/recurse.php @@ -0,0 +1,10 @@ +<?php Function Test() + { + static $a=1; + + echo "$a "; + $a++; + if($a<10): Test(); endif; + } + Test()?> + diff --git a/debian/perl-framework/t/htdocs/php/regression.php b/debian/perl-framework/t/htdocs/php/regression.php new file mode 100644 index 0000000..8713d41 --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/regression.php @@ -0,0 +1,22 @@ +PHP Regression Test + +<?php + +include("regression1.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"; +} +?> + diff --git a/debian/perl-framework/t/htdocs/php/regression1.inc b/debian/perl-framework/t/htdocs/php/regression1.inc new file mode 100644 index 0000000..d841d06 --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/regression1.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("regression2.inc"); ?> +********************************<br> + +<?php +{ + echo "Tests completed.<br>\n"; # testing some PHP style comment... +} +?> diff --git a/debian/perl-framework/t/htdocs/php/regression2.inc b/debian/perl-framework/t/htdocs/php/regression2.inc new file mode 100644 index 0000000..a660307 --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/regression2.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/debian/perl-framework/t/htdocs/php/regression2.php b/debian/perl-framework/t/htdocs/php/regression2.php new file mode 100644 index 0000000..0cd56bd --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/regression2.php @@ -0,0 +1,369 @@ +<?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("regression2.inc"); ?> +******************************** + +<?php +{ + echo "Tests completed.\n"; # testing some PHP style comment... +} + +} ?> diff --git a/debian/perl-framework/t/htdocs/php/regression3.php b/debian/perl-framework/t/htdocs/php/regression3.php new file mode 100644 index 0000000..703cf9b --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/regression3.php @@ -0,0 +1,22 @@ +<?php +old_function RekTest $nr ( + +echo " $nr "; + + +$j=$nr+1; +while ($j < 10) +{ + echo " a "; + RekTest($j); + $j++; + echo " b $j "; +}; +echo "\n"; + + + +); + +RekTest(0); +?> diff --git a/debian/perl-framework/t/htdocs/php/safemode/badenv.php b/debian/perl-framework/t/htdocs/php/safemode/badenv.php new file mode 100644 index 0000000..97bcdfa --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/safemode/badenv.php @@ -0,0 +1,2 @@ +<?php putenv("FISH=HelloWorld"); +echo getenv("FISH"); ?> diff --git a/debian/perl-framework/t/htdocs/php/safemode/error/mail.php b/debian/perl-framework/t/htdocs/php/safemode/error/mail.php new file mode 100644 index 0000000..cb6fdaa --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/safemode/error/mail.php @@ -0,0 +1,9 @@ +<?php +// fix for CAN-2002-0985: mail() must reject 5th argument in safe mode +if (mail("root@localhost", "httpd-test PHP mail", + "test mail from httpd-test", "", "-C/etc/passwd")) { + print("FAIL"); +} else { + print("OK"); +} +?> diff --git a/debian/perl-framework/t/htdocs/php/safemode/hello.txt b/debian/perl-framework/t/htdocs/php/safemode/hello.txt new file mode 100644 index 0000000..39aaa32 --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/safemode/hello.txt @@ -0,0 +1 @@ +This is Content. diff --git a/debian/perl-framework/t/htdocs/php/safemode/noexec/system.php b/debian/perl-framework/t/htdocs/php/safemode/noexec/system.php new file mode 100644 index 0000000..5a224c9 --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/safemode/noexec/system.php @@ -0,0 +1 @@ +<?php system("/bin/ls /"); ?> diff --git a/debian/perl-framework/t/htdocs/php/safemode/nofile/readfile.php b/debian/perl-framework/t/htdocs/php/safemode/nofile/readfile.php new file mode 100644 index 0000000..bc2c731 --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/safemode/nofile/readfile.php @@ -0,0 +1 @@ +<?php readfile("../hello.txt"); ?>
\ No newline at end of file diff --git a/debian/perl-framework/t/htdocs/php/safemode/protected.php b/debian/perl-framework/t/htdocs/php/safemode/protected.php new file mode 100644 index 0000000..3f8b64a --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/safemode/protected.php @@ -0,0 +1,2 @@ +<?php putenv("FOO_FEE=HelloWorld"); +echo getenv("FOO_FEE"); ?> diff --git a/debian/perl-framework/t/htdocs/php/safemode/putenv.php b/debian/perl-framework/t/htdocs/php/safemode/putenv.php new file mode 100644 index 0000000..575e7f7 --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/safemode/putenv.php @@ -0,0 +1,2 @@ +<?php putenv("FOO_BAR=HelloWorld"); +echo getenv("FOO_BAR"); ?> diff --git a/debian/perl-framework/t/htdocs/php/safemode/readfile.php b/debian/perl-framework/t/htdocs/php/safemode/readfile.php new file mode 100644 index 0000000..60eda17 --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/safemode/readfile.php @@ -0,0 +1 @@ +<?php readfile("hello.txt"); ?> diff --git a/debian/perl-framework/t/htdocs/php/safemode/readpass.php b/debian/perl-framework/t/htdocs/php/safemode/readpass.php new file mode 100644 index 0000000..e983308 --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/safemode/readpass.php @@ -0,0 +1 @@ +<?php readfile("/etc/passwd"); ?> diff --git a/debian/perl-framework/t/htdocs/php/safemode/system.php b/debian/perl-framework/t/htdocs/php/safemode/system.php new file mode 100644 index 0000000..62be01a --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/safemode/system.php @@ -0,0 +1,2 @@ +<?php system("printf HelloWorld"); ?> + diff --git a/debian/perl-framework/t/htdocs/php/stack.php b/debian/perl-framework/t/htdocs/php/stack.php new file mode 100644 index 0000000..04c3198 --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/stack.php @@ -0,0 +1,13 @@ +<?php +old_function F ( + if(1): + return("Hello"); + endif; +); + +$i=0; +while($i<2): + echo F(); + $i++; +endwhile; +?> diff --git a/debian/perl-framework/t/htdocs/php/status.php b/debian/perl-framework/t/htdocs/php/status.php new file mode 100644 index 0000000..221aa2f --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/status.php @@ -0,0 +1,5 @@ +<?php +$rc = $_GET['code']; +header("HTTP/1.1 $rc Custom Status"); +flush(); +?>
\ No newline at end of file diff --git a/debian/perl-framework/t/htdocs/php/strings.php b/debian/perl-framework/t/htdocs/php/strings.php new file mode 100644 index 0000000..f0febb9 --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/strings.php @@ -0,0 +1 @@ +<?php echo "\"\t\\'" . '\n\\\'a\\\b\\' ?> diff --git a/debian/perl-framework/t/htdocs/php/strings2.php b/debian/perl-framework/t/htdocs/php/strings2.php new file mode 100644 index 0000000..ec10f4b --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/strings2.php @@ -0,0 +1,187 @@ +<?php + +error_reporting(0); + +echo "Testing strtok: "; + +$str = "testing 1/2\\3"; +$tok1 = strtok($str, " "); +$tok2 = strtok("/"); +$tok3 = strtok("\\"); +$tok4 = strtok("."); +if ($tok1 != "testing") { + echo("failed 1\n"); +} elseif ($tok2 != "1") { + echo("failed 2\n"); +} elseif ($tok3 != "2") { + echo("failed 3\n"); +} elseif ($tok4 != "3") { + echo("failed 4\n"); +} else { + echo("passed\n"); +} + +echo "Testing strstr: "; +$test = "This is a test"; +$found1 = strstr($test, 32); +$found2 = strstr($test, "a "); +if ($found1 != " is a test") { + echo("failed 1\n"); +} elseif ($found2 != "a test") { + echo("failed 2\n"); +} else { + echo("passed\n"); +} + +echo "Testing strrchr: "; +$test = "fola fola blakken"; +$found1 = strrchr($test, "b"); +$found2 = strrchr($test, 102); +if ($found1 != "blakken") { + echo("failed 1\n"); +} elseif ($found2 != "fola blakken") { + echo("failed 2\n"); +} +else { + echo("passed\n"); +} + +echo "Testing strtoupper: "; +$test = "abCdEfg"; +$upper = strtoupper($test); +if ($upper == "ABCDEFG") { + echo("passed\n"); +} else { + echo("failed!\n"); +} + +echo "Testing strtolower: "; +$test = "ABcDeFG"; +$lower = strtolower($test); +if ($lower == "abcdefg") { + echo("passed\n"); +} else { + echo("failed!\n"); +} + +echo "Testing substr: "; +$tests = $ok = 0; +$string = "string12345"; +$tests++; if (substr($string, 2, 10) == "ring12345") { $ok++; } +$tests++; if (substr($string, 4, 7) == "ng12345") { $ok++; } +$tests++; if (substr($string, 4) == "ng12345") { $ok++; } +$tests++; if (substr($string, 10, 2) == "5") { $ok++; } +$tests++; if (substr($string, 6, 0) == "") { $ok++; } +$tests++; if (substr($string, -2, 2) == "45") { $ok++; } +$tests++; if (substr($string, 1, -1) == "tring1234") { $ok++; } +$tests++; if (substr($string, -1, -2) == "") { $ok++; } +$tests++; if (substr($string, -3, -2) == "3") { $ok++; } + +if ($tests == $ok) { + echo("passed\n"); +} else { + echo("failed!\n"); +} + +$raw = ' !"#$%&\'()*+,-./0123456789:;<=>?' + . '@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_' + . '`abcdefghijklmnopqrstuvwxyz{|}~' + . "\0"; + +echo "Testing rawurlencode: "; +$encoded = rawurlencode($raw); +$correct = '%20%21%22%23%24%25%26%27%28%29%2A%2B%2C-.%2F0123456789%3A%3B%3C%3D%3E%3F' + . '%40ABCDEFGHIJKLMNOPQRSTUVWXYZ%5B%5C%5D%5E_' + . '%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D~' + . '%00'; +if ($encoded == $correct) { + echo("passed\n"); +} else { + echo("failed!\n"); +} + +echo "Testing rawurldecode: "; +$decoded = rawurldecode($correct); +if ($decoded == $raw) { + echo("passed\n"); +} else { + echo("failed!\n"); +} + +echo "Testing urlencode: "; +$encoded = urlencode($raw); +$correct = '+%21%22%23%24%25%26%27%28%29%2A%2B%2C-.%2F0123456789%3A%3B%3C%3D%3E%3F' + . '%40ABCDEFGHIJKLMNOPQRSTUVWXYZ%5B%5C%5D%5E_' + . '%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D%7E' + . '%00'; +if ($encoded == $correct) { + echo("passed\n"); +} else { + echo("failed!\n"); +} + +echo "Testing urldecode: "; +$decoded = urldecode($correct); +if ($decoded == $raw) { + echo("passed\n"); +} else { + echo("failed!\n"); +} + +echo "Testing quotemeta: "; +$raw = "a.\\+*?" . chr(91) . "^" . chr(93) . "b\$c"; +$quoted = quotemeta($raw); +if ($quoted == "a\\.\\\\\\+\\*\\?\\[\\^\\]b\\\$c") { + echo("passed\n"); +} else { + echo("failed!\n"); +} + +echo "Testing ufirst: "; +$str = "fahrvergnuegen"; +$uc = ucfirst($str); +if ($uc == "Fahrvergnuegen") { + echo("passed\n"); +} else { + echo("failed!\n"); +} + +echo "Testing strtr: "; +$str = "test abcdefgh"; +$tr = strtr($str, "def", "456"); +if ($tr == "t5st abc456gh") { + echo("passed\n"); +} else { + echo("failed!\n"); +} + +echo "Testing addslashes: "; +$str = "\"\\'"; +$as = addslashes($str); +if ($as == "\\\"\\\\\\'") { + echo("passed\n"); +} else { + echo("failed!\n"); +} + +echo "Testing stripslashes: "; +$str = "\$\\'"; +$ss = stripslashes($str); +if ($ss == "\$'") { + echo("passed\n"); +} else { + echo("failed!\n"); +} + + +echo "Testing uniqid: "; +$str = "prefix"; +$ui1 = uniqid($str); +$ui2 = uniqid($str); +if (strlen($ui1) == strlen($ui2) && strlen($ui1) == 19 && $ui1 != $ui2) { + echo("passed\n"); +} else { + echo("failed!\n"); +} + +?> diff --git a/debian/perl-framework/t/htdocs/php/strings3.php b/debian/perl-framework/t/htdocs/php/strings3.php new file mode 100644 index 0000000..e07ac2a --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/strings3.php @@ -0,0 +1,37 @@ +<?php + +error_reporting(0); + +printf("printf test 1:%s\n", "simple string"); +printf("printf test 2:%d\n", 42); +printf("printf test 3:%f\n", 10.0/3); +printf("printf test 4:%.10f\n", 10.0/3); +printf("printf test 5:%-10.2f\n", 2.5); +printf("printf test 6:%-010.2f\n", 2.5); +printf("printf test 7:%010.2f\n", 2.5); +printf("printf test 8:<%20s>\n", "foo"); +printf("printf test 9:<%-20s>\n", "bar"); +printf("printf test 10: 123456789012345\n"); +printf("printf test 10:<%15s>\n", "høyesterettsjustitiarius"); +printf("printf test 11: 123456789012345678901234567890\n"); +printf("printf test 11:<%30s>\n", "høyesterettsjustitiarius"); +printf("printf test 12:%5.2f\n", -12.34); +printf("printf test 13:%5d\n", -12); +printf("printf test 14:%c\n", 64); +printf("printf test 15:%b\n", 170); +printf("printf test 16:%x\n", 170); +printf("printf test 17:%X\n", 170); +printf("printf test 18:%16b\n", 170); +printf("printf test 19:%16x\n", 170); +printf("printf test 20:%16X\n", 170); +printf("printf test 21:%016b\n", 170); +printf("printf test 22:%016x\n", 170); +printf("printf test 23:%016X\n", 170); +printf("printf test 24:%.5s\n", "abcdefghij"); +printf("printf test 25:%-2s\n", "gazonk"); +printf("printf test 26:%2\$d %1\$d\n", 1, 2); +printf("printf test 27:%3\$d %d %d\n", 1, 2, 3); +printf("printf test 28:%2\$02d %1\$2d\n", 1, 2); +printf("printf test 29:%2\$-2d %1\$2d\n", 1, 2); + +?> diff --git a/debian/perl-framework/t/htdocs/php/strings4.php b/debian/perl-framework/t/htdocs/php/strings4.php new file mode 100644 index 0000000..e928920 --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/strings4.php @@ -0,0 +1,5 @@ +<?php +setlocale (LC_CTYPE, "C"); +echo htmlspecialchars ("<>\"&åÄ\n", ENT_COMPAT, "ISO-8859-1"); +echo htmlentities ("<>\"&åÄ\n", ENT_COMPAT, "ISO-8859-1"); +?> diff --git a/debian/perl-framework/t/htdocs/php/subtract.php b/debian/perl-framework/t/htdocs/php/subtract.php new file mode 100644 index 0000000..acf18f4 --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/subtract.php @@ -0,0 +1 @@ +<?php $a=27; $b=7; $c=10; $d=$a-$b-$c; echo $d?> diff --git a/debian/perl-framework/t/htdocs/php/switch.php b/debian/perl-framework/t/htdocs/php/switch.php new file mode 100644 index 0000000..7f601c0 --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/switch.php @@ -0,0 +1,13 @@ +<?php $a=1; + switch($a): + case 0; + echo "bad"; + break; + case 1; + echo "good"; + break; + default; + echo "bad"; + break; + endswitch?> + diff --git a/debian/perl-framework/t/htdocs/php/switch2.php b/debian/perl-framework/t/htdocs/php/switch2.php new file mode 100644 index 0000000..2cf3288 --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/switch2.php @@ -0,0 +1,42 @@ +<?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; + } +} +?> diff --git a/debian/perl-framework/t/htdocs/php/switch3.php b/debian/perl-framework/t/htdocs/php/switch3.php new file mode 100644 index 0000000..ac6c790 --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/switch3.php @@ -0,0 +1,29 @@ +<?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"; +?> diff --git a/debian/perl-framework/t/htdocs/php/switch4.php b/debian/perl-framework/t/htdocs/php/switch4.php new file mode 100644 index 0000000..24fb51f --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/switch4.php @@ -0,0 +1,29 @@ +<?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"; + endswitch; +} +for ($i=0; $i<3; $i++) { + for ($k=0; $k<10; $k++) { + switchtest (0,$k); + } +} +?> diff --git a/debian/perl-framework/t/htdocs/php/target.php b/debian/perl-framework/t/htdocs/php/target.php new file mode 100644 index 0000000..fb17bd7 --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/target.php @@ -0,0 +1 @@ +<?php echo "target.php"; ?>
\ No newline at end of file diff --git a/debian/perl-framework/t/htdocs/php/test-fpm.php b/debian/perl-framework/t/htdocs/php/test-fpm.php new file mode 100644 index 0000000..ccce0c3 --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/test-fpm.php @@ -0,0 +1 @@ +<?php var_export($_SERVER)?> diff --git a/debian/perl-framework/t/htdocs/php/umask.php b/debian/perl-framework/t/htdocs/php/umask.php new file mode 100644 index 0000000..ee36d53 --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/umask.php @@ -0,0 +1 @@ +<? print umask(000); ?>
\ No newline at end of file diff --git a/debian/perl-framework/t/htdocs/php/var1.php b/debian/perl-framework/t/htdocs/php/var1.php new file mode 100644 index 0000000..45741f5 --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/var1.php @@ -0,0 +1,12 @@ +<?php + switch ($_SERVER["REQUEST_METHOD"]) { + case "GET": + echo $_GET["variable"]; + break; + case "POST": + echo $_POST["variable"]; + break; + default: + echo "ERROR!"; + } +?> diff --git a/debian/perl-framework/t/htdocs/php/var2.php b/debian/perl-framework/t/htdocs/php/var2.php new file mode 100644 index 0000000..028e466 --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/var2.php @@ -0,0 +1,14 @@ +<?php + switch ($_SERVER["REQUEST_METHOD"]) { + case "GET": + echo join(" ", array($_GET["v1"], + $_GET["v2"])); + break; + case "POST": + echo join(" ", array($_POST["v1"], + $_POST["v2"])); + break; + default: + echo "ERROR!"; + } +?> diff --git a/debian/perl-framework/t/htdocs/php/var3.php b/debian/perl-framework/t/htdocs/php/var3.php new file mode 100644 index 0000000..7e25163 --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/var3.php @@ -0,0 +1,16 @@ +<?php + switch ($_SERVER["REQUEST_METHOD"]) { + case "GET": + echo join(" ", array($_GET["v1"], + $_GET["v2"], + $_GET["v3"])); + break; + case "POST": + echo join(" ", array($_POST["v1"], + $_POST["v2"], + $_POST["v3"])); + break; + default: + echo "ERROR!"; + } +?> diff --git a/debian/perl-framework/t/htdocs/php/var3u.php b/debian/perl-framework/t/htdocs/php/var3u.php new file mode 100644 index 0000000..1f90040 --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/var3u.php @@ -0,0 +1 @@ +<?php echo "$V1 $V2 $V3"?> diff --git a/debian/perl-framework/t/htdocs/php/virtual.php b/debian/perl-framework/t/htdocs/php/virtual.php new file mode 100644 index 0000000..0d150d4 --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/virtual.php @@ -0,0 +1 @@ +before <?php virtual("multiviews/file"); ?> after diff --git a/debian/perl-framework/t/htdocs/php/while.php b/debian/perl-framework/t/htdocs/php/while.php new file mode 100644 index 0000000..7313b51 --- /dev/null +++ b/debian/perl-framework/t/htdocs/php/while.php @@ -0,0 +1,5 @@ +<?php $a=1; + while($a<10): + echo $a; + $a++; + endwhile?> |