iliaa           Thu Feb 16 03:15:52 2006 UTC

  Modified files:              (Branch: PHP_5_1)
    /php-src    server-tests.php 
  Log:
  Use 5.1 functions
  
  
http://cvs.php.net/viewcvs.cgi/php-src/server-tests.php?r1=1.2.2.2&r2=1.2.2.3&diff_format=u
Index: php-src/server-tests.php
diff -u php-src/server-tests.php:1.2.2.2 php-src/server-tests.php:1.2.2.3
--- php-src/server-tests.php:1.2.2.2    Sun Jan  1 12:50:00 2006
+++ php-src/server-tests.php    Thu Feb 16 03:15:52 2006
@@ -98,14 +98,6 @@
  * various utility functions
  */
 
-function save_to_file($filename,$text)
-{
-       $fp = @fopen($filename,'w')
-               or die("Cannot open file '" . $filename . "' (save_to_file)");
-       fwrite($fp,$text);
-       fclose($fp);
-}
-
 function settings2array($settings, &$ini_settings)
 {
        foreach($settings as $setting) {
@@ -578,7 +570,7 @@
                        $tmp_file = "$cwd$pi";
                        $pi = 
substr($cwd,strlen($this->conf['TEST_BASE_PATH'])) . $pi;
                        $url = $this->conf['TEST_WEB_BASE_URL'] . $pi;
-                       save_to_file($tmp_file,$script);
+                       file_put_contents($tmp_file,$script);
                        $fd = fopen($url, "rb");
                        $out = '';
                        if ($fd) {
@@ -1285,7 +1277,7 @@
                }
 
                // We've satisfied the preconditions - run the test!
-               save_to_file($tmp_file,$section_text['FILE']);
+               file_put_contents($tmp_file,$section_text['FILE']);
 
                $post = NULL;
                $args = "";
@@ -1507,25 +1499,25 @@
                // write .exp
                if (strpos($this->conf['TEST_PHP_LOG_FORMAT'],'E') !== FALSE) {
                        $logname = ereg_replace('\.phpt$','.exp',$file);
-                       save_to_file($logname,$wanted);
+                       file_put_contents($logname,$wanted);
                }
        
                // write .out
                if (strpos($this->conf['TEST_PHP_LOG_FORMAT'],'O') !== FALSE) {
                        $logname = ereg_replace('\.phpt$','.out',$file);
-                       save_to_file($logname,$output);
+                       file_put_contents($logname,$output);
                }
        
                // write .diff
                if (strpos($this->conf['TEST_PHP_LOG_FORMAT'],'D') !== FALSE) {
                        $logname = ereg_replace('\.phpt$','.diff',$file);
-                       save_to_file($logname,generate_diff($wanted,$output));
+                       
file_put_contents($logname,generate_diff($wanted,$output));
                }
        
                // write .log
                if (strpos($this->conf['TEST_PHP_LOG_FORMAT'],'L') !== FALSE) {
                        $logname = ereg_replace('\.phpt$','.log',$file);
-                       save_to_file($logname,
+                       file_put_contents($logname,
                                                "\n---- EXPECTED 
OUTPUT\n$wanted\n".
                                                "---- ACTUAL OUTPUT\n$output\n".
                                                "---- FAILED\n");

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

Reply via email to