mirror of
https://github.com/php/php-src.git
synced 2024-11-30 13:25:43 +08:00
Merge branch 'PHP-8.2'
This commit is contained in:
commit
163c0b5f4c
@ -876,3 +876,23 @@ ZEND_API ZEND_INI_MH(OnUpdateStringUnempty) /* {{{ */
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API ZEND_INI_MH(OnUpdateStr) /* {{{ */
|
||||
{
|
||||
zend_string **p = (zend_string **) ZEND_INI_GET_ADDR();
|
||||
*p = new_value;
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API ZEND_INI_MH(OnUpdateStrNotEmpty) /* {{{ */
|
||||
{
|
||||
if (new_value && ZSTR_LEN(new_value) == 0) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
zend_string **p = (zend_string **) ZEND_INI_GET_ADDR();
|
||||
*p = new_value;
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
|
@ -209,8 +209,12 @@ ZEND_API ZEND_INI_MH(OnUpdateBool);
|
||||
ZEND_API ZEND_INI_MH(OnUpdateLong);
|
||||
ZEND_API ZEND_INI_MH(OnUpdateLongGEZero);
|
||||
ZEND_API ZEND_INI_MH(OnUpdateReal);
|
||||
/* char* versions */
|
||||
ZEND_API ZEND_INI_MH(OnUpdateString);
|
||||
ZEND_API ZEND_INI_MH(OnUpdateStringUnempty);
|
||||
/* zend_string* versions */
|
||||
ZEND_API ZEND_INI_MH(OnUpdateStr);
|
||||
ZEND_API ZEND_INI_MH(OnUpdateStrNotEmpty);
|
||||
END_EXTERN_C()
|
||||
|
||||
#define ZEND_INI_DISPLAY_ORIG 1
|
||||
|
@ -71,8 +71,8 @@ static const zend_function_entry php_dl_test_use_register_functions_directly_fun
|
||||
|
||||
/* {{{ INI */
|
||||
PHP_INI_BEGIN()
|
||||
STD_PHP_INI_BOOLEAN("dl_test.long", "0", PHP_INI_ALL, OnUpdateLong, long_value, zend_dl_test_globals, dl_test_globals)
|
||||
STD_PHP_INI_ENTRY("dl_test.string", "hello", PHP_INI_ALL, OnUpdateString, string_value, zend_dl_test_globals, dl_test_globals)
|
||||
STD_PHP_INI_ENTRY("dl_test.long", "0", PHP_INI_ALL, OnUpdateLong, long_value, zend_dl_test_globals, dl_test_globals)
|
||||
STD_PHP_INI_ENTRY("dl_test.string", "hello", PHP_INI_ALL, OnUpdateString, string_value, zend_dl_test_globals, dl_test_globals)
|
||||
PHP_INI_END()
|
||||
/* }}} */
|
||||
|
||||
|
@ -5179,7 +5179,7 @@ static ZEND_INI_DISP(zend_ffi_enable_displayer_cb) /* {{{ */
|
||||
/* }}} */
|
||||
|
||||
ZEND_INI_BEGIN()
|
||||
ZEND_INI_ENTRY3_EX("ffi.enable", "preload", ZEND_INI_SYSTEM, OnUpdateFFIEnable, NULL, NULL, NULL, zend_ffi_enable_displayer_cb)
|
||||
ZEND_INI_ENTRY_EX("ffi.enable", "preload", ZEND_INI_SYSTEM, OnUpdateFFIEnable, zend_ffi_enable_displayer_cb)
|
||||
STD_ZEND_INI_ENTRY("ffi.preload", NULL, ZEND_INI_SYSTEM, OnUpdateString, preload, zend_ffi_globals, ffi_globals)
|
||||
ZEND_INI_END()
|
||||
|
||||
|
@ -307,7 +307,7 @@ ZEND_GET_MODULE(gd)
|
||||
|
||||
/* {{{ PHP_INI_BEGIN */
|
||||
PHP_INI_BEGIN()
|
||||
PHP_INI_ENTRY("gd.jpeg_ignore_warning", "1", PHP_INI_ALL, NULL)
|
||||
PHP_INI_ENTRY_EX("gd.jpeg_ignore_warning", "1", PHP_INI_ALL, NULL, zend_ini_boolean_displayer_cb)
|
||||
PHP_INI_END()
|
||||
/* }}} */
|
||||
|
||||
|
@ -430,7 +430,7 @@ static const MYSQLND_REVERSE_API mysqli_reverse_api = {
|
||||
PHP_INI_BEGIN()
|
||||
STD_PHP_INI_ENTRY_EX("mysqli.max_links", "-1", PHP_INI_SYSTEM, OnUpdateLong, max_links, zend_mysqli_globals, mysqli_globals, display_link_numbers)
|
||||
STD_PHP_INI_ENTRY_EX("mysqli.max_persistent", "-1", PHP_INI_SYSTEM, OnUpdateLong, max_persistent, zend_mysqli_globals, mysqli_globals, display_link_numbers)
|
||||
STD_PHP_INI_BOOLEAN("mysqli.allow_persistent", "1", PHP_INI_SYSTEM, OnUpdateLong, allow_persistent, zend_mysqli_globals, mysqli_globals)
|
||||
STD_PHP_INI_BOOLEAN("mysqli.allow_persistent", "1", PHP_INI_SYSTEM, OnUpdateBool, allow_persistent, zend_mysqli_globals, mysqli_globals)
|
||||
STD_PHP_INI_BOOLEAN("mysqli.rollback_on_cached_plink", "0",PHP_INI_SYSTEM, OnUpdateBool, rollback_on_cached_plink, zend_mysqli_globals, mysqli_globals)
|
||||
STD_PHP_INI_ENTRY("mysqli.default_host", NULL, PHP_INI_ALL, OnUpdateString, default_host, zend_mysqli_globals, mysqli_globals)
|
||||
STD_PHP_INI_ENTRY("mysqli.default_user", NULL, PHP_INI_ALL, OnUpdateString, default_user, zend_mysqli_globals, mysqli_globals)
|
||||
@ -441,7 +441,7 @@ PHP_INI_BEGIN()
|
||||
#else
|
||||
STD_PHP_INI_ENTRY("mysqli.default_socket", NULL, PHP_INI_ALL, OnUpdateStringUnempty, default_socket, zend_mysqli_globals, mysqli_globals)
|
||||
#endif
|
||||
STD_PHP_INI_BOOLEAN("mysqli.allow_local_infile", "0", PHP_INI_SYSTEM, OnUpdateLong, allow_local_infile, zend_mysqli_globals, mysqli_globals)
|
||||
STD_PHP_INI_BOOLEAN("mysqli.allow_local_infile", "0", PHP_INI_SYSTEM, OnUpdateBool, allow_local_infile, zend_mysqli_globals, mysqli_globals)
|
||||
STD_PHP_INI_ENTRY("mysqli.local_infile_directory", NULL, PHP_INI_SYSTEM, OnUpdateString, local_infile_directory, zend_mysqli_globals, mysqli_globals)
|
||||
PHP_INI_END()
|
||||
/* }}} */
|
||||
|
@ -241,13 +241,13 @@ ZEND_BEGIN_MODULE_GLOBALS(mysqli)
|
||||
zend_long num_active_persistent;
|
||||
zend_long num_inactive_persistent;
|
||||
zend_long max_persistent;
|
||||
zend_long allow_persistent;
|
||||
bool allow_persistent;
|
||||
zend_ulong default_port;
|
||||
char *default_host;
|
||||
char *default_user;
|
||||
char *default_pw;
|
||||
char *default_socket;
|
||||
zend_long allow_local_infile;
|
||||
bool allow_local_infile;
|
||||
char *local_infile_directory;
|
||||
zend_long error_no;
|
||||
char *error_msg;
|
||||
|
@ -349,7 +349,7 @@ static PHP_INI_DISP(display_cursortype)
|
||||
|
||||
/* {{{ PHP_INI_BEGIN */
|
||||
PHP_INI_BEGIN()
|
||||
STD_PHP_INI_BOOLEAN("odbc.allow_persistent", "1", PHP_INI_SYSTEM, OnUpdateLong,
|
||||
STD_PHP_INI_BOOLEAN("odbc.allow_persistent", "1", PHP_INI_SYSTEM, OnUpdateBool,
|
||||
allow_persistent, zend_odbc_globals, odbc_globals)
|
||||
STD_PHP_INI_ENTRY_EX("odbc.max_persistent", "-1", PHP_INI_SYSTEM, OnUpdateLong,
|
||||
max_persistent, zend_odbc_globals, odbc_globals, display_link_nums)
|
||||
@ -365,7 +365,7 @@ PHP_INI_BEGIN()
|
||||
defaultlrl, zend_odbc_globals, odbc_globals, display_lrl)
|
||||
STD_PHP_INI_ENTRY_EX("odbc.defaultbinmode", "1", PHP_INI_ALL, OnUpdateLong,
|
||||
defaultbinmode, zend_odbc_globals, odbc_globals, display_binmode)
|
||||
STD_PHP_INI_BOOLEAN("odbc.check_persistent", "1", PHP_INI_SYSTEM, OnUpdateLong,
|
||||
STD_PHP_INI_BOOLEAN("odbc.check_persistent", "1", PHP_INI_SYSTEM, OnUpdateBool,
|
||||
check_persistent, zend_odbc_globals, odbc_globals)
|
||||
STD_PHP_INI_ENTRY_EX("odbc.default_cursortype", "3", PHP_INI_ALL, OnUpdateLong,
|
||||
default_cursortype, zend_odbc_globals, odbc_globals, display_cursortype)
|
||||
|
@ -228,8 +228,8 @@ ZEND_BEGIN_MODULE_GLOBALS(odbc)
|
||||
char *defDB;
|
||||
char *defUser;
|
||||
char *defPW;
|
||||
zend_long allow_persistent;
|
||||
zend_long check_persistent;
|
||||
bool allow_persistent;
|
||||
bool check_persistent;
|
||||
zend_long max_persistent;
|
||||
zend_long max_links;
|
||||
zend_long num_persistent;
|
||||
|
@ -369,7 +369,7 @@ PHP_INI_BEGIN()
|
||||
STD_PHP_INI_ENTRY("pcre.backtrack_limit", "1000000", PHP_INI_ALL, OnUpdateBacktrackLimit, backtrack_limit, zend_pcre_globals, pcre_globals)
|
||||
STD_PHP_INI_ENTRY("pcre.recursion_limit", "100000", PHP_INI_ALL, OnUpdateRecursionLimit, recursion_limit, zend_pcre_globals, pcre_globals)
|
||||
#ifdef HAVE_PCRE_JIT_SUPPORT
|
||||
STD_PHP_INI_ENTRY("pcre.jit", "1", PHP_INI_ALL, OnUpdateJit, jit, zend_pcre_globals, pcre_globals)
|
||||
STD_PHP_INI_BOOLEAN("pcre.jit", "1", PHP_INI_ALL, OnUpdateJit, jit, zend_pcre_globals, pcre_globals)
|
||||
#endif
|
||||
PHP_INI_END()
|
||||
|
||||
|
@ -782,12 +782,12 @@ PHP_INI_BEGIN()
|
||||
STD_PHP_INI_ENTRY("session.cookie_lifetime", "0", PHP_INI_ALL, OnUpdateCookieLifetime,cookie_lifetime, php_ps_globals, ps_globals)
|
||||
STD_PHP_INI_ENTRY("session.cookie_path", "/", PHP_INI_ALL, OnUpdateSessionString, cookie_path, php_ps_globals, ps_globals)
|
||||
STD_PHP_INI_ENTRY("session.cookie_domain", "", PHP_INI_ALL, OnUpdateSessionString, cookie_domain, php_ps_globals, ps_globals)
|
||||
STD_PHP_INI_ENTRY("session.cookie_secure", "0", PHP_INI_ALL, OnUpdateSessionBool, cookie_secure, php_ps_globals, ps_globals)
|
||||
STD_PHP_INI_ENTRY("session.cookie_httponly", "0", PHP_INI_ALL, OnUpdateSessionBool, cookie_httponly, php_ps_globals, ps_globals)
|
||||
STD_PHP_INI_BOOLEAN("session.cookie_secure", "0", PHP_INI_ALL, OnUpdateSessionBool, cookie_secure, php_ps_globals, ps_globals)
|
||||
STD_PHP_INI_BOOLEAN("session.cookie_httponly", "0", PHP_INI_ALL, OnUpdateSessionBool, cookie_httponly, php_ps_globals, ps_globals)
|
||||
STD_PHP_INI_ENTRY("session.cookie_samesite", "", PHP_INI_ALL, OnUpdateSessionString, cookie_samesite, php_ps_globals, ps_globals)
|
||||
STD_PHP_INI_ENTRY("session.use_cookies", "1", PHP_INI_ALL, OnUpdateSessionBool, use_cookies, php_ps_globals, ps_globals)
|
||||
STD_PHP_INI_ENTRY("session.use_only_cookies", "1", PHP_INI_ALL, OnUpdateSessionBool, use_only_cookies, php_ps_globals, ps_globals)
|
||||
STD_PHP_INI_ENTRY("session.use_strict_mode", "0", PHP_INI_ALL, OnUpdateSessionBool, use_strict_mode, php_ps_globals, ps_globals)
|
||||
STD_PHP_INI_BOOLEAN("session.use_cookies", "1", PHP_INI_ALL, OnUpdateSessionBool, use_cookies, php_ps_globals, ps_globals)
|
||||
STD_PHP_INI_BOOLEAN("session.use_only_cookies", "1", PHP_INI_ALL, OnUpdateSessionBool, use_only_cookies, php_ps_globals, ps_globals)
|
||||
STD_PHP_INI_BOOLEAN("session.use_strict_mode", "0", PHP_INI_ALL, OnUpdateSessionBool, use_strict_mode, php_ps_globals, ps_globals)
|
||||
STD_PHP_INI_ENTRY("session.referer_check", "", PHP_INI_ALL, OnUpdateSessionString, extern_referer_chk, php_ps_globals, ps_globals)
|
||||
STD_PHP_INI_ENTRY("session.cache_limiter", "nocache", PHP_INI_ALL, OnUpdateSessionString, cache_limiter, php_ps_globals, ps_globals)
|
||||
STD_PHP_INI_ENTRY("session.cache_expire", "180", PHP_INI_ALL, OnUpdateSessionLong, cache_expire, php_ps_globals, ps_globals)
|
||||
|
@ -168,7 +168,7 @@ ZEND_DECLARE_MODULE_GLOBALS(tidy)
|
||||
|
||||
PHP_INI_BEGIN()
|
||||
STD_PHP_INI_ENTRY("tidy.default_config", "", PHP_INI_SYSTEM, OnUpdateString, default_config, zend_tidy_globals, tidy_globals)
|
||||
STD_PHP_INI_ENTRY("tidy.clean_output", "0", PHP_INI_USER, php_tidy_set_clean_output, clean_output, zend_tidy_globals, tidy_globals)
|
||||
STD_PHP_INI_BOOLEAN("tidy.clean_output", "0", PHP_INI_USER, php_tidy_set_clean_output, clean_output, zend_tidy_globals, tidy_globals)
|
||||
PHP_INI_END()
|
||||
|
||||
static zend_class_entry *tidy_ce_doc, *tidy_ce_node;
|
||||
|
@ -55,6 +55,8 @@ ZEND_BEGIN_MODULE_GLOBALS(zend_test)
|
||||
bool print_stderr_mshutdown;
|
||||
zend_test_fiber *active_fiber;
|
||||
zend_long quantity_value;
|
||||
zend_string *str_test;
|
||||
zend_string *not_empty_str_test;
|
||||
ZEND_END_MODULE_GLOBALS(zend_test)
|
||||
|
||||
extern ZEND_DECLARE_MODULE_GLOBALS(zend_test)
|
||||
|
@ -415,6 +415,13 @@ static ZEND_FUNCTION(zend_test_zend_ini_parse_uquantity)
|
||||
}
|
||||
}
|
||||
|
||||
static ZEND_FUNCTION(zend_test_zend_ini_str)
|
||||
{
|
||||
ZEND_PARSE_PARAMETERS_NONE();
|
||||
|
||||
RETURN_STR(ZT_G(str_test));
|
||||
}
|
||||
|
||||
static ZEND_FUNCTION(ZendTestNS2_namespaced_func)
|
||||
{
|
||||
ZEND_PARSE_PARAMETERS_NONE();
|
||||
@ -632,6 +639,8 @@ PHP_INI_BEGIN()
|
||||
STD_PHP_INI_BOOLEAN("zend_test.register_passes", "0", PHP_INI_SYSTEM, OnUpdateBool, register_passes, zend_zend_test_globals, zend_test_globals)
|
||||
STD_PHP_INI_BOOLEAN("zend_test.print_stderr_mshutdown", "0", PHP_INI_SYSTEM, OnUpdateBool, print_stderr_mshutdown, zend_zend_test_globals, zend_test_globals)
|
||||
STD_PHP_INI_ENTRY("zend_test.quantity_value", "0", PHP_INI_ALL, OnUpdateLong, quantity_value, zend_zend_test_globals, zend_test_globals)
|
||||
STD_PHP_INI_ENTRY("zend_test.str_test", "", PHP_INI_ALL, OnUpdateStr, str_test, zend_zend_test_globals, zend_test_globals)
|
||||
STD_PHP_INI_ENTRY("zend_test.not_empty_str_test", "val", PHP_INI_ALL, OnUpdateStrNotEmpty, not_empty_str_test, zend_zend_test_globals, zend_test_globals)
|
||||
PHP_INI_END()
|
||||
|
||||
void (*old_zend_execute_ex)(zend_execute_data *execute_data);
|
||||
|
@ -152,6 +152,8 @@ namespace {
|
||||
|
||||
function zend_test_zend_ini_parse_quantity(string $str): int {}
|
||||
function zend_test_zend_ini_parse_uquantity(string $str): int {}
|
||||
|
||||
function zend_test_zend_ini_str(): string {}
|
||||
}
|
||||
|
||||
namespace ZendTestNS {
|
||||
|
6
ext/zend_test/test_arginfo.h
generated
6
ext/zend_test/test_arginfo.h
generated
@ -1,5 +1,5 @@
|
||||
/* This is a generated file, edit the .stub.php file instead.
|
||||
* Stub hash: 05927aba1708d8718cb59dcadc7b4067323956d2 */
|
||||
* Stub hash: d8c0689141c897c3f31d00550128df7b8c00274f */
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zend_test_array_return, 0, 0, IS_ARRAY, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
@ -95,6 +95,8 @@ ZEND_END_ARG_INFO()
|
||||
|
||||
#define arginfo_zend_test_zend_ini_parse_uquantity arginfo_zend_test_zend_ini_parse_quantity
|
||||
|
||||
#define arginfo_zend_test_zend_ini_str arginfo_zend_get_current_func_name
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ZendTestNS2_namespaced_func, 0, 0, _IS_BOOL, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
@ -180,6 +182,7 @@ static ZEND_FUNCTION(zend_get_current_func_name);
|
||||
static ZEND_FUNCTION(zend_call_method);
|
||||
static ZEND_FUNCTION(zend_test_zend_ini_parse_quantity);
|
||||
static ZEND_FUNCTION(zend_test_zend_ini_parse_uquantity);
|
||||
static ZEND_FUNCTION(zend_test_zend_ini_str);
|
||||
static ZEND_FUNCTION(ZendTestNS2_namespaced_func);
|
||||
static ZEND_FUNCTION(ZendTestNS2_namespaced_deprecated_func);
|
||||
static ZEND_FUNCTION(ZendTestNS2_ZendSubNS_namespaced_func);
|
||||
@ -228,6 +231,7 @@ static const zend_function_entry ext_functions[] = {
|
||||
ZEND_FE(zend_call_method, arginfo_zend_call_method)
|
||||
ZEND_FE(zend_test_zend_ini_parse_quantity, arginfo_zend_test_zend_ini_parse_quantity)
|
||||
ZEND_FE(zend_test_zend_ini_parse_uquantity, arginfo_zend_test_zend_ini_parse_uquantity)
|
||||
ZEND_FE(zend_test_zend_ini_str, arginfo_zend_test_zend_ini_str)
|
||||
ZEND_NS_FALIAS("ZendTestNS2", namespaced_func, ZendTestNS2_namespaced_func, arginfo_ZendTestNS2_namespaced_func)
|
||||
ZEND_NS_DEP_FALIAS("ZendTestNS2", namespaced_deprecated_func, ZendTestNS2_namespaced_deprecated_func, arginfo_ZendTestNS2_namespaced_deprecated_func)
|
||||
ZEND_NS_FALIAS("ZendTestNS2", namespaced_aliased_func, zend_test_void_return, arginfo_ZendTestNS2_namespaced_aliased_func)
|
||||
|
33
ext/zend_test/tests/zend_ini_str_validator_basic.phpt
Normal file
33
ext/zend_test/tests/zend_ini_str_validator_basic.phpt
Normal file
@ -0,0 +1,33 @@
|
||||
--TEST--
|
||||
Test OnUpdateStr and OnUpdateStrNotEmpty validators.
|
||||
--EXTENSIONS--
|
||||
zend_test
|
||||
--FILE--
|
||||
<?php
|
||||
echo 'str_test INI', PHP_EOL;
|
||||
var_dump(ini_get("zend_test.str_test"));
|
||||
var_dump(ini_set("zend_test.str_test", "Test"));
|
||||
var_dump(ini_get("zend_test.str_test"));
|
||||
var_dump(ini_set("zend_test.str_test", ""));
|
||||
var_dump(ini_get("zend_test.str_test"));
|
||||
|
||||
echo 'not_empty_str_test INI', PHP_EOL;
|
||||
var_dump(ini_get("zend_test.not_empty_str_test"));
|
||||
var_dump(ini_set("zend_test.not_empty_str_test", "Test"));
|
||||
var_dump(ini_get("zend_test.not_empty_str_test"));
|
||||
var_dump(ini_set("zend_test.not_empty_str_test", ""));
|
||||
var_dump(ini_get("zend_test.not_empty_str_test"));
|
||||
?>
|
||||
--EXPECT--
|
||||
str_test INI
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
string(4) "Test"
|
||||
string(4) "Test"
|
||||
string(0) ""
|
||||
not_empty_str_test INI
|
||||
string(3) "val"
|
||||
string(3) "val"
|
||||
string(4) "Test"
|
||||
bool(false)
|
||||
string(4) "Test"
|
@ -0,0 +1,10 @@
|
||||
--TEST--
|
||||
Test zend_test_zend_ini_str() to check for GC refcount on global returned
|
||||
--EXTENSIONS--
|
||||
zend_test
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(zend_test_zend_ini_str());
|
||||
?>
|
||||
--EXPECT--
|
||||
string(0) ""
|
Loading…
Reference in New Issue
Block a user