diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index ce4b4e3b7fd52..2eee6a01caf7e 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -2014,12 +2014,12 @@ ZEND_API void zend_activate_auto_globals(void) /* {{{ */ zend_auto_global *auto_global; ZEND_HASH_MAP_FOREACH_PTR(CG(auto_globals), auto_global) { - if (auto_global->jit) { - auto_global->armed = 1; - } else if (auto_global->auto_global_callback) { + auto_global->armed = auto_global->jit || auto_global->auto_global_callback; + } ZEND_HASH_FOREACH_END(); + + ZEND_HASH_MAP_FOREACH_PTR(CG(auto_globals), auto_global) { + if (auto_global->armed && !auto_global->jit) { auto_global->armed = auto_global->auto_global_callback(auto_global->name); - } else { - auto_global->armed = 0; } } ZEND_HASH_FOREACH_END(); } diff --git a/ext/curl/interface.c b/ext/curl/interface.c index 27a98066890c5..5f69beac8e936 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -1641,7 +1641,7 @@ static zend_result _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue lval = zval_get_long(zvalue); if (lval == 1) { php_error_docref(NULL, E_NOTICE, "CURLOPT_SSL_VERIFYHOST no longer accepts the value 1, value 2 will be used instead"); - error = curl_easy_setopt(ch->cp, option, 2); + error = curl_easy_setopt(ch->cp, option, 2L); break; } ZEND_FALLTHROUGH; diff --git a/ext/ext_skel.php b/ext/ext_skel.php index cd82abb34697a..d396dfa3da749 100755 --- a/ext/ext_skel.php +++ b/ext/ext_skel.php @@ -42,7 +42,7 @@ function print_help() { Very simple. First, change to the ext/ directory of the PHP sources. Then run the following - php ext_skel.php --ext extension_name + php ext_skel.php --ext extension_name --vendor vendor_name and everything you need will be placed in directory ext/extension_name. @@ -90,11 +90,12 @@ functions strictly needed by others. Exposed internal function must be named OPTIONS - php ext_skel.php --ext [--experimental] [--author ] - [--dir ] [--std] [--onlyunix] - [--onlywindows] [--help] + php ext_skel.php --ext --vendor [--experimental] + [--author ] [--dir ] [--std] + [--onlyunix] [--onlywindows] [--help] --ext The name of the extension defined as + --vendor The vendor of the extension for Packagist --experimental Passed if this extension is experimental, this creates the EXPERIMENTAL file in the root of the extension --author Your name, this is used if --std is passed and for the @@ -147,6 +148,7 @@ function process_args($argv, $argc) { 'unix' => true, 'windows' => true, 'ext' => '', + 'vendor' => '', 'dir' => __DIR__ . DIRECTORY_SEPARATOR, 'skel' => __DIR__ . DIRECTORY_SEPARATOR . 'skeleton' . DIRECTORY_SEPARATOR, 'author' => false, @@ -185,6 +187,7 @@ function process_args($argv, $argc) { } break; case 'ext': + case 'vendor': case 'dir': case 'author': { if (!isset($argv[$i + 1]) || ($argv[$i + 1][0] == '-' && $argv[$i + 1][1] == '-')) { @@ -204,6 +207,8 @@ function process_args($argv, $argc) { if (empty($options['ext'])) { error('No extension name passed, use "--ext "'); + } else if (empty($options['vendor'])) { + error('No vendor name passed, use "--vendor "'); } else if (!$options['unix'] && !$options['windows']) { error('Cannot pass both --onlyunix and --onlywindows'); } else if (!is_dir($options['skel'])) { @@ -217,6 +222,12 @@ function process_args($argv, $argc) { .' Using only lower case letters is preferred.'); } + // Validate vendor + if (!preg_match('/^[a-z][a-z0-9_-]+$/i', $options['vendor'])) { + error('Invalid vendor name. Valid names start with a letter,' + .' followed by any number of letters, numbers, hypens, or underscores.'); + } + $options['ext'] = str_replace(['\\', '/'], '', strtolower($options['ext'])); return $options; @@ -231,6 +242,7 @@ function process_source_tags($file, $short_name) { error('Unable to open file for reading: ' . $short_name); } + $source = str_replace('%VENDORNAME%', $options['vendor'], $source); $source = str_replace('%EXTNAME%', $options['ext'], $source); $source = str_replace('%EXTNAMECAPS%', strtoupper($options['ext']), $source); @@ -290,6 +302,7 @@ function copy_config_scripts() { } $files[] = '.gitignore'; + $files[] = 'composer.json'; foreach($files as $config_script) { $new_config_script = $options['dir'] . $options['ext'] . DIRECTORY_SEPARATOR . $config_script; diff --git a/ext/skeleton/composer.json.in b/ext/skeleton/composer.json.in new file mode 100644 index 0000000000000..8f12bdee475ba --- /dev/null +++ b/ext/skeleton/composer.json.in @@ -0,0 +1,19 @@ +{ + "name": "%VENDORNAME%/%EXTNAME%", + "type": "php-ext", + "license": "BSD-3-Clause", + "description": "Describe your extension here", + "require": { + "php": "^8.3" + }, + "php-ext": { + "extension-name": "%EXTNAME%", + "configure-options": [ + { + "name": "enable-%EXTNAME%", + "needs-value": false, + "description": "whether to enable %EXTNAME% support" + } + ] + } +} diff --git a/sapi/cgi/tests/auto_globals_no_jit.phpt b/sapi/cgi/tests/auto_globals_no_jit.phpt new file mode 100644 index 0000000000000..e331709db6db8 --- /dev/null +++ b/sapi/cgi/tests/auto_globals_no_jit.phpt @@ -0,0 +1,17 @@ +--TEST-- +CGI with auto_globals_jit=0 +--INI-- +auto_globals_jit=0 +--CGI-- +--ENV-- +FOO=BAR +--FILE-- + +--EXPECT-- +string(3) "BAR" +string(3) "BAR" +string(3) "BAR" diff --git a/sapi/cli/tests/php_cli_server_pdeathsig.phpt b/sapi/cli/tests/php_cli_server_pdeathsig.phpt index 8b70bbcad4927..66a76a84ccaf6 100644 --- a/sapi/cli/tests/php_cli_server_pdeathsig.phpt +++ b/sapi/cli/tests/php_cli_server_pdeathsig.phpt @@ -9,6 +9,7 @@ if (!(str_contains(PHP_OS, 'Linux') || str_contains(PHP_OS, 'FreeBSD'))) { die('skip PDEATHSIG is only supported on Linux and FreeBSD'); } if (@file_exists('/.dockerenv')) die("skip Broken in Docker"); +if (!shell_exec("which pgrep")) die("skip Missing pgrep command"); ?> --FILE--