Skip to content

Commit ededcd5

Browse files
committed
Fix curl tests
1 parent 85c4ac8 commit ededcd5

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

ext/curl/tests/server.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ function curl_cli_server_start() {
7171
}
7272

7373
register_shutdown_function(
74-
function($handle) use($router) {
74+
function($handle) {
7575
proc_terminate($handle);
7676
/* Wait for server to shutdown */
7777
for ($i = 0; $i < 60; $i++) {

sapi/cli/php_cli_server.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2242,7 +2242,12 @@ static bool php_cli_server_dispatch_router(php_cli_server *server, php_cli_serve
22422242
zend_try {
22432243
zval retval;
22442244
ZVAL_UNDEF(&retval);
2245-
if (php_execute_script_ex(&zfd, &retval)) {
2245+
int sg_options_back = SG(options);
2246+
/* Don't chdir to the router script because the file path may be relative. */
2247+
SG(options) |= SAPI_OPTION_NO_CHDIR;
2248+
bool result = php_execute_script_ex(&zfd, &retval);
2249+
SG(options) = sg_options_back;
2250+
if (result) {
22462251
if (Z_TYPE(retval) != IS_UNDEF) {
22472252
decline = Z_TYPE(retval) == IS_FALSE;
22482253
zval_ptr_dtor(&retval);

0 commit comments

Comments
 (0)