diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c index 2f7b85124f53b..20b2ce09fbb41 100644 --- a/ext/standard/proc_open.c +++ b/ext/standard/proc_open.c @@ -1317,7 +1317,9 @@ PHP_FUNCTION(proc_open) if (newprocok == FALSE) { DWORD dw = GetLastError(); close_all_descriptors(descriptors, ndesc); - php_error_docref(NULL, E_WARNING, "CreateProcess failed, error code: %u", dw); + char *msg = php_win32_error_to_msg(dw); + php_error_docref(NULL, E_WARNING, "CreateProcess failed: %s", msg); + php_win32_error_msg_free(msg); goto exit_fail; } diff --git a/ext/standard/tests/general_functions/ghsa-9fcc-425m-g385_001.phpt b/ext/standard/tests/general_functions/ghsa-9fcc-425m-g385_001.phpt index 2873210608497..11285bed7cb43 100644 --- a/ext/standard/tests/general_functions/ghsa-9fcc-425m-g385_001.phpt +++ b/ext/standard/tests/general_functions/ghsa-9fcc-425m-g385_001.phpt @@ -4,6 +4,9 @@ GHSA-9fcc-425m-g385 - bypass CVE-2024-1874 - batch file variation &1"), "is not recognized as an internal or external command")) { + die("skip English locale required"); +} if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); ?> --FILE-- @@ -49,7 +52,7 @@ operable program or batch file. '"%sghsa-9fcc-425m-g385_001.bat. ... . ."' is not recognized as an internal or external command, operable program or batch file. -Warning: proc_open(): CreateProcess failed, error code: 2 in %s on line %d +Warning: proc_open(): CreateProcess failed: The system cannot find the file specified in %s on line %d --CLEAN-- &1"), "is not recognized as an internal or external command")) { + die("skip English locale required"); +} if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); ?> --FILE-- @@ -49,17 +52,17 @@ $proc = proc_open(["\\cmd. ... ", "/c", $batch_file_path, "\"¬epad.exe"], $d %sghsa-9fcc-425m-g385_002.bat "¬epad.exe -Warning: proc_open(): CreateProcess failed, error code: 2 in %s on line %d +Warning: proc_open(): CreateProcess failed: The system cannot find the file specified in %s on line %d %sghsa-9fcc-425m-g385_002.bat "¬epad.exe %sghsa-9fcc-425m-g385_002.bat "¬epad.exe -Warning: proc_open(): CreateProcess failed, error code: 2 in %s on line %d +Warning: proc_open(): CreateProcess failed: The system cannot find the file specified in %s on line %d -Warning: proc_open(): CreateProcess failed, error code: 2 in %s on line %d +Warning: proc_open(): CreateProcess failed: The system cannot find the file specified in %s on line %d -Warning: proc_open(): CreateProcess failed, error code: 2 in %s on line %d +Warning: proc_open(): CreateProcess failed: The system cannot find the file specified in %s on line %d --CLEAN--