Thanks Joe. Could you please consider this patch too, which I have
posted some times back.
http://mail-archives.apache.org/mod_mbox/httpd-dev/200703.mbox/[EMAIL PROTECTED]
Regards
Sris
From: *Sriskanthaverl* <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>>
Date: Mar 9, 2007 11:17 PM
Subject: A patch to perl-framework test scripts for php
To: dev@httpd.apache.org <mailto:dev@httpd.apache.org>
Hi,
I have come across a number of test scripts for php in perl-framework,
which get skipped for php5, as it is explicitly said those test cases
are for php4. However I didn't see any good reason for those test cases
designed to get skipped for php5.
Therefore I modified the php scripts such a way that it runs in php4 and
php5 as well. I had to change the old_function syntax in the php scripts
as follows, to ensure the syntax is comply with php5 as well.
-old_function F $a (
+function F ($a) {
eval($a);
-);
+};
Further it required the *.t files to be changed, to make it run for php5
as well ( otherwise it get skipped).
instead calling 'need_php4', call 'need_php' function which
return true if either php4 or php5 is defined.
I attached herewith the patch as a tar.gz, and the changes i made as a
diff file.
Would like to see your comments.
Regards
Sris
Index: t/htdocs/php/regression3.php
===================================================================
--- t/htdocs/php/regression3.php (revision 516579)
+++ t/htdocs/php/regression3.php (working copy)
@@ -1,22 +1,17 @@
<?php
-old_function RekTest $nr (
+function RekTest ($nr) {
+ echo " $nr ";
-echo " $nr ";
-
-
-$j=$nr+1;
-while ($j < 10)
-{
- echo " a ";
- RekTest($j);
- $j++;
- echo " b $j ";
+ $j=$nr+1;
+ while ($j < 10)
+ {
+ echo " a ";
+ RekTest($j);
+ $j++;
+ echo " b $j ";
+ };
+ echo "\n";
};
-echo "\n";
-
-
-);
-
RekTest(0);
?>
Index: t/htdocs/php/eval2.php
===================================================================
--- t/htdocs/php/eval2.php (revision 516579)
+++ t/htdocs/php/eval2.php (working copy)
@@ -1,7 +1,7 @@
<?php
-old_function F $a (
+function F ($a) {
eval($a);
-);
+};
error_reporting(0);
F("echo \"Hello\";");
Index: t/htdocs/php/param2.php
===================================================================
--- t/htdocs/php/param2.php (revision 516579)
+++ t/htdocs/php/param2.php (working copy)
@@ -1,7 +1,7 @@
-<?php old_function Test $b (
+<?php function Test ($b) {
$b++;
return($b);
- );
+ };
$a = Test(1);
echo $a?>
Index: t/htdocs/php/if2.php
===================================================================
--- t/htdocs/php/if2.php (revision 516579)
+++ t/htdocs/php/if2.php (working copy)
@@ -1,9 +1,9 @@
<?php $a = 1;
-old_function Test $a (
+function Test ($a) {
if($a<3):
return(3);
endif;
-);
+};
if($a < Test($a)):
echo "$a\n";
Index: t/htdocs/php/param.php
===================================================================
--- t/htdocs/php/param.php (revision 516579)
+++ t/htdocs/php/param.php (working copy)
@@ -1,5 +1,5 @@
-<?php old_function Test $a,$b (
+<?php function Test ($a,$b) {
echo $a+$b;
- );
+ };
Test(1,2)?>
Index: t/htdocs/php/func2.php
===================================================================
--- t/htdocs/php/func2.php (revision 516579)
+++ t/htdocs/php/func2.php (working copy)
@@ -1,13 +1,13 @@
<?php
-old_function blah (
+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";
-}
+}?>
Index: t/htdocs/php/func3.php
===================================================================
--- t/htdocs/php/func3.php (revision 516579)
+++ t/htdocs/php/func3.php (working copy)
@@ -1,8 +1,8 @@
<?php
-old_function a (
+function a() {
echo "hey\n";
-);
+};
function b($i)
{
@@ -27,13 +27,13 @@
a();
-old_function factorial $n (
+function factorial ($n) {
if ($n==0 || $n==1) {
return 1;
} else {
return factorial($n-1)*$n;
}
-);
+};
function factorial2($start, $n)
{
@@ -55,17 +55,17 @@
echo "and now, from a function...\n";
-old_function call_fact (
+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; );
+function return4 () { return 4; };
+function return7 () { return 7; };
for ($k=0; $k<10; $k++) {
call_fact();
@@ -78,12 +78,12 @@
$result=factorial2(return4(),return7());
echo "$result\n";
-old_function andi $i, $j (
+function andi ($i, $j) {
for ($k=$i ; $k<=$j ; $k++) {
if ($k >5) continue;
echo "$k\n";
}
-);
+};
andi (3,10);
Index: t/htdocs/php/func4.php
===================================================================
--- t/htdocs/php/func4.php (revision 516579)
+++ t/htdocs/php/func4.php (working copy)
@@ -2,17 +2,17 @@
echo "Before function declaration...\n";
-old_function print_something_multiple_times $something,$times (
+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 (
+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";
Index: t/htdocs/php/umask.php
===================================================================
--- t/htdocs/php/umask.php (revision 516579)
+++ t/htdocs/php/umask.php (working copy)
@@ -1 +1 @@
-<? print umask(000); ?>
\ No newline at end of file
+<? print umask(0000); ?>
Index: t/htdocs/php/stack.php
===================================================================
--- t/htdocs/php/stack.php (revision 516579)
+++ t/htdocs/php/stack.php (working copy)
@@ -1,9 +1,9 @@
<?php
-old_function F (
+function F() {
if(1):
return("Hello");
endif;
-);
+};
$i=0;
while($i<2):
Index: t/htdocs/php/include2.inc
===================================================================
--- t/htdocs/php/include2.inc (revision 516579)
+++ t/htdocs/php/include2.inc (working copy)
@@ -1,5 +1,5 @@
<?php
- old_function MyFunc $a (
+ function MyFunc ($a) {
echo $a;
- );
+ };
?>
Index: t/php/func2.t
===================================================================
--- t/php/func2.t (revision 516579)
+++ t/php/func2.t (working copy)
@@ -4,7 +4,7 @@
use Apache::Test;
use Apache::TestRequest;
-plan tests => 1, need_php4;
+plan tests => 1, need_php;
my $expected = <<EXPECT;
hey=0, 0
Index: t/php/func3.t
===================================================================
--- t/php/func3.t (revision 516579)
+++ t/php/func3.t (working copy)
@@ -4,7 +4,7 @@
use Apache::Test;
use Apache::TestRequest;
-plan tests => 1, need_php4;
+plan tests => 1, need_php;
my $expected = <<EXPECT;
hey
Index: t/php/func4.t
===================================================================
--- t/php/func4.t (revision 516579)
+++ t/php/func4.t (working copy)
@@ -4,7 +4,7 @@
use Apache::Test;
use Apache::TestRequest;
-plan tests => 1, need_php4;
+plan tests => 1, need_php;
my $expected = <<EXPECT;
Before function declaration...
Index: t/php/umask.t
===================================================================
--- t/php/umask.t (revision 516579)
+++ t/php/umask.t (working copy)
@@ -7,7 +7,7 @@
## test that umask() is reset after script execution
-plan tests => 4, need_php4;
+plan tests => 4, need_php;
my $first = GET_BODY "/php/umask.php";
Index: t/php/param2.t
===================================================================
--- t/php/param2.t (revision 516579)
+++ t/php/param2.t (working copy)
@@ -4,7 +4,7 @@
use Apache::Test;
use Apache::TestRequest;
-plan tests => 1, need_php4;
+plan tests => 1, need_php;
my $result = GET_BODY "/php/param2.php";
ok $result eq "2\n";
Index: t/php/stack.t
===================================================================
--- t/php/stack.t (revision 516579)
+++ t/php/stack.t (working copy)
@@ -6,7 +6,7 @@
## testing stack after early function return
-plan tests => 1, need_php4;
+plan tests => 1, need_php;
my $expected = "HelloHello";
Index: t/php/if2.t
===================================================================
--- t/php/if2.t (revision 516579)
+++ t/php/if2.t (working copy)
@@ -6,7 +6,7 @@
## Testing user-defined function falling out of an If into another
-plan tests => 1, need_php4;
+plan tests => 1, need_php;
my $expected = "1\n";
Index: t/php/param.t
===================================================================
--- t/php/param.t (revision 516579)
+++ t/php/param.t (working copy)
@@ -4,7 +4,7 @@
use Apache::Test;
use Apache::TestRequest;
-plan tests => 1, need_php4;
+plan tests => 1, need_php;
my $result = GET_BODY "/php/param.php";
ok $result eq "3\n";
Index: t/php/regression3.t
===================================================================
--- t/php/regression3.t (revision 516579)
+++ t/php/regression3.t (working copy)
@@ -4,7 +4,7 @@
use Apache::Test;
use Apache::TestRequest;
-plan tests => 1, need_php4;
+plan tests => 1, need_php;
my $expected = <<EXPECT;
0 a 1 a 2 a 3 a 4 a 5 a 6 a 7 a 8 a 9
Index: t/php/include2.t
===================================================================
--- t/php/include2.t (revision 516579)
+++ t/php/include2.t (working copy)
@@ -6,7 +6,7 @@
## testing user function in an nclude
-plan tests => 1, need_php4;
+plan tests => 1, need_php;
my $expected = "Hello";
Index: t/php/eval2.t
===================================================================
--- t/php/eval2.t (revision 516579)
+++ t/php/eval2.t (working copy)
@@ -6,7 +6,7 @@
## testing eval function inside user function
-plan tests => 1, need_php4;
+plan tests => 1, need_php;
my $expected = "Hello";