]> granicus.if.org Git - php/commitdiff
Fix these to give correct results even if register_globals=off or
authorfoobar <sniper@php.net>
Tue, 23 Oct 2001 11:11:29 +0000 (11:11 +0000)
committerfoobar <sniper@php.net>
Tue, 23 Oct 2001 11:11:29 +0000 (11:11 +0000)
register_argc_argv=off.

run-tests.php
tests/basic/011.phpt

index b7417da4bdd1bd0e4647bca45d545f4abcdc5de6..8e11e5dbef3506f7eb112d7284a0d90ec392a8ca 100755 (executable)
@@ -25,6 +25,8 @@
  * - do not test PEAR components if base class and/or component class cannot be instanciated
  */
 
+set_time_limit(0);
+
 ob_implicit_flush();
 
 define('TEST_PASSED', 0);
@@ -43,7 +45,12 @@ if ($opts['help']) {
     exit;
 }
 */
-do_testing($argc, $argv);
+
+if(!isset($_SERVER['argc'])) {
+       echo "\nWARNING: register_argc_argv seems to be set 'off' in php.ini\n\n";
+}      
+
+@do_testing($_SERVER['argc'], $_SERVER['argv']);
 
 exit;
 
@@ -97,7 +104,7 @@ function create_found_tests_4_modules_list() {
 function create_modules_2_test_list() {
     global $compiled_in_modules,$modules_2_test,$modules_available;
     foreach ($compiled_in_modules AS $value)
-        if ($modules_2_test[$value]) $modules_available[]=$value;
+        if (isset($modules_2_test[$value])) $modules_available[]=$value;
 }
 
 
index 7c2d395b9d2230ac0389a3527f18861c731161a9..9320c16c16bf6856840ab6846278af8eaeac5fdb 100644 (file)
@@ -1,12 +1,20 @@
 --TEST--
 Testing $argc and $argv handling
+--SKIPIF--
+<?php if(ini_get('register_argc_argv') == '') echo 'skip'; ?>
 --POST--
 --GET--
 ab+cd+ef+123+test
 --FILE--
 <?php 
-       for($i=0;$i<$argc;$i++) {
-               echo "$i: ".$argv[$i]."\n";
+       if(ini_get('register_globals') != '') {
+               for($i=0;$i<$argc;$i++) {
+                       echo "$i: ".$argv[$i]."\n";
+               }
+       } else {
+               for($i=0;$i<$_SERVER['argc'];$i++) {
+                       echo "$i: ".$_SERVER['argv'][$i]."\n";
+               }
        }
 ?>
 --EXPECT--