Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Zend/tests/gh20113.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
--TEST--
GH-20113: new Foo(...) error in constant expressions
--FILE--
<?php
const C = new \stdClass(...);
?>
--EXPECTF--
Fatal error: Cannot create Closure for new expression in %s on line %d
5 changes: 5 additions & 0 deletions Zend/zend_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -11488,6 +11488,11 @@ static void zend_compile_const_expr_new(zend_ast **ast_ptr)
{
zend_ast *class_ast = (*ast_ptr)->child[0];
zend_compile_const_expr_class_reference(class_ast);

zend_ast *args_ast = (*ast_ptr)->child[1];
if (args_ast->kind == ZEND_AST_CALLABLE_CONVERT) {
zend_error_noreturn(E_COMPILE_ERROR, "Cannot create Closure for new expression");
}
}

static void zend_compile_const_expr_closure(zend_ast **ast_ptr)
Expand Down
8 changes: 4 additions & 4 deletions php.ini-development
Original file line number Diff line number Diff line change
Expand Up @@ -807,10 +807,10 @@ enable_dl = Off
;fastcgi.impersonate = 1

; Prevent decoding of SCRIPT_FILENAME when using Apache ProxyPass or
; ProxyPassMatch. This should only be used if script file paths are already
; stored in an encoded format on the file system.
; Default is 0.
;fastcgi.script_path_encoded = 1
; ProxyPassMatch. This should be used if script file paths are not stored
; in an encoded format on the file system.
; Default is 1.
;fastcgi.script_path_encoded = 0

; Disable logging through FastCGI connection. PHP's default behavior is to enable
; this feature.
Expand Down
8 changes: 4 additions & 4 deletions php.ini-production
Original file line number Diff line number Diff line change
Expand Up @@ -809,10 +809,10 @@ enable_dl = Off
;fastcgi.impersonate = 1

; Prevent decoding of SCRIPT_FILENAME when using Apache ProxyPass or
; ProxyPassMatch. This should only be used if script file paths are already
; stored in an encoded format on the file system.
; Default is 0.
;fastcgi.script_path_encoded = 1
; ProxyPassMatch. This should be used if script file paths are not stored
; in an encoded format on the file system.
; Default is 1.
;fastcgi.script_path_encoded = 0

; Disable logging through FastCGI connection. PHP's default behavior is to enable
; this feature.
Expand Down
4 changes: 2 additions & 2 deletions sapi/fpm/fpm/fpm_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1435,7 +1435,7 @@ PHP_INI_BEGIN()
STD_PHP_INI_BOOLEAN("cgi.nph", "0", PHP_INI_ALL, OnUpdateBool, nph, php_cgi_globals_struct, php_cgi_globals)
STD_PHP_INI_BOOLEAN("cgi.fix_pathinfo", "1", PHP_INI_SYSTEM, OnUpdateBool, fix_pathinfo, php_cgi_globals_struct, php_cgi_globals)
STD_PHP_INI_BOOLEAN("cgi.discard_path", "0", PHP_INI_SYSTEM, OnUpdateBool, discard_path, php_cgi_globals_struct, php_cgi_globals)
STD_PHP_INI_BOOLEAN("fastcgi.script_path_encoded", "0", PHP_INI_SYSTEM, OnUpdateBool, fcgi_script_path_encoded, php_cgi_globals_struct, php_cgi_globals)
STD_PHP_INI_BOOLEAN("fastcgi.script_path_encoded", "1", PHP_INI_SYSTEM, OnUpdateBool, fcgi_script_path_encoded, php_cgi_globals_struct, php_cgi_globals)
STD_PHP_INI_BOOLEAN("fastcgi.logging", "1", PHP_INI_SYSTEM, OnUpdateBool, fcgi_logging, php_cgi_globals_struct, php_cgi_globals)
STD_PHP_INI_ENTRY("fastcgi.error_header", NULL, PHP_INI_SYSTEM, OnUpdateString, error_header, php_cgi_globals_struct, php_cgi_globals)
STD_PHP_INI_ENTRY("fpm.config", NULL, PHP_INI_SYSTEM, OnUpdateString, fpm_config, php_cgi_globals_struct, php_cgi_globals)
Expand All @@ -1448,7 +1448,7 @@ static void php_cgi_globals_ctor(php_cgi_globals_struct *php_cgi_globals)
php_cgi_globals->nph = 0;
php_cgi_globals->fix_pathinfo = 1;
php_cgi_globals->discard_path = 0;
php_cgi_globals->fcgi_script_path_encoded = 0;
php_cgi_globals->fcgi_script_path_encoded = 1;
php_cgi_globals->fcgi_logging = 1;
php_cgi_globals->fcgi_logging_request_started = false;
zend_hash_init(&php_cgi_globals->user_config_cache, 0, NULL, user_config_cache_entry_dtor, 1);
Expand Down
1 change: 1 addition & 0 deletions sapi/fpm/tests/fcgi-env-pif-apache-pp-sfp-decoding.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ pm.start_servers = 1
pm.min_spare_servers = 1
pm.max_spare_servers = 3
php_admin_value[cgi.fix_pathinfo] = yes
php_admin_value[fastcgi.script_path_encoded] = no
EOT;

$code = <<<EOT
Expand Down
3 changes: 1 addition & 2 deletions sapi/fpm/tests/fcgi-env-pif-apache-pp-sfp-encoded.phpt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--TEST--
FPM: FastCGI change for Apache ProxyPass SCRIPT_FILENAME decoding - fallback (GH-17645)
FPM: FastCGI change for Apache ProxyPass SCRIPT_FILENAME decoding - default (GH-17645)
--SKIPIF--
<?php include "skipif.inc"; ?>
--FILE--
Expand All @@ -18,7 +18,6 @@ pm.start_servers = 1
pm.min_spare_servers = 1
pm.max_spare_servers = 3
php_admin_value[cgi.fix_pathinfo] = yes
php_admin_value[fastcgi.script_path_encoded] = yes
EOT;

$code = <<<EOT
Expand Down