]> granicus.if.org Git - php/commitdiff
Fixed bug #80437
authorNikita Popov <nikita.ppv@gmail.com>
Mon, 30 Nov 2020 10:40:46 +0000 (11:40 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Mon, 30 Nov 2020 10:40:46 +0000 (11:40 +0100)
Only chmod if the file has been created.

run-tests.php

index 00881cf7797bfefafe17cd0aa5e0c244a73b2fa7..a34434b7531d7d4c95d3fc07323ea0d2c04df3c7 100755 (executable)
@@ -2776,7 +2776,8 @@ COMMAND $cmd
         }
 
         // write .sh
-        $sh_script = <<<SH
+        if (strpos($log_format, 'S') !== false) {
+            $sh_script = <<<SH
 #!/bin/sh
 
 case "$1" in
@@ -2794,10 +2795,11 @@ case "$1" in
     ;;
 esac
 SH;
-        if (strpos($log_format, 'S') !== false && file_put_contents($sh_filename, $sh_script) === false) {
-            error("Cannot create test shell script - $sh_filename");
+            if (file_put_contents($sh_filename, $sh_script) === false) {
+                error("Cannot create test shell script - $sh_filename");
+            }
+            chmod($sh_filename, 0755);
         }
-        chmod($sh_filename, 0755);
 
         // write .log
         if (strpos($log_format, 'L') !== false && file_put_contents($log_filename, "