From 3046e35718e4980a8cf7785fa6ecea51d02ebee8 Mon Sep 17 00:00:00 2001 From: Deus Kane Date: Mon, 20 Jan 2020 16:16:01 +0000 Subject: [PATCH] Fix #79146: cscript can fail to run on some systems In the buildconf and configure batch files, Windows' cscript utility was being run without the /e:jscript flag. This works on systems that have not had the default .js file association changed, but if .js has been re-associated to (say) an IDE, the batch files fail with the error message: Input Error: There is no script engine for file extension ".js". --- NEWS | 1 + buildconf.bat | 2 +- win32/build/buildconf.js | 2 +- win32/build/configure.bat | 2 +- win32/build/confutils.js | 2 +- win32/build/phpize.bat | 2 +- win32/build/phpize.js.in | 2 +- 7 files changed, 7 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index e670c3f999f..17b73f55b7a 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,7 @@ PHP NEWS - Core: . Fixed bug #71876 (Memory corruption htmlspecialchars(): charset `*' not supported). (Nikita) + . Fixed bug ##79146 (cscript can fail to run on some systems). (clarodeus) - CURL: . Fixed bug #79078 (Hypothetical use-after-free in curl_multi_add_handle()). diff --git a/buildconf.bat b/buildconf.bat index 698d80a823f..004d36f42c0 100644 --- a/buildconf.bat +++ b/buildconf.bat @@ -1,5 +1,5 @@ @echo off -cscript /nologo win32\build\buildconf.js %* +cscript /nologo /e:jscript win32\build\buildconf.js %* SET PHP_BUILDCONF_PATH=%~dp0 copy %PHP_BUILDCONF_PATH%\win32\build\configure.bat %PHP_BUILDCONF_PATH% > nul SET PHP_SDK_SCRIPT_PATH= diff --git a/win32/build/buildconf.js b/win32/build/buildconf.js index e76aff00008..d9280239944 100644 --- a/win32/build/buildconf.js +++ b/win32/build/buildconf.js @@ -258,4 +258,4 @@ C.WriteBlankLines(1); C.Write(file_get_contents("win32/build/configure.tail")); B.WriteLine("@echo off"); -B.WriteLine("cscript /nologo configure.js %*"); +B.WriteLine("cscript /nologo /e:jscript configure.js %*"); diff --git a/win32/build/configure.bat b/win32/build/configure.bat index 45d273dc6bf..8adefd8c96c 100644 --- a/win32/build/configure.bat +++ b/win32/build/configure.bat @@ -1,2 +1,2 @@ @echo off -cscript /nologo configure.js %* +cscript /nologo /e:jscript configure.js %* diff --git a/win32/build/confutils.js b/win32/build/confutils.js index 7a68d4288d0..96d9b887b66 100644 --- a/win32/build/confutils.js +++ b/win32/build/confutils.js @@ -352,7 +352,7 @@ function conf_process_args() var i, j; var configure_help_mode = false; var analyzed = false; - var nice = "cscript /nologo configure.js "; + var nice = "cscript /nologo /e:jscript configure.js "; var disable_all = false; args = WScript.Arguments; diff --git a/win32/build/phpize.bat b/win32/build/phpize.bat index a79885f0088..26647332589 100644 --- a/win32/build/phpize.bat +++ b/win32/build/phpize.bat @@ -1,6 +1,6 @@ @echo off SET PHP_BUILDCONF_PATH=%~dp0 -cscript /nologo %PHP_BUILDCONF_PATH%\script\phpize.js %* +cscript /nologo /e:jscript %PHP_BUILDCONF_PATH%\script\phpize.js %* IF NOT EXIST configure.bat ( echo Error generating configure script, configure script was not copied exit /b 3 diff --git a/win32/build/phpize.js.in b/win32/build/phpize.js.in index 904b1130c17..b64f32c71d2 100644 --- a/win32/build/phpize.js.in +++ b/win32/build/phpize.js.in @@ -260,6 +260,6 @@ C.WriteBlankLines(1); C.Write(file_get_contents(PHP_DIR + "\\script\\configure.tail")); B.WriteLine("@echo off"); -B.WriteLine("cscript /nologo configure.js %*"); +B.WriteLine("cscript /nologo /e:jscript configure.js %*"); FSO.CopyFile(PHP_DIR + "\\script\\run-tests.php", "run-tests.php", true);