diff --git a/NEWS b/NEWS index a021293adc163..b00a1aad56be8 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,13 @@ PHP NEWS been deprecated, as it no longer has any effect since PHP 8.0. (Girgias) . Terminating case statements with a semicolon instead of a colon has been deprecated. (theodorejb) + . The backtick operator as an alias for shell_exec() has been deprecated. + (timwolla) + . Returning null from __debugInfo() has been deprecated. (DanielEScherzer) + +- Date: + . The DATE_RFC7231 and DateTimeInterface::RFC7231 constants have been + deprecated. (jorgsowa) - DOM: . Fixed bug GH-18877 (\Dom\HTMLDocument querySelectorAll selecting only the diff --git a/UPGRADING b/UPGRADING index 1d5b2b8ede499..96ed8fee7d974 100644 --- a/UPGRADING +++ b/UPGRADING @@ -328,6 +328,17 @@ PHP 8.5 UPGRADE NOTES . Terminating case statements with a semicolon instead of a colon has been deprecated. RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_semicolon_after_case_in_switch_statement + . The backtick operator as an alias for shell_exec() has been deprecated. + RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_backticks_as_an_alias_for_shell_exec + . Returning null from __debugInfo() has been deprecated. + Return an empty array instead. + RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_debuginfo_returning_null + +- Date: + . The DATE_RFC7231 and DateTimeInterface::RFC7231 constants have been + deprecated. This is because the associated timezone is ignored and always + uses GMT. + RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_date_rfc7231_and_datetimeinterfacerfc7231 - FileInfo: . The finfo_close() function has been deprecated. diff --git a/Zend/Optimizer/block_pass.c b/Zend/Optimizer/block_pass.c index 96a0e81f03825..275c519d431be 100644 --- a/Zend/Optimizer/block_pass.c +++ b/Zend/Optimizer/block_pass.c @@ -420,6 +420,14 @@ static void zend_optimize_block(zend_basic_block *block, zend_op_array *op_array } break; + case ZEND_EXT_STMT: + if (opline->op1_type & (IS_TMP_VAR|IS_VAR)) { + /* Variable will be deleted later by FREE, so we can't optimize it */ + Tsource[VAR_NUM(opline->op1.var)] = NULL; + break; + } + break; + case ZEND_CASE: case ZEND_CASE_STRICT: case ZEND_COPY_TMP: diff --git a/Zend/tests/bug40236.phpt b/Zend/tests/bug40236.phpt index 7ed298c1eed66..5fb3fddc573db 100644 --- a/Zend/tests/bug40236.phpt +++ b/Zend/tests/bug40236.phpt @@ -8,7 +8,7 @@ if (extension_loaded("readline")) die("skip Test doesn't support readline"); --EXPECT-- Interactive shell (-a) requires the readline extension. diff --git a/Zend/tests/bug55509.phpt b/Zend/tests/bug55509.phpt index b45150a4979ef..942df09bc0f91 100644 --- a/Zend/tests/bug55509.phpt +++ b/Zend/tests/bug55509.phpt @@ -28,7 +28,7 @@ if (PHP_OS == 'Linux') { } } elseif (PHP_OS == 'FreeBSD') { - $lines = explode("\n",`sysctl -a`); + $lines = explode("\n", shell_exec("sysctl -a")); $infos = array(); foreach ($lines as $line) { if (!$line){ diff --git a/Zend/tests/bug64677.phpt b/Zend/tests/bug64677.phpt index c3b168bd83b51..4995602e00124 100644 --- a/Zend/tests/bug64677.phpt +++ b/Zend/tests/bug64677.phpt @@ -17,5 +17,12 @@ function show_outputa($prepend, $output) { show_outputa('Files: ', `cd .`); // this works as expected ?> ---EXPECT-- +--EXPECTF-- +Deprecated: The backtick (`) operator is deprecated, use shell_exec() instead in %s on line %d + +Deprecated: The backtick (`) operator is deprecated, use shell_exec() instead in %s on line %d + +Deprecated: The backtick (`) operator is deprecated, use shell_exec() instead in %s on line %d + +Deprecated: The backtick (`) operator is deprecated, use shell_exec() instead in %s on line %d Okey diff --git a/Zend/tests/debug_info/debug_info.phpt b/Zend/tests/debug_info/debug_info.phpt index 6f559eb40b7a9..bff5876777ba2 100644 --- a/Zend/tests/debug_info/debug_info.phpt +++ b/Zend/tests/debug_info/debug_info.phpt @@ -36,5 +36,7 @@ object(Foo)#%d (3) { ["c":"Foo":private]=> int(3) } + +Deprecated: Returning null from Bar::__debugInfo() is deprecated, return an empty array instead in %s on line %d object(Bar)#%d (0) { } diff --git a/Zend/tests/debug_info/recursion_return_null.phpt b/Zend/tests/debug_info/recursion_return_null.phpt new file mode 100644 index 0000000000000..b6ca9c824cb72 --- /dev/null +++ b/Zend/tests/debug_info/recursion_return_null.phpt @@ -0,0 +1,31 @@ +--TEST-- +Testing __debugInfo() magic method +--FILE-- + +--EXPECTF-- +in handler + +Deprecated: Returning null from Foo::__debugInfo() is deprecated, return an empty array instead in %s on line %d +object(Foo)#3 (0) { +} +object(Foo)#2 (0) { +} diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 11fa2e740cb7e..8ac140cdceffc 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -3770,7 +3770,7 @@ static zend_always_inline zend_class_entry *get_scope(zend_execute_data *frame) static bool zend_is_callable_check_class(zend_string *name, zend_class_entry *scope, zend_execute_data *frame, zend_fcall_info_cache *fcc, bool *strict_class, char **error, bool suppress_deprecation) /* {{{ */ { - bool ret = 0; + bool ret = false; zend_class_entry *ce; size_t name_len = ZSTR_LEN(name); zend_string *lcname; @@ -3795,7 +3795,7 @@ static bool zend_is_callable_check_class(zend_string *name, zend_class_entry *sc if (!fcc->object) { fcc->object = zend_get_this_object(frame); } - ret = 1; + ret = true; } } else if (zend_string_equals(lcname, ZSTR_KNOWN(ZEND_STR_PARENT))) { if (!scope) { @@ -3815,7 +3815,7 @@ static bool zend_is_callable_check_class(zend_string *name, zend_class_entry *sc fcc->object = zend_get_this_object(frame); } *strict_class = 1; - ret = 1; + ret = true; } } else if (zend_string_equals(lcname, ZSTR_KNOWN(ZEND_STR_STATIC))) { zend_class_entry *called_scope = zend_get_called_scope(frame); @@ -3832,7 +3832,7 @@ static bool zend_is_callable_check_class(zend_string *name, zend_class_entry *sc fcc->object = zend_get_this_object(frame); } *strict_class = 1; - ret = 1; + ret = true; } } else if ((ce = zend_lookup_class(name)) != NULL) { zend_class_entry *scope = get_scope(frame); @@ -3852,7 +3852,7 @@ static bool zend_is_callable_check_class(zend_string *name, zend_class_entry *sc fcc->called_scope = fcc->object ? fcc->object->ce : ce; } *strict_class = 1; - ret = 1; + ret = true; } else { if (error) zend_spprintf(error, 0, "class \"%.*s\" not found", (int)name_len, ZSTR_VAL(name)); } diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 5527f55a25c29..dd9b5e1f202ad 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -821,7 +821,8 @@ static void zend_do_free(znode *op1) /* {{{ */ } else { while (opline >= CG(active_op_array)->opcodes) { if ((opline->opcode == ZEND_FETCH_LIST_R || - opline->opcode == ZEND_FETCH_LIST_W) && + opline->opcode == ZEND_FETCH_LIST_W || + opline->opcode == ZEND_EXT_STMT) && opline->op1_type == IS_VAR && opline->op1.var == op1->u.op.var) { zend_emit_op(NULL, ZEND_FREE, op1, NULL); @@ -1920,7 +1921,7 @@ static void zend_add_to_list(void *result, void *item) /* {{{ */ } /* }}} */ -static void zend_do_extended_stmt(void) /* {{{ */ +static void zend_do_extended_stmt(znode* result) /* {{{ */ { zend_op *opline; @@ -1931,6 +1932,9 @@ static void zend_do_extended_stmt(void) /* {{{ */ opline = get_next_op(); opline->opcode = ZEND_EXT_STMT; + if (result) { + SET_NODE(opline->op1, result); + } } /* }}} */ @@ -6050,7 +6054,7 @@ static void zend_compile_for(zend_ast *ast) /* {{{ */ zend_update_jump_target_to_next(opnum_jmp); zend_compile_for_expr_list(&result, cond_ast); - zend_do_extended_stmt(); + zend_do_extended_stmt(NULL); zend_emit_cond_jump(ZEND_JMPNZ, &result, opnum_start); @@ -6171,7 +6175,7 @@ static void zend_compile_if(zend_ast *ast) /* {{{ */ if (i > 0) { CG(zend_lineno) = cond_ast->lineno; - zend_do_extended_stmt(); + zend_do_extended_stmt(NULL); } zend_compile_expr(&cond_node, cond_ast); @@ -6505,6 +6509,8 @@ static void zend_compile_pipe(znode *result, zend_ast *ast) } zend_compile_expr(result, fcall_ast); + CG(zend_lineno) = fcall_ast->lineno; + zend_do_extended_stmt(result); } static void zend_compile_match(znode *result, zend_ast *ast) @@ -8537,7 +8543,7 @@ static zend_op_array *zend_compile_func_decl_ex( /* put the implicit return on the really last line */ CG(zend_lineno) = decl->end_lineno; - zend_do_extended_stmt(); + zend_do_extended_stmt(NULL); zend_emit_final_return(0); pass_two(CG(active_op_array)); @@ -10841,6 +10847,8 @@ static void zend_compile_shell_exec(znode *result, zend_ast *ast) /* {{{ */ zval fn_name; zend_ast *name_ast, *args_ast, *call_ast; + zend_error(E_DEPRECATED, "The backtick (`) operator is deprecated, use shell_exec() instead"); + ZVAL_STRING(&fn_name, "shell_exec"); name_ast = zend_ast_create_zval(&fn_name); args_ast = zend_ast_create_list(1, ZEND_AST_ARG_LIST, expr_ast); @@ -11607,7 +11615,7 @@ static void zend_compile_stmt(zend_ast *ast) /* {{{ */ CG(zend_lineno) = ast->lineno; if ((CG(compiler_options) & ZEND_COMPILE_EXTENDED_STMT) && !zend_is_unticked_stmt(ast)) { - zend_do_extended_stmt(); + zend_do_extended_stmt(NULL); } switch (ast->kind) { diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index a3f852abc80ff..cca69e5d792c9 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -223,6 +223,8 @@ ZEND_API HashTable *zend_std_get_debug_info(zend_object *object, int *is_temp) / return Z_ARRVAL(retval); } } else if (Z_TYPE(retval) == IS_NULL) { + zend_error(E_DEPRECATED, "Returning null from %s::__debugInfo() is deprecated, return an empty array instead", + ZSTR_VAL(ce->name)); *is_temp = 1; ht = zend_new_array(0); return ht; diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c index 01f6d924d28f6..f3631104c62c3 100644 --- a/Zend/zend_opcode.c +++ b/Zend/zend_opcode.c @@ -903,7 +903,8 @@ static bool keeps_op1_alive(zend_op *opline) { || opline->opcode == ZEND_MATCH_ERROR || opline->opcode == ZEND_FETCH_LIST_R || opline->opcode == ZEND_FETCH_LIST_W - || opline->opcode == ZEND_COPY_TMP) { + || opline->opcode == ZEND_COPY_TMP + || opline->opcode == ZEND_EXT_STMT) { return 1; } ZEND_ASSERT(opline->opcode != ZEND_FE_FETCH_R diff --git a/ext/date/php_date.stub.php b/ext/date/php_date.stub.php index 4f77fc9223e27..6eef828b813e8 100644 --- a/ext/date/php_date.stub.php +++ b/ext/date/php_date.stub.php @@ -54,6 +54,7 @@ * @var string * @cvalue DATE_FORMAT_RFC7231 */ +#[\Deprecated(since: '8.5', message: "as this format ignores the associated timezone and always uses GMT")] const DATE_RFC7231 = "D, d M Y H:i:s \\G\\M\\T"; /** @@ -287,7 +288,6 @@ function date_sun_info(int $timestamp, float $latitude, float $longitude): array interface DateTimeInterface { - public const string ATOM = DATE_ATOM; public const string COOKIE = DATE_COOKIE; @@ -304,6 +304,7 @@ interface DateTimeInterface public const string RFC1123 = DATE_RFC1123; + #[\Deprecated(since: '8.5', message: "as this format ignores the associated timezone and always uses GMT")] public const string RFC7231 = DATE_RFC7231; public const string RFC2822 = DATE_RFC2822; diff --git a/ext/date/php_date_arginfo.h b/ext/date/php_date_arginfo.h index c041d0b241dc4..07a4398ef1cac 100644 --- a/ext/date/php_date_arginfo.h +++ b/ext/date/php_date_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: c9dba59a68085579d18948963a979d63eecff204 */ + * Stub hash: db70e6a06d177d2cb6e4a47379c0b761b248f380 */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_strtotime, 0, 1, MAY_BE_LONG|MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, datetime, IS_STRING, 0) @@ -798,7 +798,7 @@ static void register_php_date_symbols(int module_number) ZEND_ASSERT(strcmp(DATE_FORMAT_RFC1036, "D, d M y H:i:s O") == 0); REGISTER_STRING_CONSTANT("DATE_RFC1123", DATE_FORMAT_RFC1123, CONST_PERSISTENT); ZEND_ASSERT(strcmp(DATE_FORMAT_RFC1123, "D, d M Y H:i:s O") == 0); - REGISTER_STRING_CONSTANT("DATE_RFC7231", DATE_FORMAT_RFC7231, CONST_PERSISTENT); + zend_constant *const_DATE_RFC7231 = REGISTER_STRING_CONSTANT("DATE_RFC7231", DATE_FORMAT_RFC7231, CONST_PERSISTENT | CONST_DEPRECATED); ZEND_ASSERT(strcmp(DATE_FORMAT_RFC7231, "D, d M Y H:i:s \\G\\M\\T") == 0); REGISTER_STRING_CONSTANT("DATE_RFC2822", DATE_FORMAT_RFC2822, CONST_PERSISTENT); ZEND_ASSERT(strcmp(DATE_FORMAT_RFC2822, "D, d M Y H:i:s O") == 0); @@ -839,6 +839,13 @@ static void register_php_date_symbols(int module_number) ZVAL_STR_COPY(&attribute_Deprecated_func_date_sunset_0->args[1].value, attribute_Deprecated_func_date_sunrise_0_arg1_str); attribute_Deprecated_func_date_sunset_0->args[1].name = ZSTR_KNOWN(ZEND_STR_MESSAGE); + zend_attribute *attribute_Deprecated_const_DATE_RFC7231_0 = zend_add_global_constant_attribute(const_DATE_RFC7231, ZSTR_KNOWN(ZEND_STR_DEPRECATED_CAPITALIZED), 2); + ZVAL_STR(&attribute_Deprecated_const_DATE_RFC7231_0->args[0].value, ZSTR_KNOWN(ZEND_STR_8_DOT_5)); + attribute_Deprecated_const_DATE_RFC7231_0->args[0].name = ZSTR_KNOWN(ZEND_STR_SINCE); + zend_string *attribute_Deprecated_const_DATE_RFC7231_0_arg1_str = zend_string_init("as this format ignores the associated timezone and always uses GMT", strlen("as this format ignores the associated timezone and always uses GMT"), 1); + ZVAL_STR(&attribute_Deprecated_const_DATE_RFC7231_0->args[1].value, attribute_Deprecated_const_DATE_RFC7231_0_arg1_str); + attribute_Deprecated_const_DATE_RFC7231_0->args[1].name = ZSTR_KNOWN(ZEND_STR_MESSAGE); + zend_attribute *attribute_Deprecated_const_SUNFUNCS_RET_TIMESTAMP_0 = zend_add_global_constant_attribute(const_SUNFUNCS_RET_TIMESTAMP, ZSTR_KNOWN(ZEND_STR_DEPRECATED_CAPITALIZED), 2); ZVAL_STR(&attribute_Deprecated_const_SUNFUNCS_RET_TIMESTAMP_0->args[0].value, ZSTR_KNOWN(ZEND_STR_8_DOT_4)); attribute_Deprecated_const_SUNFUNCS_RET_TIMESTAMP_0->args[0].name = ZSTR_KNOWN(ZEND_STR_SINCE); @@ -926,7 +933,7 @@ static zend_class_entry *register_class_DateTimeInterface(void) zend_string *const_RFC7231_value_str = zend_string_init(DATE_FORMAT_RFC7231, strlen(DATE_FORMAT_RFC7231), 1); ZVAL_STR(&const_RFC7231_value, const_RFC7231_value_str); zend_string *const_RFC7231_name = zend_string_init_interned("RFC7231", sizeof("RFC7231") - 1, 1); - zend_declare_typed_class_constant(class_entry, const_RFC7231_name, &const_RFC7231_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING)); + zend_class_constant *const_RFC7231 = zend_declare_typed_class_constant(class_entry, const_RFC7231_name, &const_RFC7231_value, ZEND_ACC_PUBLIC|ZEND_ACC_DEPRECATED, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING)); zend_string_release(const_RFC7231_name); zval const_RFC2822_value; @@ -964,6 +971,14 @@ static zend_class_entry *register_class_DateTimeInterface(void) zend_declare_typed_class_constant(class_entry, const_W3C_name, &const_W3C_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING)); zend_string_release(const_W3C_name); + + zend_attribute *attribute_Deprecated_const_RFC7231_0 = zend_add_class_constant_attribute(class_entry, const_RFC7231, ZSTR_KNOWN(ZEND_STR_DEPRECATED_CAPITALIZED), 2); + ZVAL_STR(&attribute_Deprecated_const_RFC7231_0->args[0].value, ZSTR_KNOWN(ZEND_STR_8_DOT_5)); + attribute_Deprecated_const_RFC7231_0->args[0].name = ZSTR_KNOWN(ZEND_STR_SINCE); + zend_string *attribute_Deprecated_const_RFC7231_0_arg1_str = zend_string_init("as this format ignores the associated timezone and always uses GMT", strlen("as this format ignores the associated timezone and always uses GMT"), 1); + ZVAL_STR(&attribute_Deprecated_const_RFC7231_0->args[1].value, attribute_Deprecated_const_RFC7231_0_arg1_str); + attribute_Deprecated_const_RFC7231_0->args[1].name = ZSTR_KNOWN(ZEND_STR_MESSAGE); + return class_entry; } diff --git a/ext/date/tests/DateTimeImmutable_constants.phpt b/ext/date/tests/DateTimeImmutable_constants.phpt index 16de66e89f1e4..c3192231916df 100644 --- a/ext/date/tests/DateTimeImmutable_constants.phpt +++ b/ext/date/tests/DateTimeImmutable_constants.phpt @@ -21,7 +21,10 @@ var_dump( ); ?> ---EXPECT-- +--EXPECTF-- +Deprecated: Constant DATE_RFC7231 is deprecated since 8.5, as this format ignores the associated timezone and always uses GMT in %s on line %d + +Deprecated: Constant DateTimeInterface::RFC7231 is deprecated since 8.5, as this format ignores the associated timezone and always uses GMT in %s on line %d bool(true) bool(true) bool(true) diff --git a/ext/date/tests/DateTimeInterface_constants.phpt b/ext/date/tests/DateTimeInterface_constants.phpt index c740ea4d951b1..d02eddf4d680c 100644 --- a/ext/date/tests/DateTimeInterface_constants.phpt +++ b/ext/date/tests/DateTimeInterface_constants.phpt @@ -21,7 +21,10 @@ var_dump( ); ?> ---EXPECT-- +--EXPECTF-- +Deprecated: Constant DATE_RFC7231 is deprecated since 8.5, as this format ignores the associated timezone and always uses GMT in %s on line %d + +Deprecated: Constant DateTimeInterface::RFC7231 is deprecated since 8.5, as this format ignores the associated timezone and always uses GMT in %s on line %d bool(true) bool(true) bool(true) diff --git a/ext/date/tests/DateTime_constants.phpt b/ext/date/tests/DateTime_constants.phpt index bca573d8f72aa..fada757775c68 100644 --- a/ext/date/tests/DateTime_constants.phpt +++ b/ext/date/tests/DateTime_constants.phpt @@ -21,7 +21,10 @@ var_dump( ); ?> ---EXPECT-- +--EXPECTF-- +Deprecated: Constant DATE_RFC7231 is deprecated since 8.5, as this format ignores the associated timezone and always uses GMT in %s on line %d + +Deprecated: Constant DateTimeInterface::RFC7231 is deprecated since 8.5, as this format ignores the associated timezone and always uses GMT in %s on line %d bool(true) bool(true) bool(true) diff --git a/ext/date/tests/DateTime_format_basic2.phpt b/ext/date/tests/DateTime_format_basic2.phpt index 2946cf2c681f4..a829f9c216376 100644 --- a/ext/date/tests/DateTime_format_basic2.phpt +++ b/ext/date/tests/DateTime_format_basic2.phpt @@ -24,7 +24,7 @@ var_dump($date->format(DateTime::RSS)); var_dump($date->format(DateTime::W3C)); ?> ---EXPECT-- +--EXPECTF-- *** Testing date_format() : basic functionality - formatting constants *** string(25) "2005-07-14T22:30:41+01:00" string(34) "Thursday, 14-Jul-2005 22:30:41 BST" @@ -34,6 +34,8 @@ string(29) "Thu, 14 Jul 05 22:30:41 +0100" string(32) "Thursday, 14-Jul-05 22:30:41 BST" string(29) "Thu, 14 Jul 05 22:30:41 +0100" string(31) "Thu, 14 Jul 2005 22:30:41 +0100" + +Deprecated: Constant DateTimeInterface::RFC7231 is deprecated since 8.5, as this format ignores the associated timezone and always uses GMT in %s on line %d string(29) "Thu, 14 Jul 2005 22:30:41 GMT" string(31) "Thu, 14 Jul 2005 22:30:41 +0100" string(25) "2005-07-14T22:30:41+01:00" diff --git a/ext/date/tests/bug74080.phpt b/ext/date/tests/bug74080.phpt deleted file mode 100644 index a86c78144e66e..0000000000000 --- a/ext/date/tests/bug74080.phpt +++ /dev/null @@ -1,11 +0,0 @@ ---TEST-- -Bug #74080 Provide an RFC7231 date time format ---FILE-- - ---EXPECT-- -string(29) "Sat, 30 Apr 2016 17:52:13 GMT" diff --git a/ext/date/tests/date_constants.phpt b/ext/date/tests/date_constants.phpt index 27d933166555d..2305ddbc31291 100644 --- a/ext/date/tests/date_constants.phpt +++ b/ext/date/tests/date_constants.phpt @@ -44,7 +44,8 @@ Date constants DATE_W3C == DateTime::W3C ); ?> ---EXPECT-- +--EXPECTF-- +Deprecated: Constant DATE_RFC7231 is deprecated since 8.5, as this format ignores the associated timezone and always uses GMT in %s on line %d string(25) "2006-07-01T14:27:30+02:00" string(25) "2006-05-30T14:32:13+02:00" string(35) "Saturday, 01-Jul-2006 14:27:30 CEST" @@ -74,6 +75,10 @@ string(31) "Tue, 30 May 2006 14:32:13 +0200" string(25) "2006-07-01T14:27:30+02:00" string(25) "2006-05-30T14:32:13+02:00" + +Deprecated: Constant DATE_RFC7231 is deprecated since 8.5, as this format ignores the associated timezone and always uses GMT in %s on line %d + +Deprecated: Constant DateTimeInterface::RFC7231 is deprecated since 8.5, as this format ignores the associated timezone and always uses GMT in %s on line %d bool(true) bool(true) bool(true) diff --git a/ext/opcache/jit/zend_jit_ir.c b/ext/opcache/jit/zend_jit_ir.c index 16f3de648a2f1..b1ebecc84a70f 100644 --- a/ext/opcache/jit/zend_jit_ir.c +++ b/ext/opcache/jit/zend_jit_ir.c @@ -14658,6 +14658,13 @@ static int zend_jit_assign_obj(zend_jit_ctx *jit, ir_ref slow_inputs = IR_UNUSED; uint32_t res_info = RES_INFO(); + if (Z_MODE(val_addr) == IS_REG + && Z_LOAD(val_addr) + && jit->ra[Z_SSA_VAR(val_addr)].ref == IR_NULL) { + /* Force load */ + zend_jit_use_reg(jit, val_addr); + } + if (val_addr != val_def_addr && val_def_addr) { if (!zend_jit_update_regs(jit, (opline+1)->op1.var, val_addr, val_def_addr, val_info)) { return 0; diff --git a/ext/opcache/tests/revalidate_path_01.phpt b/ext/opcache/tests/revalidate_path_01.phpt index ff87e73b55441..c8cd1ea493a63 100644 --- a/ext/opcache/tests/revalidate_path_01.phpt +++ b/ext/opcache/tests/revalidate_path_01.phpt @@ -30,7 +30,7 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { @rmdir($link); $ln = str_replace('/', '\\', $link); $d1 = realpath($dir1); - `mklink /j $ln $d1`; + shell_exec("mklink /j $ln $d1"); } else { @unlink($link); @symlink($dir1, $link); @@ -45,7 +45,7 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { @rmdir($link); $ln = str_replace('/', '\\', $link); $d2 = realpath($dir2); - `mklink /j $ln $d2`; + shell_exec("mklink /j $ln $d2"); } else { @unlink($link); @symlink($dir2, $link); diff --git a/ext/phar/phar/pharcommand.inc b/ext/phar/phar/pharcommand.inc index fee6c069ab085..7d35335a29470 100644 --- a/ext/phar/phar/pharcommand.inc +++ b/ext/phar/phar/pharcommand.inc @@ -225,13 +225,13 @@ class PharCommand extends CLICommand } } if ($pear) { - $apiver = (string) `pear -q info PHP_Archive 2>/dev/null|grep 'API Version'`; + $apiver = (string) shell_exec("pear -q info PHP_Archive 2>/dev/null|grep 'API Version'"); $apiver = trim(substr($apiver, strlen('API Version'))); } if ($apiver) { self::notice("PEAR package PHP_Archive: API Version: $apiver.\n"); - $files = explode("\n", (string) `pear list-files PHP_Archive`); - $phpdir = (string) `pear config-get php_dir 2>/dev/null`; + $files = explode("\n", (string) shell_exec("pear list-files PHP_Archive")); + $phpdir = (string) shell_exec("pear config-get php_dir 2>/dev/null"); $phpdir = trim($phpdir); self::notice("PEAR package PHP_Archive: $phpdir.\n"); if (is_dir($phpdir)) { diff --git a/ext/session/tests/session_regenerate_id_cookie.phpt b/ext/session/tests/session_regenerate_id_cookie.phpt index f1dc0727205d2..6516ad7061d10 100644 --- a/ext/session/tests/session_regenerate_id_cookie.phpt +++ b/ext/session/tests/session_regenerate_id_cookie.phpt @@ -55,7 +55,7 @@ ob_end_flush(); ?>'); $extra_arguments = getenv('TEST_PHP_EXTRA_ARGS'); -var_dump(`$php $extra_arguments -d session.name=PHPSESSID $file`); +var_dump(shell_exec("$php $extra_arguments -d session.name=PHPSESSID $file")); unlink($file); diff --git a/ext/standard/image.c b/ext/standard/image.c index 722f0a1edbd4d..97dcc437c833e 100644 --- a/ext/standard/image.c +++ b/ext/standard/image.c @@ -1198,7 +1198,7 @@ static struct php_gfxinfo *php_handle_avif(php_stream * stream) { } /* }}} */ -/* {{{ php_is_image_avif +/* * Detect whether an image is of type AVIF * * Only the first "ftyp" box is read. @@ -1208,12 +1208,8 @@ bool php_is_image_avif(php_stream* stream) { struct php_avif_stream avif_stream; avif_stream.stream = stream; - if (AvifInfoIdentifyStream(&avif_stream, php_avif_stream_read, php_avif_stream_skip) == kAvifInfoOk) { - return 1; - } - return 0; + return AvifInfoIdentifyStream(&avif_stream, php_avif_stream_read, php_avif_stream_skip) == kAvifInfoOk; } -/* }}} */ /* {{{ php_image_type_to_mime_type * Convert internal image_type to mime type */ diff --git a/ext/standard/tests/dir/bug73877.phpt b/ext/standard/tests/dir/bug73877.phpt index ceb272ea6527d..e538bed0d8908 100644 --- a/ext/standard/tests/dir/bug73877.phpt +++ b/ext/standard/tests/dir/bug73877.phpt @@ -18,7 +18,7 @@ $junk0 = $base . DIRECTORY_SEPARATOR . "Серёжка2"; mkdir($base); mkdir($dir0); mkdir($dir1); -`mklink /J $junk0 $dir0`; +shell_exec("mklink /J $junk0 $dir0"); var_dump( readlink($dir0), diff --git a/ext/standard/tests/file/mkdir-002.phpt b/ext/standard/tests/file/mkdir-002.phpt index f4a42a7d61982..d48b19e645bad 100644 --- a/ext/standard/tests/file/mkdir-002.phpt +++ b/ext/standard/tests/file/mkdir-002.phpt @@ -11,13 +11,13 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { var_dump(mkdir("mkdir-002", 0777)); var_dump(mkdir("mkdir-002/subdir", 0777)); -var_dump(`ls -l mkdir-002`); +var_dump(shell_exec("ls -l mkdir-002")); var_dump(rmdir("mkdir-002/subdir")); var_dump(rmdir("mkdir-002")); var_dump(mkdir("./mkdir-002", 0777)); var_dump(mkdir("./mkdir-002/subdir", 0777)); -var_dump(`ls -l ./mkdir-002`); +var_dump(shell_exec("ls -l ./mkdir-002")); var_dump(rmdir("./mkdir-002/subdir")); var_dump(rmdir("./mkdir-002")); @@ -25,7 +25,7 @@ var_dump(mkdir(__DIR__."/mkdir-002", 0777)); var_dump(mkdir(__DIR__."/mkdir-002/subdir", 0777)); $dirname = __DIR__."/mkdir-002"; $dirname_escaped = escapeshellarg($dirname); -var_dump(`ls -l $dirname_escaped`); +var_dump(shell_exec("ls -l $dirname_escaped")); var_dump(rmdir(__DIR__."/mkdir-002/subdir")); var_dump(rmdir(__DIR__."/mkdir-002")); diff --git a/main/php_variables.c b/main/php_variables.c index b81c049f6c5b3..91eb0a7f5ceac 100644 --- a/main/php_variables.c +++ b/main/php_variables.c @@ -346,7 +346,7 @@ static bool add_post_var(zval *arr, post_var_data_t *var, bool eof) size_t new_vlen; if (var->ptr >= var->end) { - return 0; + return false; } start = var->ptr + var->already_scanned; @@ -354,7 +354,7 @@ static bool add_post_var(zval *arr, post_var_data_t *var, bool eof) if (!vsep) { if (!eof) { var->already_scanned = var->end - var->ptr; - return 0; + return false; } else { vsep = var->end; } @@ -387,10 +387,10 @@ static bool add_post_var(zval *arr, post_var_data_t *var, bool eof) var->ptr = vsep + (vsep != var->end); var->already_scanned = 0; - return 1; + return true; } -static inline int add_post_vars(zval *arr, post_var_data_t *vars, bool eof) +static inline zend_result add_post_vars(zval *arr, post_var_data_t *vars, bool eof) { uint64_t max_vars = REQUEST_PARSE_BODY_OPTION_GET(max_input_vars, PG(max_input_vars)); @@ -782,7 +782,7 @@ static void php_autoglobal_merge(HashTable *dest, HashTable *src) /* }}} */ /* {{{ php_hash_environment */ -PHPAPI int php_hash_environment(void) +PHPAPI zend_result php_hash_environment(void) { memset(PG(http_globals), 0, sizeof(PG(http_globals))); zend_activate_auto_globals(); @@ -805,7 +805,7 @@ static bool php_auto_globals_create_get(zend_string *name) zend_hash_update(&EG(symbol_table), name, &PG(http_globals)[TRACK_VARS_GET]); Z_ADDREF(PG(http_globals)[TRACK_VARS_GET]); - return 0; /* don't rearm */ + return false; /* don't rearm */ } static bool php_auto_globals_create_post(zend_string *name) @@ -824,7 +824,7 @@ static bool php_auto_globals_create_post(zend_string *name) zend_hash_update(&EG(symbol_table), name, &PG(http_globals)[TRACK_VARS_POST]); Z_ADDREF(PG(http_globals)[TRACK_VARS_POST]); - return 0; /* don't rearm */ + return false; /* don't rearm */ } static bool php_auto_globals_create_cookie(zend_string *name) @@ -839,7 +839,7 @@ static bool php_auto_globals_create_cookie(zend_string *name) zend_hash_update(&EG(symbol_table), name, &PG(http_globals)[TRACK_VARS_COOKIE]); Z_ADDREF(PG(http_globals)[TRACK_VARS_COOKIE]); - return 0; /* don't rearm */ + return false; /* don't rearm */ } static bool php_auto_globals_create_files(zend_string *name) @@ -851,7 +851,7 @@ static bool php_auto_globals_create_files(zend_string *name) zend_hash_update(&EG(symbol_table), name, &PG(http_globals)[TRACK_VARS_FILES]); Z_ADDREF(PG(http_globals)[TRACK_VARS_FILES]); - return 0; /* don't rearm */ + return false; /* don't rearm */ } /* Ugly hack to fix HTTP_PROXY issue, see bug #72573 */ @@ -905,7 +905,7 @@ static bool php_auto_globals_create_server(zend_string *name) * ignore this issue, as it would probably require larger changes. */ HT_ALLOW_COW_VIOLATION(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER])); - return 0; /* don't rearm */ + return false; /* don't rearm */ } static bool php_auto_globals_create_env(zend_string *name) @@ -921,7 +921,7 @@ static bool php_auto_globals_create_env(zend_string *name) zend_hash_update(&EG(symbol_table), name, &PG(http_globals)[TRACK_VARS_ENV]); Z_ADDREF(PG(http_globals)[TRACK_VARS_ENV]); - return 0; /* don't rearm */ + return false; /* don't rearm */ } static bool php_auto_globals_create_request(zend_string *name) @@ -965,7 +965,7 @@ static bool php_auto_globals_create_request(zend_string *name) } zend_hash_update(&EG(symbol_table), name, &form_variables); - return 0; + return false; } void php_startup_auto_globals(void) diff --git a/main/php_variables.h b/main/php_variables.h index f2b4b8cae241a..5cb43890bd756 100644 --- a/main/php_variables.h +++ b/main/php_variables.h @@ -39,7 +39,7 @@ PHPAPI void php_register_variable_ex(const char *var, zval *val, zval *track_var PHPAPI void php_register_known_variable(const char *var, size_t var_len, zval *value, zval *track_vars_array); PHPAPI void php_build_argv(const char *s, zval *track_vars_array); -PHPAPI int php_hash_environment(void); +PHPAPI zend_result php_hash_environment(void); END_EXTERN_C() #define NUM_TRACK_VARS 6 diff --git a/sapi/cgi/tests/001.phpt b/sapi/cgi/tests/001.phpt index 0527993e8c164..c990a77efaee1 100644 --- a/sapi/cgi/tests/001.phpt +++ b/sapi/cgi/tests/001.phpt @@ -10,7 +10,7 @@ include "include.inc"; $php = get_cgi_path(); reset_env_vars(); -var_dump(`$php -n -v`); +var_dump(shell_exec("$php -n -v")); echo "Done\n"; ?> diff --git a/sapi/cgi/tests/002.phpt b/sapi/cgi/tests/002.phpt index b28c8656598cf..374a427cdce94 100644 --- a/sapi/cgi/tests/002.phpt +++ b/sapi/cgi/tests/002.phpt @@ -15,13 +15,13 @@ $file = __DIR__."/002.test.php"; file_put_contents($file, ''); -var_dump(`$php -n -d max_execution_time=111 $file`); -var_dump(`$php -n -d max_execution_time=500 $file`); -var_dump(`$php -n -d max_execution_time=500 -d max_execution_time=555 $file`); +var_dump(shell_exec("$php -n -d max_execution_time=111 $file")); +var_dump(shell_exec("$php -n -d max_execution_time=500 $file")); +var_dump(shell_exec("$php -n -d max_execution_time=500 -d max_execution_time=555 $file")); file_put_contents($file, ''); -var_dump(`$php -n -d upload_tmp_dir=/test/path -d max_execution_time=555 $file`); +var_dump(shell_exec("$php -n -d upload_tmp_dir=/test/path -d max_execution_time=555 $file")); unlink($file); diff --git a/sapi/cgi/tests/003.phpt b/sapi/cgi/tests/003.phpt index ac3f6aa8e6386..81d46e868b3d9 100644 --- a/sapi/cgi/tests/003.phpt +++ b/sapi/cgi/tests/003.phpt @@ -37,9 +37,15 @@ class test { /* {{{ */ file_put_contents($filename, $code); -var_dump(`$php -n -w "$filename"`); -var_dump(`$php -n -w "wrong"`); -var_dump(`echo "" | $php -n -w`); +var_dump(shell_exec(<<" | $php -n -w +SHELL)); @unlink($filename); diff --git a/sapi/cgi/tests/004.phpt b/sapi/cgi/tests/004.phpt index 1de856e346725..fddc5ee80edb5 100644 --- a/sapi/cgi/tests/004.phpt +++ b/sapi/cgi/tests/004.phpt @@ -27,11 +27,17 @@ var_dump(test::$pri); file_put_contents($filename, $code); if (defined("PHP_WINDOWS_VERSION_MAJOR")) { - var_dump(`$php -n -f "$filename"`); + var_dump(shell_exec(<</dev/null`); + var_dump(shell_exec(<</dev/null + SHELL)); } -var_dump(`$php -n -f "wrong"`); +var_dump(shell_exec(<< diff --git a/sapi/cgi/tests/006.phpt b/sapi/cgi/tests/006.phpt index 479d4a9441f26..840dd4329773f 100644 --- a/sapi/cgi/tests/006.phpt +++ b/sapi/cgi/tests/006.phpt @@ -29,8 +29,12 @@ echo test::$var; file_put_contents($filename, $code); -var_dump(`"$php" -n -l "$filename"`); -var_dump(`"$php" -n -l some.unknown`); +var_dump(shell_exec(<<'); -echo (`$php -n $f`); +echo shell_exec("$php -n $f"); echo "Done\n"; diff --git a/sapi/cgi/tests/010.phpt b/sapi/cgi/tests/010.phpt index 67e1a69e26e79..2f5d9a1356d3e 100644 --- a/sapi/cgi/tests/010.phpt +++ b/sapi/cgi/tests/010.phpt @@ -19,19 +19,19 @@ header("HTTP/1.1 403 Forbidden"); header("Status: 403 Also Forbidden"); ?>'); -echo (`$php -n $f`); +echo shell_exec("$php -n $f"); file_put_contents($f, ''); -echo (`$php -n $f`); +echo shell_exec("$php -n $f"); file_put_contents($f, ''); -echo (`$php -n $f`); +echo shell_exec("$php -n $f"); echo "Done\n"; diff --git a/sapi/cgi/tests/include.inc b/sapi/cgi/tests/include.inc index d155edf4ba208..7d38acca8e8dc 100644 --- a/sapi/cgi/tests/include.inc +++ b/sapi/cgi/tests/include.inc @@ -9,7 +9,7 @@ function get_cgi_path() /* {{{ */ $cgi = false; if (file_exists($php) && is_executable($php)) { - $version = `$php_escaped -n -v`; + $version = shell_exec("$php_escaped -n -v"); if (strstr($version, "(cli)")) { /* that's cli */ $cli = true; diff --git a/sapi/cli/tests/001.phpt b/sapi/cli/tests/001.phpt index fc1ae71fa134a..bb85ad4343577 100644 --- a/sapi/cli/tests/001.phpt +++ b/sapi/cli/tests/001.phpt @@ -7,7 +7,7 @@ version string $php = getenv('TEST_PHP_EXECUTABLE_ESCAPED'); -var_dump(`$php -n -v`); +var_dump(shell_exec("$php -n -v")); echo "Done\n"; ?> diff --git a/sapi/cli/tests/002-unix.phpt b/sapi/cli/tests/002-unix.phpt index 40e077bf984a8..77a8ee0a7c26a 100644 --- a/sapi/cli/tests/002-unix.phpt +++ b/sapi/cli/tests/002-unix.phpt @@ -12,7 +12,9 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { $php = getenv('TEST_PHP_EXECUTABLE_ESCAPED'); -var_dump(`$php -n -r 'var_dump("hello");'`); +var_dump(shell_exec(<< diff --git a/sapi/cli/tests/002.phpt b/sapi/cli/tests/002.phpt index 5c6424f5964cc..81f4f9e33331d 100644 --- a/sapi/cli/tests/002.phpt +++ b/sapi/cli/tests/002.phpt @@ -9,7 +9,9 @@ include "skipif.inc"; $php = getenv('TEST_PHP_EXECUTABLE_ESCAPED'); -var_dump(`$php -n -r "var_dump('hello');"`); +var_dump(shell_exec(<< diff --git a/sapi/cli/tests/003-2.phpt b/sapi/cli/tests/003-2.phpt index 88a556b81f503..be1d9d040b506 100644 --- a/sapi/cli/tests/003-2.phpt +++ b/sapi/cli/tests/003-2.phpt @@ -12,8 +12,12 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { $php = getenv('TEST_PHP_EXECUTABLE_ESCAPED'); -var_dump(`$php -nd max_execution_time=111 -r 'var_dump(ini_get("max_execution_time"));'`); -var_dump(`$php -nd max_execution_time=500 -r 'var_dump(ini_get("max_execution_time"));'`); +var_dump(shell_exec(<< --EXPECT-- diff --git a/sapi/cli/tests/003.phpt b/sapi/cli/tests/003.phpt index 20bf61a247bf9..060d831fe767f 100644 --- a/sapi/cli/tests/003.phpt +++ b/sapi/cli/tests/003.phpt @@ -12,10 +12,18 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { $php = getenv('TEST_PHP_EXECUTABLE_ESCAPED'); -var_dump(`$php -n -d max_execution_time=111 -r 'var_dump(ini_get("max_execution_time"));'`); -var_dump(`$php -n -d max_execution_time=500 -r 'var_dump(ini_get("max_execution_time"));'`); -var_dump(`$php -n -d max_execution_time=500 -d max_execution_time=555 -r 'var_dump(ini_get("max_execution_time"));'`); -var_dump(`$php -n -d upload_tmp_dir=/test/path -d max_execution_time=555 -r 'var_dump(ini_get("max_execution_time")); var_dump(ini_get("upload_tmp_dir"));'`); +var_dump(shell_exec(<< diff --git a/sapi/cli/tests/004.phpt b/sapi/cli/tests/004.phpt index 83da934c8ff14..c88b85480bdbf 100644 --- a/sapi/cli/tests/004.phpt +++ b/sapi/cli/tests/004.phpt @@ -9,9 +9,9 @@ include "skipif.inc"; $php = getenv('TEST_PHP_EXECUTABLE_ESCAPED'); -var_dump(`$php -n --rf unknown`); -var_dump(`$php -n --rf echo`); -var_dump(`$php -n --rf phpinfo`); +var_dump(shell_exec("$php -n --rf unknown")); +var_dump(shell_exec("$php -n --rf echo")); +var_dump(shell_exec("$php -n --rf phpinfo")); echo "Done\n"; ?> diff --git a/sapi/cli/tests/005.phpt b/sapi/cli/tests/005.phpt index 0d8ba066cf7de..ca168ecfe20e3 100644 --- a/sapi/cli/tests/005.phpt +++ b/sapi/cli/tests/005.phpt @@ -9,9 +9,9 @@ include "skipif.inc"; $php = getenv('TEST_PHP_EXECUTABLE_ESCAPED'); -var_dump(`$php -n --rc unknown`); -var_dump(`$php -n --rc stdclass`); -var_dump(`$php -n --rc exception`); +var_dump(shell_exec("$php -n --rc unknown")); +var_dump(shell_exec("$php -n --rc stdclass")); +var_dump(shell_exec("$php -n --rc exception")); echo "Done\n"; ?> diff --git a/sapi/cli/tests/006.phpt b/sapi/cli/tests/006.phpt index 38c117ec70f2f..957543c1a28da 100644 --- a/sapi/cli/tests/006.phpt +++ b/sapi/cli/tests/006.phpt @@ -17,9 +17,11 @@ date.timezone=UTC $php = getenv('TEST_PHP_EXECUTABLE_ESCAPED'); -var_dump(`$php -n --re unknown`); -var_dump(`$php -n --re ""`); -var_dump(`$php -n --re pcre`); +var_dump(shell_exec("$php -n --re unknown")); +var_dump(shell_exec(<< diff --git a/sapi/cli/tests/007.phpt b/sapi/cli/tests/007.phpt index 6f27586e27d96..afefd2b8ddb9c 100644 --- a/sapi/cli/tests/007.phpt +++ b/sapi/cli/tests/007.phpt @@ -32,9 +32,15 @@ class test { /* {{{ */ file_put_contents($filename, $code); -var_dump(`$php -n -w "$filename"`); -var_dump(`$php -n -w "wrong"`); -var_dump(`echo "" | $php -n -w`); +var_dump(shell_exec(<<" | $php -n -w +SHELL)); @unlink($filename); diff --git a/sapi/cli/tests/008.phpt b/sapi/cli/tests/008.phpt index a8b205056300e..b893473f95f57 100644 --- a/sapi/cli/tests/008.phpt +++ b/sapi/cli/tests/008.phpt @@ -26,8 +26,12 @@ var_dump(test::$pri); file_put_contents($filename, $code); -var_dump(`$php -n -f "$filename"`); -var_dump(`$php -n -f "wrong"`); +var_dump(shell_exec(<< diff --git a/sapi/cli/tests/010-2.phpt b/sapi/cli/tests/010-2.phpt index 1fc05f8cfa35b..88fe1c832a11e 100644 --- a/sapi/cli/tests/010-2.phpt +++ b/sapi/cli/tests/010-2.phpt @@ -22,7 +22,9 @@ hello file_put_contents($filename_txt, $txt); -var_dump(`cat $filename_txt_escaped | $php -n -R "var_dump(1);"`); +var_dump(shell_exec(<< --CLEAN-- diff --git a/sapi/cli/tests/011.phpt b/sapi/cli/tests/011.phpt index d45cb94a08c71..ada916d541631 100644 --- a/sapi/cli/tests/011.phpt +++ b/sapi/cli/tests/011.phpt @@ -26,8 +26,8 @@ echo test::$var; file_put_contents($filename, $code); -var_dump(`$php -n -l $filename_escaped`); -var_dump(`$php -n -l some.unknown`); +var_dump(shell_exec("$php -n -l $filename_escaped")); +var_dump(shell_exec("$php -n -l some.unknown")); $code = ' diff --git a/sapi/cli/tests/012.phpt b/sapi/cli/tests/012.phpt index be21b3d99e87c..47c086724be34 100644 --- a/sapi/cli/tests/012.phpt +++ b/sapi/cli/tests/012.phpt @@ -7,14 +7,14 @@ invalid arguments and error messages $php = getenv('TEST_PHP_EXECUTABLE_ESCAPED'); -var_dump(`$php -n -F some.php -F some.php`); -var_dump(`$php -n -F some.php -R some.php`); -var_dump(`$php -n -R some.php -F some.php`); -var_dump(`$php -n -R some.php -R some.php`); -var_dump(`$php -n -f some.php -f some.php`); -var_dump(`$php -n -B '' -B ''`); -var_dump(`$php -n -E '' -E ''`); -var_dump(`$php -n -r '' -r ''`); +var_dump(shell_exec("$php -n -F some.php -F some.php")); +var_dump(shell_exec("$php -n -F some.php -R some.php")); +var_dump(shell_exec("$php -n -R some.php -F some.php")); +var_dump(shell_exec("$php -n -R some.php -R some.php")); +var_dump(shell_exec("$php -n -f some.php -f some.php")); +var_dump(shell_exec("$php -n -B '' -B ''")); +var_dump(shell_exec("$php -n -E '' -E ''")); +var_dump(shell_exec("$php -n -r '' -r ''")); echo "Done\n"; ?> diff --git a/sapi/cli/tests/013.phpt b/sapi/cli/tests/013.phpt index 345a489403acc..42d4f1eb4c3d2 100644 --- a/sapi/cli/tests/013.phpt +++ b/sapi/cli/tests/013.phpt @@ -16,9 +16,15 @@ $filename_txt = __DIR__."/013.test.txt"; $filename_txt_escaped = escapeshellarg($filename_txt); file_put_contents($filename_txt, "test\nfile\ncontents\n"); -var_dump(`cat $filename_txt_escaped | $php -n -B 'var_dump("start");'`); -var_dump(`cat $filename_txt_escaped | $php -n -E 'var_dump("end");'`); -var_dump(`cat $filename_txt_escaped | $php -n -B 'var_dump("start");' -E 'var_dump("end");'`); +var_dump(shell_exec(<<&1 | grep Usage:`; +echo shell_exec("$php -n --version | grep built:"); +echo shell_exec(<<&1 | grep Usage:"); echo "Done\n"; ?> diff --git a/sapi/cli/tests/016.phpt b/sapi/cli/tests/016.phpt index 544633f592f6d..0ba9027f2164d 100644 --- a/sapi/cli/tests/016.phpt +++ b/sapi/cli/tests/016.phpt @@ -56,7 +56,7 @@ EOT; foreach ($codes as $key => $code) { echo "\n--------------\nSnippet no. $key:\n--------------\n"; $code = escapeshellarg($code); - echo `echo $code | $php -a`, "\n"; + echo shell_exec("echo $code | $php -a"), "\n"; } echo "\nDone\n"; diff --git a/sapi/cli/tests/018.phpt b/sapi/cli/tests/018.phpt index 2511fb852e5bf..ffe92d620590a 100644 --- a/sapi/cli/tests/018.phpt +++ b/sapi/cli/tests/018.phpt @@ -13,7 +13,7 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { $php = getenv('TEST_PHP_EXECUTABLE_ESCAPED'); -echo `$php -n -m`; +echo shell_exec("$php -n -m"); echo "Done\n"; ?> diff --git a/sapi/cli/tests/019.phpt b/sapi/cli/tests/019.phpt index 0f5a66c871ef2..481ea2228b34c 100644 --- a/sapi/cli/tests/019.phpt +++ b/sapi/cli/tests/019.phpt @@ -13,7 +13,7 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { $php = getenv('TEST_PHP_EXECUTABLE_ESCAPED'); -echo `$php -n -i`; +echo shell_exec("$php -n -i"); echo "\nDone\n"; ?> diff --git a/sapi/cli/tests/020.phpt b/sapi/cli/tests/020.phpt index 3ccd6a83d3b37..4cffe58e75c9a 100644 --- a/sapi/cli/tests/020.phpt +++ b/sapi/cli/tests/020.phpt @@ -13,8 +13,8 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { $php = getenv('TEST_PHP_EXECUTABLE_ESCAPED'); -echo `$php -n --ri this_extension_does_not_exist_568537753423`; -echo `$php -n --ri standard`; +echo shell_exec("$php -n --ri this_extension_does_not_exist_568537753423"); +echo shell_exec("$php -n --ri standard"); echo "\nDone\n"; ?> diff --git a/sapi/cli/tests/021.phpt b/sapi/cli/tests/021.phpt index 9a24ec454a989..9c25d652eb3cc 100644 --- a/sapi/cli/tests/021.phpt +++ b/sapi/cli/tests/021.phpt @@ -31,7 +31,7 @@ $script = "#!$php -n\n". file_put_contents($filename, $script); chmod($filename, 0777); -echo `$filename`; +echo shell_exec($filename); echo "\nDone\n"; ?> diff --git a/sapi/cli/tests/025.phpt b/sapi/cli/tests/025.phpt index f0dcb10753210..c02467d7baf7d 100644 --- a/sapi/cli/tests/025.phpt +++ b/sapi/cli/tests/025.phpt @@ -11,7 +11,7 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { ")); ?> diff --git a/sapi/cli/tests/argv_mb.phpt b/sapi/cli/tests/argv_mb.phpt index f7f6dd49081b0..72df868a04ae7 100644 --- a/sapi/cli/tests/argv_mb.phpt +++ b/sapi/cli/tests/argv_mb.phpt @@ -13,7 +13,7 @@ $argv_fl = __DIR__ . DIRECTORY_SEPARATOR . "argv_test.php"; $argv_fl_escaped = escapeshellarg($argv_fl); file_put_contents($argv_fl, ""); -var_dump(`$php -n $argv_fl_escaped 多字节字符串 マルチバイト文字列 многобайтоваястрока flerbytesträng`); +var_dump(shell_exec("$php -n $argv_fl_escaped 多字节字符串 マルチバイト文字列 многобайтоваястрока flerbytesträng")); @unlink($argv_fl); diff --git a/sapi/cli/tests/argv_mb_bug77111.phpt b/sapi/cli/tests/argv_mb_bug77111.phpt index b26ef7661b5a0..e586049a95aab 100644 --- a/sapi/cli/tests/argv_mb_bug77111.phpt +++ b/sapi/cli/tests/argv_mb_bug77111.phpt @@ -24,7 +24,7 @@ $out_fl = __DIR__ . "\\argv_bug77111.txt"; $argv_fl = __DIR__ . DIRECTORY_SEPARATOR . "argv_bug77111_test.php"; file_put_contents($argv_fl, ""); -`$php -n $argv_fl Ästhetik Æstetik Esthétique Estética Эстетика`; +shell_exec("$php -n $argv_fl Ästhetik Æstetik Esthétique Estética Эстетика"); var_dump(file_get_contents($out_fl)); ?> diff --git a/sapi/cli/tests/bug71624.phpt b/sapi/cli/tests/bug71624.phpt index 83f48cf921c5a..d55bf03f139f6 100644 --- a/sapi/cli/tests/bug71624.phpt +++ b/sapi/cli/tests/bug71624.phpt @@ -22,9 +22,11 @@ file_put_contents($filename_txt, $txt); $test_args = ['$argi', '$argn']; foreach ($test_args as $test_arg) { if (substr(PHP_OS, 0, 3) == 'WIN') { - var_dump(`type $filename_txt_escaped | $php -n -R "echo $test_arg . PHP_EOL;"`); + var_dump(shell_exec(<< --EXPECT-- Interactive shell diff --git a/sapi/fpm/tests/main-version.phpt b/sapi/fpm/tests/main-version.phpt index d03372846ede0..8c7dbe78c92e3 100644 --- a/sapi/fpm/tests/main-version.phpt +++ b/sapi/fpm/tests/main-version.phpt @@ -9,7 +9,7 @@ require_once "tester.inc"; $php = \FPM\Tester::findExecutable(); -var_dump(`$php -n -v`); +var_dump(shell_exec("$php -n -v")); echo "Done\n"; ?> diff --git a/sapi/phpdbg/phpdbg_watch.c b/sapi/phpdbg/phpdbg_watch.c index 14496d865ead4..5657649efdb69 100644 --- a/sapi/phpdbg/phpdbg_watch.c +++ b/sapi/phpdbg/phpdbg_watch.c @@ -139,7 +139,7 @@ bool phpdbg_check_watch_diff(phpdbg_watchtype type, void *oldPtr, void *newPtr) switch (type) { case WATCH_ON_BUCKET: if (memcmp(&((Bucket *) oldPtr)->h, &((Bucket *) newPtr)->h, sizeof(Bucket) - sizeof(zval) /* hash+key comparison */) != 0) { - return 2; + return true; } /* Fall through to also compare the value from the bucket. */ ZEND_FALLTHROUGH; @@ -154,7 +154,7 @@ bool phpdbg_check_watch_diff(phpdbg_watchtype type, void *oldPtr, void *newPtr) case WATCH_ON_HASHDATA: ZEND_UNREACHABLE(); } - return 0; + return false; } void phpdbg_print_watch_diff(phpdbg_watchtype type, zend_string *name, void *oldPtr, void *newPtr) { @@ -280,9 +280,9 @@ static inline void phpdbg_deactivate_watchpoint(phpdbg_watchpoint_t *watch) { /* Note that consecutive pages need to be merged in order to avoid watchpoints spanning page boundaries to have part of their data in the one page, part in the other page */ #ifdef _WIN32 -int phpdbg_watchpoint_segfault_handler(void *addr) { +zend_result phpdbg_watchpoint_segfault_handler(void *addr) { #else -int phpdbg_watchpoint_segfault_handler(siginfo_t *info, void *context) { +zend_result phpdbg_watchpoint_segfault_handler(siginfo_t *info, void *context) { #endif void *page = phpdbg_get_page_boundary( @@ -562,12 +562,12 @@ bool phpdbg_is_recursively_watched(void *ptr, phpdbg_watch_element *element) { do { element = next; if (element->watch->addr.ptr == ptr) { - return 1; + return true; } next = element->parent; } while (!(element->flags & PHPDBG_WATCH_RECURSIVE_ROOT)); - return 0; + return false; } void phpdbg_add_recursive_watch_from_ht(phpdbg_watch_element *element, zend_long idx, zend_string *str, zval *zv) { @@ -721,7 +721,7 @@ bool phpdbg_try_re_adding_watch_element(zval *parent, phpdbg_watch_element *elem HashTable *ht = HT_FROM_ZVP(parent); if (!ht) { - return 0; + return false; } else if (element->flags & (PHPDBG_WATCH_ARRAY | PHPDBG_WATCH_OBJECT)) { char *htPtr = ((char *) ht) + HT_WATCH_OFFSET; char *oldPtr = ((char *) &element->backup.ht) + HT_WATCH_OFFSET; @@ -742,7 +742,7 @@ bool phpdbg_try_re_adding_watch_element(zval *parent, phpdbg_watch_element *elem } if (!phpdbg_try_re_adding_watch_element(next, element->child)) { - return 0; + return false; } } else if (phpdbg_check_watch_diff(WATCH_ON_ZVAL, &element->backup.zv, zv)) { phpdbg_print_watch_diff(WATCH_ON_ZVAL, element->str, &element->backup.zv, zv); @@ -752,10 +752,10 @@ bool phpdbg_try_re_adding_watch_element(zval *parent, phpdbg_watch_element *elem phpdbg_add_bucket_watch_element((Bucket *) zv, element); phpdbg_watch_parent_ht(element); } else { - return 0; + return false; } - return 1; + return true; } void phpdbg_automatic_dequeue_free(phpdbg_watch_element *element) { diff --git a/sapi/phpdbg/phpdbg_watch.h b/sapi/phpdbg/phpdbg_watch.h index 17d9dfac93ddd..56f4b29379ca6 100644 --- a/sapi/phpdbg/phpdbg_watch.h +++ b/sapi/phpdbg/phpdbg_watch.h @@ -115,9 +115,9 @@ void phpdbg_destroy_watchpoints(void); void phpdbg_purge_watchpoint_tree(void); #ifndef _WIN32 -int phpdbg_watchpoint_segfault_handler(siginfo_t *info, void *context); +zend_result phpdbg_watchpoint_segfault_handler(siginfo_t *info, void *context); #else -int phpdbg_watchpoint_segfault_handler(void *addr); +zend_result phpdbg_watchpoint_segfault_handler(void *addr); #endif void phpdbg_create_addr_watchpoint(void *addr, size_t size, phpdbg_watchpoint_t *watch); diff --git a/sapi/phpdbg/tests/bug73615.phpt b/sapi/phpdbg/tests/bug73615.phpt index 2208cdebf707b..843424d7b3695 100644 --- a/sapi/phpdbg/tests/bug73615.phpt +++ b/sapi/phpdbg/tests/bug73615.phpt @@ -11,7 +11,7 @@ $phpdbg = getenv('TEST_PHPDBG_EXECUTABLE_ESCAPED'); chdir(__DIR__."/bug73615"); -print `$phpdbg -qn`; +print shell_exec("$phpdbg -qn"); ?> --EXPECT-- diff --git a/tests/run-test/extensions-shared.phpt b/tests/run-test/extensions-shared.phpt index 10ad664d3839b..d4c17f4b09278 100644 --- a/tests/run-test/extensions-shared.phpt +++ b/tests/run-test/extensions-shared.phpt @@ -5,7 +5,7 @@ openssl --SKIPIF--