nlopess         Thu Feb  8 15:25:17 2007 UTC

  Modified files:              
    /php-src    run-tests.php 
  Log:
  MFB: remove ereg() calls
  
http://cvs.php.net/viewvc.cgi/php-src/run-tests.php?r1=1.314&r2=1.315&diff_format=u
Index: php-src/run-tests.php
diff -u php-src/run-tests.php:1.314 php-src/run-tests.php:1.315
--- php-src/run-tests.php:1.314 Tue Jan 30 17:41:11 2007
+++ php-src/run-tests.php       Thu Feb  8 15:25:17 2007
@@ -23,7 +23,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: run-tests.php,v 1.314 2007/01/30 17:41:11 nlopess Exp $ */
+/* $Id: run-tests.php,v 1.315 2007/02/08 15:25:17 nlopess Exp $ */
 
 /* Sanity check to ensure that pcre extension needed by this script is 
available.
  * In the event it is not, print a nice error message indicating that this 
script will
@@ -401,7 +401,7 @@
                                        $html_output = is_resource($html_file);
                                        break;
                                case '--version':
-                                       echo '$Revision: 1.314 $'."\n";
+                                       echo '$Revision: 1.315 $'."\n";
                                        exit(1);
                                default:
                                        echo "Illegal switch specified!\n";
@@ -522,7 +522,7 @@
                if ($html_output) {
                        fclose($html_file);
                }
-               if (getenv('REPORT_EXIT_STATUS') == 1 and ereg('FAILED( |$)', 
implode(' ', $test_results))) {
+               if (getenv('REPORT_EXIT_STATUS') == 1 and 
preg_match('/FAILED(?: |$)/', implode(' ', $test_results))) {
                        exit(1);
                }
                exit(0);
@@ -986,7 +986,7 @@
                $bork_info = "empty test [$file]";
                $borked = true;
        }
-       if (!ereg('^--TEST--',$line,$r)) {
+       if (strncmp('--TEST--', $line, 8)) {
                $bork_info = "tests must start with --TEST-- [$file]";
                $borked = true;
        }
@@ -1011,7 +1011,7 @@
                }
 
                // End of actual test?
-               if ($secfile && preg_match('/^===DONE===/', $line, $r)) {
+               if ($secfile && preg_match('/^===DONE===$/', $line)) {
                        $secdone = true;
                }
        }
@@ -1207,10 +1207,9 @@
                        if (!$cfg['keep']['skip']) {
                                @unlink($test_skipif);
                        }
-                       if (!strncasecmp('skip', trim($output), 4)) {
-                               $reason = (eregi("^skip[[:space:]]*(.+)\$", 
trim($output))) ? eregi_replace("^skip[[:space:]]*(.+)\$", "\\1", 
trim($output)) : FALSE;
-                               if ($reason) {
-                                       show_result("SKIP", $tested, 
$tested_file, $unicode_semantics, "reason: $reason", $temp_filenames);
+                       if (!strncasecmp('skip', ltrim($output), 4)) {
+                               if (preg_match('/^\s*skip\s*(.+)\s*/i', 
$output, $m)) {
+                                       show_result("SKIP", $tested, 
$tested_file, $unicode_semantics, "reason: $m[1]", $temp_filenames);
                                } else {
                                        show_result("SKIP", $tested, 
$tested_file, $unicode_semantics, '', $temp_filenames);
                                }
@@ -1222,17 +1221,15 @@
                                }
                                return 'SKIPPED';
                        }
-                       if (!strncasecmp('info', trim($output), 4)) {
-                               $reason = (ereg("^info[[:space:]]*(.+)\$", 
trim($output))) ? ereg_replace("^info[[:space:]]*(.+)\$", "\\1", trim($output)) 
: FALSE;
-                               if ($reason) {
-                                       $info = " (info: $reason)";
+                       if (!strncasecmp('info', ltrim($output), 4)) {
+                               if (preg_match('/^\s*info\s*(.+)\s*/i', 
$output, $m)) {
+                                       $info = " (info: $m[1])";
                                }
                        }
-                       if (!strncasecmp('warn', trim($output), 4)) {
-                               $reason = (ereg("^warn[[:space:]]*(.+)\$", 
trim($output))) ? ereg_replace("^warn[[:space:]]*(.+)\$", "\\1", trim($output)) 
: FALSE;
-                               if ($reason) {
+                       if (!strncasecmp('warn', ltrim($output), 4)) {
+                               if (preg_match('/^\s*warn\s*(.+)\s*/i', 
$output, $m)) {
                                        $warn = true; /* only if there is a 
reason */
-                                       $info = " (warn: $reason)";
+                                       $info = " (warn: $m[1])";
                                }
                        }
                }
@@ -1357,8 +1354,8 @@
 
                $request = '';
                foreach ($raw_lines as $line) {
-                       if (empty($env['CONTENT_TYPE']) && 
eregi('^(Content-Type:)(.*)', $line, $res)) {
-                               $env['CONTENT_TYPE'] = trim(str_replace("\r", 
'', $res[2]));
+                       if (empty($env['CONTENT_TYPE']) && 
preg_match('/^Content-Type:(.*)/i', $line, $res)) {
+                               $env['CONTENT_TYPE'] = trim(str_replace("\r", 
'', $res[1]));
                                continue;
                        }
                        $request .= $line . "\n";

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to