]> granicus.if.org Git - php/commitdiff
have you ever tried to run the regression tests with error_reporting=E_ALL ?
authorHartmut Holzgraefe <hholzgra@php.net>
Mon, 23 Oct 2000 07:40:05 +0000 (07:40 +0000)
committerHartmut Holzgraefe <hholzgra@php.net>
Mon, 23 Oct 2000 07:40:05 +0000 (07:40 +0000)
now it will run smoothly without all theese 'undefined ...' warnings

ext/db/tests/001.phpt
ext/db/tests/002.phpt
ext/db/tests/003.phpt
ext/db/tests/004.phpt
ext/db/tests/005.phpt
ext/db/tests/006.phpt
run-tests.php
tests/lang/022.phpt
tests/lang/023-1.inc
tests/lang/024.phpt

index 9792bfef35f88c89e981c6ee2d589135d379bbf7..ea95d3d70aebc6d48605a8e3e13d4d6ca63d7293 100644 (file)
@@ -1,5 +1,7 @@
 --TEST--
 DBM File Creation Test
+--SKIPIF--
+<?php if (!extension_loaded("db")) print "skip"; ?>
 --POST--
 --GET--
 --FILE--
index 99e66e9568b59806a847f566be17509e72534859..d0bc710f084339a7996d7d174e8daf78e2eaafd8 100644 (file)
@@ -1,5 +1,7 @@
 --TEST--
 DBM Insert/Fetch Test
+--SKIPIF--
+<?php if (!extension_loaded("db")) print "skip"; ?>
 --POST--
 --GET--
 --FILE--
index ec639a02a7653f89c4d5ab8882cbaf577b864f0a..319325c398d32fc30d61454c25d7ada290cc2b37 100644 (file)
@@ -1,5 +1,7 @@
 --TEST--
 DBM Insert/Replace/Fetch Test
+--SKIPIF--
+<?php if (!extension_loaded("db")) print "skip"; ?>
 --POST--
 --GET--
 --FILE--
index 561bd0be63c5a046a3bcf79676a7bddb551cd2d0..1becfcfdcd3403029a38bf5adc85e6bb2a670cc0 100644 (file)
@@ -1,5 +1,7 @@
 --TEST--
 DBM Multiple Insert/Fetch Test
+--SKIPIF--
+<?php if (!extension_loaded("db")) print "skip"; ?>
 --POST--
 --GET--
 --FILE--
index 90ca12627209dfc2349d2d545a97a0c11c817568..de332018837d84493837347b9059421b684c3696 100644 (file)
@@ -1,5 +1,7 @@
 --TEST--
 DBM FirstKey/NextKey Loop Test With 5 Items
+--SKIPIF--
+<?php if (!extension_loaded("db")) print "skip"; ?>
 --POST--
 --GET--
 --FILE--
index 3654095a59dac02968360badf872ade163e90205..3428ce3948a7021c81b0d4ce990517a7b2edd04e 100644 (file)
@@ -1,5 +1,7 @@
 --TEST--
 DBM FirstKey/NextKey with 2 deletes
+--SKIPIF--
+<?php if (!extension_loaded("db")) print "skip"; ?>
 --POST--
 --GET--
 --FILE--
index 6b6e895e0397c0ed317205eacb6fb0eec640bd1b..16929f511d7dc0ee101c88c07279e7397784b171 100755 (executable)
@@ -18,6 +18,7 @@
    +----------------------------------------------------------------------+
  */
 
+ob_implicit_flush();
 
 define('TEST_PASSED', 0);
 define('TEST_FAILED', -1);
@@ -191,7 +192,7 @@ function find_testdirs($dir = '.', $first_pass = true) {
     }
     while ($ent = readdir($dp)) {
        $path = "$dir/$ent";
-       if ($skip[$ent] || substr($ent, 0, 1) == "." || !is_dir($path)) {
+       if ((isset($skip[$ent]) && $skip[$ent]) || substr($ent, 0, 1) == "." || !is_dir($path)) {
            continue;
        }
        if (strstr("/$path/", "/tests/")) {
@@ -211,14 +212,14 @@ function run_tests_in_dir($dir = '.') {
     }
     $testfiles = array();
     while ($ent = readdir($dp)) {
-       if ($skip[$ent] || substr($ent, 0, 1) == "." || substr($ent, -5) != ".phpt") {
+       if ((isset($skip[$ent]) && $skip[$ent]) || substr($ent, 0, 1) == "." || substr($ent, -5) != ".phpt") {
            continue;
        }
        $testfiles[] = "$dir/$ent";
-       $tests_in_dir[$dir]++;
+       if(isset($tests_in_dir[$dir]))  $tests_in_dir[$dir]++; else $tests_in_dir[$dir]=1;
     }
     closedir($dp);
-    if ($tests_in_dir[$dir] == 0) {
+    if (isset($tests_in_dir[$dir]) && ($tests_in_dir[$dir] == 0)) {
        return true;
     }
     $oskipped = $skipped;
@@ -240,7 +241,7 @@ function run_tests_in_dir($dir = '.') {
        }
        $total++;
     }
-    if ($oskipped + $tests_in_dir[$dir] == $skipped) {
+    if ($oskipped + (isset($tests_in_dir[$dir])?$tests_in_dir[$dir]:0)  == $skipped) {
        writeln("(all skipped)");
     }
     writeln("");
@@ -275,6 +276,7 @@ function delete_tmpfiles() {
  * @return bool whether the files were "equal"
  */
 function compare_results($file1, $file2) {
+       $data1 = $data2 = "";
     if (!($fp1 = @fopen($file1, "r")) || !($fp2 = @fopen($file2, "r"))) {
        return false;
     }
@@ -318,17 +320,17 @@ function run_test($file) {
     while ($line = fgets($fp, 4096)) {
        if (preg_match('/^--([A-Z]+)--$/', $line, $matches)) {
            $var = $matches[1];
-           if ($tmpfile[$var]) {
+           if (isset($tmpfile[$var]) && $tmpfile[$var]) {
                $fps[$var] = @fopen($tmpfile[$var], "w");
            } else {
                $$var = '';
            }
        } else {
-           if ($var) {
+           if (isset($var) && $var) {
                if ($var == "POST") {
                    $line = trim($line);
                }
-               if ($fps[$var]) {
+               if (isset($fps[$var]) && $fps[$var]) {
                    fwrite($fps[$var], $line);
                } else {
                    $$var .= $line;
@@ -336,16 +338,18 @@ function run_test($file) {
            }
        }
     }
-    reset($fps);
-    while (list($k, $v) = each($fps)) {
-       if (is_resource($v)) {
-           fclose($v);
-       }
+               if(isset($fps) && is_array($fps)) {
+                       reset($fps);
+                       while (list($k, $v) = each($fps)) {
+                               if (is_resource($v)) {
+                                       fclose($v);
+                               }
+                       }
     }
     putenv("PHP_TEST=1");
     putenv("REDIRECT_STATUS=1");
     putenv("CONTENT_LENGTH=");
-    putenv("QUERY_STRING=$GET");
+    putenv("QUERY_STRING=".(isset($GET)?$GET:""));
     if (isset($fps["SKIPIF"])) {
        $tmpfile["SKIPIF_OUTPUT"] = tempnam($tmpdir, $tmpfix);
        putenv("REQUEST_METHOD=GET");
@@ -403,7 +407,7 @@ function run_test($file) {
     }
     fclose($ofp);
     pclose($cp);
-    $desc = trim($TEST);
+    $desc = isset($test)?trim($TEST):"";
     $outfile = preg_replace('/\.phpt$/', '.out', $file);
     $expectfile = preg_replace('/\.phpt$/', '.exp', $file);
     $phpfile = preg_replace('/\.phpt$/', '.php', $file);
index 072d66f085a8f7fcb6af18c5cb7abbe2d66d6e37..d70ea0e28de2fc6d78527af981602a4401eb2d68 100644 (file)
@@ -11,10 +11,10 @@ cfunction switchtest ($i, $j)
                case 0:
                                switch($j) {
                                        case 0:
-                                               echo zero;
+                                               echo "zero";
                                                break;
                                        case 1: 
-                                               echo one;
+                                               echo "one";
                                                break;
                                        default:
                                                echo $j;
index 7fa22ea4141afe406acdd34b1045bb3c9f67bc17..8d52e844c96cde727da3b6b107492205d20d5518 100755 (executable)
@@ -226,7 +226,7 @@ while ($i<$arr_len) {
   while ($j<$arr_len) {
     $k=0;
     while ($k<$arr_len) {
-      ${test.$i.$j}[$k] = $i+$j+$k;
+      ${"test$i$j"}[$k] = $i+$j+$k;
       $k++;
     }
     $j++;
@@ -275,17 +275,17 @@ echo "commented out...";
 *** Hash resizing test ***<br>
 <?php 
 $i = 10;
-$a = b;
+$a = 'b';
 while ($i > 0) {
-       $a = $a . a;
+       $a = $a . 'a';
        echo "$a<br>\n";
        $resize[$a] = $i;
        $i--;
 }
 $i = 10;
-$a = b;
+$a = 'b';
 while ($i > 0) {
-       $a = $a . a;
+       $a = $a . 'a';
        echo "$a<br>\n";
        echo $resize[$a]."<br>\n";
        $i--;
index 542a7853afe6191ee39aeaa9029dd93dfa1e53c0..5c8024dc7e2124c23ef56e2a55b0265de17012d1 100644 (file)
@@ -245,7 +245,7 @@ while ($i<$arr_len) {
   while ($j<$arr_len) {
     $k=0;
     while ($k<$arr_len) {
-      ${test.$i.$j}[$k] = $i+$j+$k;
+      ${"test$i$j"}[$k] = $i+$j+$k;
       $k++;
     }
     $j++;
@@ -294,17 +294,17 @@ echo "commented out...";
 *** Hash resizing test ***
 <?php 
 $i = 10;
-$a = b;
+$a = "b";
 while ($i > 0) {
-       $a = $a . a;
+       $a = $a . "a";
        echo "$a\n";
        $resize[$a] = $i;
        $i--;
 }
 $i = 10;
-$a = b;
+$a = "b";
 while ($i > 0) {
-       $a = $a . a;
+       $a = $a . "a";
        echo "$a\n";
        echo $resize[$a]."\n";
        $i--;