diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 4c8ec23b158a4..2377286ca830c 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -520,7 +520,7 @@ jobs: - name: Test Laravel if: ${{ !cancelled() }} run: | - git clone https://github.com/laravel/framework.git --branch=master --depth=1 + git clone https://github.com/laravel/framework.git --depth=1 cd framework git rev-parse HEAD php /usr/bin/composer install --no-progress --ignore-platform-reqs diff --git a/Zend/tests/bug28377.phpt b/Zend/tests/backtrace/bug28377.phpt similarity index 100% rename from Zend/tests/bug28377.phpt rename to Zend/tests/backtrace/bug28377.phpt diff --git a/Zend/tests/bug30828.phpt b/Zend/tests/backtrace/bug30828.phpt similarity index 100% rename from Zend/tests/bug30828.phpt rename to Zend/tests/backtrace/bug30828.phpt diff --git a/Zend/tests/bug39445.phpt b/Zend/tests/backtrace/bug39445.phpt similarity index 100% rename from Zend/tests/bug39445.phpt rename to Zend/tests/backtrace/bug39445.phpt diff --git a/Zend/tests/bug64239_2.phpt b/Zend/tests/backtrace/bug64239_2.phpt similarity index 100% rename from Zend/tests/bug64239_2.phpt rename to Zend/tests/backtrace/bug64239_2.phpt diff --git a/Zend/tests/bug64239_3.phpt b/Zend/tests/backtrace/bug64239_3.phpt similarity index 100% rename from Zend/tests/bug64239_3.phpt rename to Zend/tests/backtrace/bug64239_3.phpt diff --git a/Zend/tests/bug64239_4.phpt b/Zend/tests/backtrace/bug64239_4.phpt similarity index 100% rename from Zend/tests/bug64239_4.phpt rename to Zend/tests/backtrace/bug64239_4.phpt diff --git a/Zend/tests/bug69180-backtrace.phpt b/Zend/tests/backtrace/bug69180-backtrace.phpt similarity index 100% rename from Zend/tests/bug69180-backtrace.phpt rename to Zend/tests/backtrace/bug69180-backtrace.phpt diff --git a/Zend/tests/bug70547.phpt b/Zend/tests/backtrace/bug70547.phpt similarity index 100% rename from Zend/tests/bug70547.phpt rename to Zend/tests/backtrace/bug70547.phpt diff --git a/Zend/tests/bug76047.phpt b/Zend/tests/backtrace/bug76047.phpt similarity index 100% rename from Zend/tests/bug76047.phpt rename to Zend/tests/backtrace/bug76047.phpt diff --git a/Zend/tests/bug79108.phpt b/Zend/tests/backtrace/bug79108.phpt similarity index 100% rename from Zend/tests/bug79108.phpt rename to Zend/tests/backtrace/bug79108.phpt diff --git a/Zend/tests/bug_debug_backtrace.phpt b/Zend/tests/backtrace/bug_debug_backtrace.phpt similarity index 100% rename from Zend/tests/bug_debug_backtrace.phpt rename to Zend/tests/backtrace/bug_debug_backtrace.phpt diff --git a/Zend/tests/bug_debug_backtrace_replace_zend_execute_ex.phpt b/Zend/tests/backtrace/bug_debug_backtrace_replace_zend_execute_ex.phpt similarity index 100% rename from Zend/tests/bug_debug_backtrace_replace_zend_execute_ex.phpt rename to Zend/tests/backtrace/bug_debug_backtrace_replace_zend_execute_ex.phpt diff --git a/Zend/tests/debug_backtrace_limit.phpt b/Zend/tests/backtrace/debug_backtrace_limit.phpt similarity index 100% rename from Zend/tests/debug_backtrace_limit.phpt rename to Zend/tests/backtrace/debug_backtrace_limit.phpt diff --git a/Zend/tests/debug_backtrace_options.phpt b/Zend/tests/backtrace/debug_backtrace_options.phpt similarity index 100% rename from Zend/tests/debug_backtrace_options.phpt rename to Zend/tests/backtrace/debug_backtrace_options.phpt diff --git a/Zend/tests/debug_backtrace_with_include_and_this.phpt b/Zend/tests/backtrace/debug_backtrace_with_include_and_this.phpt similarity index 100% rename from Zend/tests/debug_backtrace_with_include_and_this.phpt rename to Zend/tests/backtrace/debug_backtrace_with_include_and_this.phpt diff --git a/Zend/tests/debug_print_backtrace_from_main.phpt b/Zend/tests/backtrace/debug_print_backtrace_from_main.phpt similarity index 100% rename from Zend/tests/debug_print_backtrace_from_main.phpt rename to Zend/tests/backtrace/debug_print_backtrace_from_main.phpt diff --git a/Zend/tests/debug_print_backtrace_limit.phpt b/Zend/tests/backtrace/debug_print_backtrace_limit.phpt similarity index 100% rename from Zend/tests/debug_print_backtrace_limit.phpt rename to Zend/tests/backtrace/debug_print_backtrace_limit.phpt diff --git a/Zend/tests/fatal_error_backtraces_001.phpt b/Zend/tests/backtrace/fatal_error_backtraces_001.phpt similarity index 100% rename from Zend/tests/fatal_error_backtraces_001.phpt rename to Zend/tests/backtrace/fatal_error_backtraces_001.phpt diff --git a/Zend/tests/fatal_error_backtraces_002.phpt b/Zend/tests/backtrace/fatal_error_backtraces_002.phpt similarity index 100% rename from Zend/tests/fatal_error_backtraces_002.phpt rename to Zend/tests/backtrace/fatal_error_backtraces_002.phpt diff --git a/Zend/tests/fatal_error_backtraces_003.phpt b/Zend/tests/backtrace/fatal_error_backtraces_003.phpt similarity index 100% rename from Zend/tests/fatal_error_backtraces_003.phpt rename to Zend/tests/backtrace/fatal_error_backtraces_003.phpt diff --git a/Zend/tests/bug32290.phpt b/Zend/tests/call_user_functions/bug32290.phpt similarity index 100% rename from Zend/tests/bug32290.phpt rename to Zend/tests/call_user_functions/bug32290.phpt diff --git a/Zend/tests/bug43426.phpt b/Zend/tests/call_user_functions/bug43426.phpt similarity index 100% rename from Zend/tests/bug43426.phpt rename to Zend/tests/call_user_functions/bug43426.phpt diff --git a/Zend/tests/bug66719.phpt b/Zend/tests/call_user_functions/bug66719.phpt similarity index 100% rename from Zend/tests/bug66719.phpt rename to Zend/tests/call_user_functions/bug66719.phpt diff --git a/Zend/tests/call_user_func_001.phpt b/Zend/tests/call_user_functions/call_user_func_001.phpt similarity index 100% rename from Zend/tests/call_user_func_001.phpt rename to Zend/tests/call_user_functions/call_user_func_001.phpt diff --git a/Zend/tests/call_user_func_002.phpt b/Zend/tests/call_user_functions/call_user_func_002.phpt similarity index 100% rename from Zend/tests/call_user_func_002.phpt rename to Zend/tests/call_user_functions/call_user_func_002.phpt diff --git a/Zend/tests/call_user_func_003.phpt b/Zend/tests/call_user_functions/call_user_func_003.phpt similarity index 100% rename from Zend/tests/call_user_func_003.phpt rename to Zend/tests/call_user_functions/call_user_func_003.phpt diff --git a/Zend/tests/call_user_func_005.phpt b/Zend/tests/call_user_functions/call_user_func_005.phpt similarity index 100% rename from Zend/tests/call_user_func_005.phpt rename to Zend/tests/call_user_functions/call_user_func_005.phpt diff --git a/Zend/tests/call_user_func_006.phpt b/Zend/tests/call_user_functions/call_user_func_006.phpt similarity index 100% rename from Zend/tests/call_user_func_006.phpt rename to Zend/tests/call_user_functions/call_user_func_006.phpt diff --git a/Zend/tests/call_user_func_007.phpt b/Zend/tests/call_user_functions/call_user_func_007.phpt similarity index 100% rename from Zend/tests/call_user_func_007.phpt rename to Zend/tests/call_user_functions/call_user_func_007.phpt diff --git a/Zend/tests/call_user_func_008.phpt b/Zend/tests/call_user_functions/call_user_func_008.phpt similarity index 100% rename from Zend/tests/call_user_func_008.phpt rename to Zend/tests/call_user_functions/call_user_func_008.phpt diff --git a/Zend/tests/call_user_func_009.phpt b/Zend/tests/call_user_functions/call_user_func_009.phpt similarity index 100% rename from Zend/tests/call_user_func_009.phpt rename to Zend/tests/call_user_functions/call_user_func_009.phpt diff --git a/Zend/tests/call_user_func_array_array_slice_named_args.phpt b/Zend/tests/call_user_functions/call_user_func_array_array_slice_named_args.phpt similarity index 100% rename from Zend/tests/call_user_func_array_array_slice_named_args.phpt rename to Zend/tests/call_user_functions/call_user_func_array_array_slice_named_args.phpt diff --git a/Zend/tests/call_user_func_array_array_slice_type.phpt b/Zend/tests/call_user_functions/call_user_func_array_array_slice_type.phpt similarity index 100% rename from Zend/tests/call_user_func_array_array_slice_type.phpt rename to Zend/tests/call_user_functions/call_user_func_array_array_slice_type.phpt diff --git a/Zend/tests/call_user_func_array_array_slice_type_strict.phpt b/Zend/tests/call_user_functions/call_user_func_array_array_slice_type_strict.phpt similarity index 100% rename from Zend/tests/call_user_func_array_array_slice_type_strict.phpt rename to Zend/tests/call_user_functions/call_user_func_array_array_slice_type_strict.phpt diff --git a/Zend/tests/call_user_func_array_invalid_type.phpt b/Zend/tests/call_user_functions/call_user_func_array_invalid_type.phpt similarity index 100% rename from Zend/tests/call_user_func_array_invalid_type.phpt rename to Zend/tests/call_user_functions/call_user_func_array_invalid_type.phpt diff --git a/Zend/tests/call_user_func_array_prefer_ref.phpt b/Zend/tests/call_user_functions/call_user_func_array_prefer_ref.phpt similarity index 100% rename from Zend/tests/call_user_func_array_prefer_ref.phpt rename to Zend/tests/call_user_functions/call_user_func_array_prefer_ref.phpt diff --git a/Zend/tests/call_user_func_by_ref.phpt b/Zend/tests/call_user_functions/call_user_func_by_ref.phpt similarity index 100% rename from Zend/tests/call_user_func_by_ref.phpt rename to Zend/tests/call_user_functions/call_user_func_by_ref.phpt diff --git a/Zend/tests/call_user_func_closure_from_static_method.phpt b/Zend/tests/call_user_functions/call_user_func_closure_from_static_method.phpt similarity index 100% rename from Zend/tests/call_user_func_closure_from_static_method.phpt rename to Zend/tests/call_user_functions/call_user_func_closure_from_static_method.phpt diff --git a/Zend/tests/call_user_func_strict_arginfo_check.phpt b/Zend/tests/call_user_functions/call_user_func_strict_arginfo_check.phpt similarity index 100% rename from Zend/tests/call_user_func_strict_arginfo_check.phpt rename to Zend/tests/call_user_functions/call_user_func_strict_arginfo_check.phpt diff --git a/Zend/tests/class_name_as_scalar.phpt b/Zend/tests/class_name/class_name_as_scalar.phpt similarity index 100% rename from Zend/tests/class_name_as_scalar.phpt rename to Zend/tests/class_name/class_name_as_scalar.phpt diff --git a/Zend/tests/class_name_as_scalar_error_001.phpt b/Zend/tests/class_name/class_name_as_scalar_error_001.phpt similarity index 100% rename from Zend/tests/class_name_as_scalar_error_001.phpt rename to Zend/tests/class_name/class_name_as_scalar_error_001.phpt diff --git a/Zend/tests/class_name_as_scalar_error_002.phpt b/Zend/tests/class_name/class_name_as_scalar_error_002.phpt similarity index 100% rename from Zend/tests/class_name_as_scalar_error_002.phpt rename to Zend/tests/class_name/class_name_as_scalar_error_002.phpt diff --git a/Zend/tests/class_name_as_scalar_error_003.phpt b/Zend/tests/class_name/class_name_as_scalar_error_003.phpt similarity index 100% rename from Zend/tests/class_name_as_scalar_error_003.phpt rename to Zend/tests/class_name/class_name_as_scalar_error_003.phpt diff --git a/Zend/tests/class_name_as_scalar_error_004.phpt b/Zend/tests/class_name/class_name_as_scalar_error_004.phpt similarity index 100% rename from Zend/tests/class_name_as_scalar_error_004.phpt rename to Zend/tests/class_name/class_name_as_scalar_error_004.phpt diff --git a/Zend/tests/class_name_as_scalar_error_005.phpt b/Zend/tests/class_name/class_name_as_scalar_error_005.phpt similarity index 100% rename from Zend/tests/class_name_as_scalar_error_005.phpt rename to Zend/tests/class_name/class_name_as_scalar_error_005.phpt diff --git a/Zend/tests/class_name_as_scalar_error_006.phpt b/Zend/tests/class_name/class_name_as_scalar_error_006.phpt similarity index 100% rename from Zend/tests/class_name_as_scalar_error_006.phpt rename to Zend/tests/class_name/class_name_as_scalar_error_006.phpt diff --git a/Zend/tests/class_name_as_scalar_error_007.phpt b/Zend/tests/class_name/class_name_as_scalar_error_007.phpt similarity index 100% rename from Zend/tests/class_name_as_scalar_error_007.phpt rename to Zend/tests/class_name/class_name_as_scalar_error_007.phpt diff --git a/Zend/tests/class_on_constant_evaluated_expression.phpt b/Zend/tests/class_name/class_on_constant_evaluated_expression.phpt similarity index 100% rename from Zend/tests/class_on_constant_evaluated_expression.phpt rename to Zend/tests/class_name/class_on_constant_evaluated_expression.phpt diff --git a/Zend/tests/class_on_object.phpt b/Zend/tests/class_name/class_on_object.phpt similarity index 100% rename from Zend/tests/class_on_object.phpt rename to Zend/tests/class_name/class_on_object.phpt diff --git a/Zend/tests/parent_class_name_without_parent.phpt b/Zend/tests/class_name/parent_class_name_without_parent.phpt similarity index 100% rename from Zend/tests/parent_class_name_without_parent.phpt rename to Zend/tests/class_name/parent_class_name_without_parent.phpt diff --git a/Zend/tests/self_class_const_in_unknown_scope.phpt b/Zend/tests/class_name/self_class_const_in_unknown_scope.phpt similarity index 100% rename from Zend/tests/self_class_const_in_unknown_scope.phpt rename to Zend/tests/class_name/self_class_const_in_unknown_scope.phpt diff --git a/Zend/tests/assign_coalesce_001.phpt b/Zend/tests/coalesce/assign_coalesce_001.phpt similarity index 100% rename from Zend/tests/assign_coalesce_001.phpt rename to Zend/tests/coalesce/assign_coalesce_001.phpt diff --git a/Zend/tests/assign_coalesce_002.phpt b/Zend/tests/coalesce/assign_coalesce_002.phpt similarity index 100% rename from Zend/tests/assign_coalesce_002.phpt rename to Zend/tests/coalesce/assign_coalesce_002.phpt diff --git a/Zend/tests/assign_coalesce_003.phpt b/Zend/tests/coalesce/assign_coalesce_003.phpt similarity index 100% rename from Zend/tests/assign_coalesce_003.phpt rename to Zend/tests/coalesce/assign_coalesce_003.phpt diff --git a/Zend/tests/assign_coalesce_004.phpt b/Zend/tests/coalesce/assign_coalesce_004.phpt similarity index 100% rename from Zend/tests/assign_coalesce_004.phpt rename to Zend/tests/coalesce/assign_coalesce_004.phpt diff --git a/Zend/tests/assign_coalesce_005.phpt b/Zend/tests/coalesce/assign_coalesce_005.phpt similarity index 100% rename from Zend/tests/assign_coalesce_005.phpt rename to Zend/tests/coalesce/assign_coalesce_005.phpt diff --git a/Zend/tests/assign_coalesce_006.phpt b/Zend/tests/coalesce/assign_coalesce_006.phpt similarity index 100% rename from Zend/tests/assign_coalesce_006.phpt rename to Zend/tests/coalesce/assign_coalesce_006.phpt diff --git a/Zend/tests/assign_coalesce_007.phpt b/Zend/tests/coalesce/assign_coalesce_007.phpt similarity index 100% rename from Zend/tests/assign_coalesce_007.phpt rename to Zend/tests/coalesce/assign_coalesce_007.phpt diff --git a/Zend/tests/assign_coalesce_008.phpt b/Zend/tests/coalesce/assign_coalesce_008.phpt similarity index 100% rename from Zend/tests/assign_coalesce_008.phpt rename to Zend/tests/coalesce/assign_coalesce_008.phpt diff --git a/Zend/tests/assign_coalesce_009.phpt b/Zend/tests/coalesce/assign_coalesce_009.phpt similarity index 100% rename from Zend/tests/assign_coalesce_009.phpt rename to Zend/tests/coalesce/assign_coalesce_009.phpt diff --git a/Zend/tests/bug69889.phpt b/Zend/tests/coalesce/bug69889.phpt similarity index 100% rename from Zend/tests/bug69889.phpt rename to Zend/tests/coalesce/bug69889.phpt diff --git a/Zend/tests/bug81684.phpt b/Zend/tests/coalesce/bug81684.phpt similarity index 100% rename from Zend/tests/bug81684.phpt rename to Zend/tests/coalesce/bug81684.phpt diff --git a/Zend/tests/coalesce_assign_optimization.phpt b/Zend/tests/coalesce/coalesce_assign_optimization.phpt similarity index 100% rename from Zend/tests/coalesce_assign_optimization.phpt rename to Zend/tests/coalesce/coalesce_assign_optimization.phpt diff --git a/Zend/tests/gh11108.phpt b/Zend/tests/coalesce/gh11108.phpt similarity index 100% rename from Zend/tests/gh11108.phpt rename to Zend/tests/coalesce/gh11108.phpt diff --git a/Zend/tests/gh11108_shutdown.inc b/Zend/tests/coalesce/gh11108_shutdown.inc similarity index 100% rename from Zend/tests/gh11108_shutdown.inc rename to Zend/tests/coalesce/gh11108_shutdown.inc diff --git a/Zend/tests/gh11108_test.inc b/Zend/tests/coalesce/gh11108_test.inc similarity index 100% rename from Zend/tests/gh11108_test.inc rename to Zend/tests/coalesce/gh11108_test.inc diff --git a/Zend/tests/assign_concat_array_empty_string.phpt b/Zend/tests/concat/assign_concat_array_empty_string.phpt similarity index 100% rename from Zend/tests/assign_concat_array_empty_string.phpt rename to Zend/tests/concat/assign_concat_array_empty_string.phpt diff --git a/Zend/tests/bug32833.phpt b/Zend/tests/concat/bug32833.phpt similarity index 100% rename from Zend/tests/bug32833.phpt rename to Zend/tests/concat/bug32833.phpt diff --git a/Zend/tests/bug40809.phpt b/Zend/tests/concat/bug40809.phpt similarity index 100% rename from Zend/tests/bug40809.phpt rename to Zend/tests/concat/bug40809.phpt diff --git a/Zend/tests/bug44069.phpt b/Zend/tests/concat/bug44069.phpt similarity index 100% rename from Zend/tests/bug44069.phpt rename to Zend/tests/concat/bug44069.phpt diff --git a/Zend/tests/bug68118.phpt b/Zend/tests/concat/bug68118.phpt similarity index 100% rename from Zend/tests/bug68118.phpt rename to Zend/tests/concat/bug68118.phpt diff --git a/Zend/tests/bug79836.phpt b/Zend/tests/concat/bug79836.phpt similarity index 100% rename from Zend/tests/bug79836.phpt rename to Zend/tests/concat/bug79836.phpt diff --git a/Zend/tests/bug79836_1.phpt b/Zend/tests/concat/bug79836_1.phpt similarity index 100% rename from Zend/tests/bug79836_1.phpt rename to Zend/tests/concat/bug79836_1.phpt diff --git a/Zend/tests/bug79836_2.phpt b/Zend/tests/concat/bug79836_2.phpt similarity index 100% rename from Zend/tests/bug79836_2.phpt rename to Zend/tests/concat/bug79836_2.phpt diff --git a/Zend/tests/bug79836_3.phpt b/Zend/tests/concat/bug79836_3.phpt similarity index 100% rename from Zend/tests/bug79836_3.phpt rename to Zend/tests/concat/bug79836_3.phpt diff --git a/Zend/tests/bug79836_4.phpt b/Zend/tests/concat/bug79836_4.phpt similarity index 100% rename from Zend/tests/bug79836_4.phpt rename to Zend/tests/concat/bug79836_4.phpt diff --git a/Zend/tests/bug81705.phpt b/Zend/tests/concat/bug81705.phpt similarity index 100% rename from Zend/tests/bug81705.phpt rename to Zend/tests/concat/bug81705.phpt diff --git a/Zend/tests/concat_001.phpt b/Zend/tests/concat/concat_001.phpt similarity index 100% rename from Zend/tests/concat_001.phpt rename to Zend/tests/concat/concat_001.phpt diff --git a/Zend/tests/concat_002.phpt b/Zend/tests/concat/concat_002.phpt similarity index 100% rename from Zend/tests/concat_002.phpt rename to Zend/tests/concat/concat_002.phpt diff --git a/Zend/tests/concat_003.phpt b/Zend/tests/concat/concat_003.phpt similarity index 100% rename from Zend/tests/concat_003.phpt rename to Zend/tests/concat/concat_003.phpt diff --git a/Zend/tests/008.phpt b/Zend/tests/constants/008.phpt similarity index 100% rename from Zend/tests/008.phpt rename to Zend/tests/constants/008.phpt diff --git a/Zend/tests/018.phpt b/Zend/tests/constants/018.phpt similarity index 100% rename from Zend/tests/018.phpt rename to Zend/tests/constants/018.phpt diff --git a/Zend/tests/bug42820.phpt b/Zend/tests/constants/bug42820.phpt similarity index 100% rename from Zend/tests/bug42820.phpt rename to Zend/tests/constants/bug42820.phpt diff --git a/Zend/tests/bug76430.phpt b/Zend/tests/constants/bug76430.phpt similarity index 100% rename from Zend/tests/bug76430.phpt rename to Zend/tests/constants/bug76430.phpt diff --git a/Zend/tests/const_deprecation.phpt b/Zend/tests/constants/const_deprecation.phpt similarity index 100% rename from Zend/tests/const_deprecation.phpt rename to Zend/tests/constants/const_deprecation.phpt diff --git a/Zend/tests/defined_fn_no_ns_fallback.phpt b/Zend/tests/constants/defined_fn_no_ns_fallback.phpt similarity index 100% rename from Zend/tests/defined_fn_no_ns_fallback.phpt rename to Zend/tests/constants/defined_fn_no_ns_fallback.phpt diff --git a/Zend/tests/gh17222.phpt b/Zend/tests/constants/gh17222.phpt similarity index 100% rename from Zend/tests/gh17222.phpt rename to Zend/tests/constants/gh17222.phpt diff --git a/Zend/tests/oss_fuzz_57821.phpt b/Zend/tests/constants/oss_fuzz_57821.phpt similarity index 100% rename from Zend/tests/oss_fuzz_57821.phpt rename to Zend/tests/constants/oss_fuzz_57821.phpt diff --git a/Zend/tests/selfParent_001.phpt b/Zend/tests/constants/selfParent_001.phpt similarity index 100% rename from Zend/tests/selfParent_001.phpt rename to Zend/tests/constants/selfParent_001.phpt diff --git a/Zend/tests/selfParent_002.phpt b/Zend/tests/constants/selfParent_002.phpt similarity index 100% rename from Zend/tests/selfParent_002.phpt rename to Zend/tests/constants/selfParent_002.phpt diff --git a/Zend/tests/constant_expressions/class_on_expression_in_constant_expression.phpt b/Zend/tests/constexpr/class_on_expression_in_constant_expression.phpt similarity index 100% rename from Zend/tests/constant_expressions/class_on_expression_in_constant_expression.phpt rename to Zend/tests/constexpr/class_on_expression_in_constant_expression.phpt diff --git a/Zend/tests/const_expr_dim_on_null_warning.phpt b/Zend/tests/constexpr/const_expr_dim_on_null_warning.phpt similarity index 100% rename from Zend/tests/const_expr_dim_on_null_warning.phpt rename to Zend/tests/constexpr/const_expr_dim_on_null_warning.phpt diff --git a/Zend/tests/constant_expressions/constant_expressions.phpt b/Zend/tests/constexpr/constant_expressions.phpt similarity index 100% rename from Zend/tests/constant_expressions/constant_expressions.phpt rename to Zend/tests/constexpr/constant_expressions.phpt diff --git a/Zend/tests/constant_expressions/constant_expressions_arrays.phpt b/Zend/tests/constexpr/constant_expressions_arrays.phpt similarity index 100% rename from Zend/tests/constant_expressions/constant_expressions_arrays.phpt rename to Zend/tests/constexpr/constant_expressions_arrays.phpt diff --git a/Zend/tests/constant_expressions/constant_expressions_classes.phpt b/Zend/tests/constexpr/constant_expressions_classes.phpt similarity index 100% rename from Zend/tests/constant_expressions/constant_expressions_classes.phpt rename to Zend/tests/constexpr/constant_expressions_classes.phpt diff --git a/Zend/tests/constant_expressions/constant_expressions_coalesce.phpt b/Zend/tests/constexpr/constant_expressions_coalesce.phpt similarity index 100% rename from Zend/tests/constant_expressions/constant_expressions_coalesce.phpt rename to Zend/tests/constexpr/constant_expressions_coalesce.phpt diff --git a/Zend/tests/constant_expressions/constant_expressions_coalesce_empty_dim.phpt b/Zend/tests/constexpr/constant_expressions_coalesce_empty_dim.phpt similarity index 100% rename from Zend/tests/constant_expressions/constant_expressions_coalesce_empty_dim.phpt rename to Zend/tests/constexpr/constant_expressions_coalesce_empty_dim.phpt diff --git a/Zend/tests/constant_expressions/constant_expressions_dynamic.phpt b/Zend/tests/constexpr/constant_expressions_dynamic.phpt similarity index 100% rename from Zend/tests/constant_expressions/constant_expressions_dynamic.phpt rename to Zend/tests/constexpr/constant_expressions_dynamic.phpt diff --git a/Zend/tests/constant_expressions/constant_expressions_dynamic_class_name_error.phpt b/Zend/tests/constexpr/constant_expressions_dynamic_class_name_error.phpt similarity index 100% rename from Zend/tests/constant_expressions/constant_expressions_dynamic_class_name_error.phpt rename to Zend/tests/constexpr/constant_expressions_dynamic_class_name_error.phpt diff --git a/Zend/tests/constant_expressions/constant_expressions_exceptions.inc b/Zend/tests/constexpr/constant_expressions_exceptions.inc similarity index 100% rename from Zend/tests/constant_expressions/constant_expressions_exceptions.inc rename to Zend/tests/constexpr/constant_expressions_exceptions.inc diff --git a/Zend/tests/constant_expressions/constant_expressions_exceptions_001.phpt b/Zend/tests/constexpr/constant_expressions_exceptions_001.phpt similarity index 100% rename from Zend/tests/constant_expressions/constant_expressions_exceptions_001.phpt rename to Zend/tests/constexpr/constant_expressions_exceptions_001.phpt diff --git a/Zend/tests/constant_expressions/constant_expressions_exceptions_002.phpt b/Zend/tests/constexpr/constant_expressions_exceptions_002.phpt similarity index 100% rename from Zend/tests/constant_expressions/constant_expressions_exceptions_002.phpt rename to Zend/tests/constexpr/constant_expressions_exceptions_002.phpt diff --git a/Zend/tests/constant_expressions/constant_expressions_invalid_offset_type_error.phpt b/Zend/tests/constexpr/constant_expressions_invalid_offset_type_error.phpt similarity index 100% rename from Zend/tests/constant_expressions/constant_expressions_invalid_offset_type_error.phpt rename to Zend/tests/constexpr/constant_expressions_invalid_offset_type_error.phpt diff --git a/Zend/tests/constant_expressions/constant_expressions_self_referencing_array.phpt b/Zend/tests/constexpr/constant_expressions_self_referencing_array.phpt similarity index 100% rename from Zend/tests/constant_expressions/constant_expressions_self_referencing_array.phpt rename to Zend/tests/constexpr/constant_expressions_self_referencing_array.phpt diff --git a/Zend/tests/constant_expressions/constant_expressions_static_class_name_error.phpt b/Zend/tests/constexpr/constant_expressions_static_class_name_error.phpt similarity index 100% rename from Zend/tests/constant_expressions/constant_expressions_static_class_name_error.phpt rename to Zend/tests/constexpr/constant_expressions_static_class_name_error.phpt diff --git a/Zend/tests/constant_expressions/gh10014.phpt b/Zend/tests/constexpr/gh10014.phpt similarity index 100% rename from Zend/tests/constant_expressions/gh10014.phpt rename to Zend/tests/constexpr/gh10014.phpt diff --git a/Zend/tests/constant_expressions/gh10356.phpt b/Zend/tests/constexpr/gh10356.phpt similarity index 100% rename from Zend/tests/constant_expressions/gh10356.phpt rename to Zend/tests/constexpr/gh10356.phpt diff --git a/Zend/tests/constant_expressions/gh7771_1.phpt b/Zend/tests/constexpr/gh7771_1.phpt similarity index 100% rename from Zend/tests/constant_expressions/gh7771_1.phpt rename to Zend/tests/constexpr/gh7771_1.phpt diff --git a/Zend/tests/constant_expressions/gh7771_1_definition.inc b/Zend/tests/constexpr/gh7771_1_definition.inc similarity index 100% rename from Zend/tests/constant_expressions/gh7771_1_definition.inc rename to Zend/tests/constexpr/gh7771_1_definition.inc diff --git a/Zend/tests/constant_expressions/gh7771_2.phpt b/Zend/tests/constexpr/gh7771_2.phpt similarity index 100% rename from Zend/tests/constant_expressions/gh7771_2.phpt rename to Zend/tests/constexpr/gh7771_2.phpt diff --git a/Zend/tests/constant_expressions/gh7771_2_definition.inc b/Zend/tests/constexpr/gh7771_2_definition.inc similarity index 100% rename from Zend/tests/constant_expressions/gh7771_2_definition.inc rename to Zend/tests/constexpr/gh7771_2_definition.inc diff --git a/Zend/tests/constant_expressions/gh7771_3.phpt b/Zend/tests/constexpr/gh7771_3.phpt similarity index 100% rename from Zend/tests/constant_expressions/gh7771_3.phpt rename to Zend/tests/constexpr/gh7771_3.phpt diff --git a/Zend/tests/constant_expressions/gh9136.phpt b/Zend/tests/constexpr/gh9136.phpt similarity index 100% rename from Zend/tests/constant_expressions/gh9136.phpt rename to Zend/tests/constexpr/gh9136.phpt diff --git a/Zend/tests/constant_expressions/gh9136_2.phpt b/Zend/tests/constexpr/gh9136_2.phpt similarity index 100% rename from Zend/tests/constant_expressions/gh9136_2.phpt rename to Zend/tests/constexpr/gh9136_2.phpt diff --git a/Zend/tests/constant_expressions/gh9138.phpt b/Zend/tests/constexpr/gh9138.phpt similarity index 100% rename from Zend/tests/constant_expressions/gh9138.phpt rename to Zend/tests/constexpr/gh9138.phpt diff --git a/Zend/tests/constant_expressions/gh9138_2.phpt b/Zend/tests/constexpr/gh9138_2.phpt similarity index 100% rename from Zend/tests/constant_expressions/gh9138_2.phpt rename to Zend/tests/constexpr/gh9138_2.phpt diff --git a/Zend/tests/constexpr/new_dynamic_class_name.phpt b/Zend/tests/constexpr/new_dynamic_class_name.phpt index 60ae3ea4195d7..bd7aa07bd1e75 100644 --- a/Zend/tests/constexpr/new_dynamic_class_name.phpt +++ b/Zend/tests/constexpr/new_dynamic_class_name.phpt @@ -1,5 +1,5 @@ --TEST-- -Dynamic class name in new is not supported +Dynamic class name in new is supported --FILE-- module = EG(current_module); zif->scope = ce; zif->T = ZEND_OBSERVER_ENABLED; - if (EG(active)) { // at run-time + if (EG(active)) { // at run-time + if (CG(compiler_options) & ZEND_COMPILE_PRELOAD) { + zif->fn_flags |= ZEND_ACC_PRELOADED; + } ZEND_MAP_PTR_INIT(zif->run_time_cache, zend_arena_calloc(&CG(arena), 1, zend_internal_run_time_cache_reserved_size())); } else { #ifdef ZTS diff --git a/Zend/zend_map_ptr.h b/Zend/zend_map_ptr.h index ebcda89411d0e..4dfa0e5043ef4 100644 --- a/Zend/zend_map_ptr.h +++ b/Zend/zend_map_ptr.h @@ -70,6 +70,9 @@ typedef struct _zend_string zend_string; } while (0) # define ZEND_MAP_PTR_BIASED_BASE(real_base) \ ((void*)(((uintptr_t)(real_base)) + zend_map_ptr_static_size * sizeof(void *) - 1)) +/* Note: chunked like: [8192..12287][4096..8191][0..4095] */ +#define ZEND_MAP_PTR_STATIC_NUM_TO_PTR(num) \ + ((void **)CG(map_ptr_real_base) + zend_map_ptr_static_size - ZEND_MM_ALIGNED_SIZE_EX((num) + 1, 4096) + ((num) & 4095)) #else # error "Unknown ZEND_MAP_PTR_KIND" #endif diff --git a/ext/bz2/bz2_filter.c b/ext/bz2/bz2_filter.c index bdeb280bfa690..2fbdf9452dad3 100644 --- a/ext/bz2/bz2_filter.c +++ b/ext/bz2/bz2_filter.c @@ -50,12 +50,12 @@ typedef struct _php_bz2_filter_data { static void *php_bz2_alloc(void *opaque, int items, int size) { - return (void *)safe_pemalloc(items, size, 0, ((php_bz2_filter_data*)opaque)->persistent); + return safe_pemalloc(items, size, 0, ((php_bz2_filter_data*)opaque)->persistent); } static void php_bz2_free(void *opaque, void *address) { - pefree((void *)address, ((php_bz2_filter_data*)opaque)->persistent); + pefree(address, ((php_bz2_filter_data*)opaque)->persistent); } /* }}} */ diff --git a/ext/dom/document.c b/ext/dom/document.c index 378f076c56068..853275e3e232d 100644 --- a/ext/dom/document.c +++ b/ext/dom/document.c @@ -194,13 +194,12 @@ zend_result dom_document_version_write(dom_object *obj, zval *newval) { DOM_PROP_NODE(xmlDocPtr, docp, obj); - /* Cannot fail because the type is either null or a string. */ - zend_string *str = zval_get_string(newval); + /* Type is ?string */ + zend_string *str = Z_TYPE_P(newval) == IS_NULL ? ZSTR_EMPTY_ALLOC() : Z_STR_P(newval); if (php_dom_follow_spec_intern(obj)) { if (!zend_string_equals_literal(str, "1.0") && !zend_string_equals_literal(str, "1.1")) { zend_value_error("Invalid XML version"); - zend_string_release_ex(str, 0); return FAILURE; } } @@ -211,7 +210,6 @@ zend_result dom_document_version_write(dom_object *obj, zval *newval) docp->version = xmlStrdup((const xmlChar *) ZSTR_VAL(str)); - zend_string_release_ex(str, 0); return SUCCESS; } @@ -394,8 +392,8 @@ zend_result dom_document_document_uri_write(dom_object *obj, zval *newval) { DOM_PROP_NODE(xmlDocPtr, docp, obj); - /* Cannot fail because the type is either null or a string. */ - zend_string *str = zval_get_string(newval); + /* Type is ?string */ + zend_string *str = Z_TYPE_P(newval) == IS_NULL ? ZSTR_EMPTY_ALLOC() : Z_STR_P(newval); if (docp->URL != NULL) { xmlFree(BAD_CAST docp->URL); @@ -403,7 +401,6 @@ zend_result dom_document_document_uri_write(dom_object *obj, zval *newval) docp->URL = xmlStrdup((const xmlChar *) ZSTR_VAL(str)); - zend_string_release_ex(str, 0); return SUCCESS; } @@ -1668,47 +1665,6 @@ PHP_METHOD(Dom_XMLDocument, saveXml) } /* }}} end dom_document_savexml */ -static xmlNodePtr php_dom_free_xinclude_node(xmlNodePtr cur) /* {{{ */ -{ - xmlNodePtr xincnode; - - xincnode = cur; - cur = cur->next; - xmlUnlinkNode(xincnode); - php_libxml_node_free_resource(xincnode); - - return cur; -} -/* }}} */ - -static void php_dom_remove_xinclude_nodes(xmlNodePtr cur) /* {{{ */ -{ - while(cur) { - if (cur->type == XML_XINCLUDE_START) { - cur = php_dom_free_xinclude_node(cur); - - /* XML_XINCLUDE_END node will be a sibling of XML_XINCLUDE_START */ - while(cur && cur->type != XML_XINCLUDE_END) { - /* remove xinclude processing nodes from recursive xincludes */ - if (cur->type == XML_ELEMENT_NODE) { - php_dom_remove_xinclude_nodes(cur->children); - } - cur = cur->next; - } - - if (cur && cur->type == XML_XINCLUDE_END) { - cur = php_dom_free_xinclude_node(cur); - } - } else { - if (cur->type == XML_ELEMENT_NODE) { - php_dom_remove_xinclude_nodes(cur->children); - } - cur = cur->next; - } - } -} -/* }}} */ - static void dom_xinclude_strip_references(xmlNodePtr basep) { php_libxml_node_free_resource(basep); @@ -1721,17 +1677,19 @@ static void dom_xinclude_strip_references(xmlNodePtr basep) } } -/* See GH-14702. - * We have to remove userland references to xinclude fallback nodes because libxml2 will make clones of these +/* See GH-14702 and GH-17847. + * We have to remove userland references to xinclude nodes because libxml2 will make clones of these * and remove the original nodes. If the originals are removed while there are still userland references * this will cause memory corruption. */ static void dom_xinclude_strip_fallback_references(const xmlNode *basep) { xmlNodePtr current = basep->children; + /* TODO: try to improve loop search performance */ while (current) { - if (current->type == XML_ELEMENT_NODE && current->ns != NULL && current->_private != NULL - && xmlStrEqual(current->name, XINCLUDE_FALLBACK) + if (current->type == XML_ELEMENT_NODE + && current->ns != NULL + && xmlStrEqual(current->name, XINCLUDE_NODE) && (xmlStrEqual(current->ns->href, XINCLUDE_NS) || xmlStrEqual(current->ns->href, XINCLUDE_OLD_NS))) { dom_xinclude_strip_references(current); } @@ -1744,22 +1702,11 @@ static int dom_perform_xinclude(xmlDocPtr docp, dom_object *intern, zend_long fl { dom_xinclude_strip_fallback_references((const xmlNode *) docp); + flags |= XML_PARSE_NOXINCNODE; PHP_LIBXML_SANITIZE_GLOBALS(xinclude); int err = xmlXIncludeProcessFlags(docp, (int)flags); PHP_LIBXML_RESTORE_GLOBALS(xinclude); - /* XML_XINCLUDE_START and XML_XINCLUDE_END nodes need to be removed as these - are added via xmlXIncludeProcess to mark beginning and ending of xincluded document - but are not wanted in resulting document - must be done even if err as it could fail after - having processed some xincludes */ - xmlNodePtr root = docp->children; - while (root && root->type != XML_ELEMENT_NODE && root->type != XML_XINCLUDE_START) { - root = root->next; - } - if (root) { - php_dom_remove_xinclude_nodes(root); - } - php_libxml_invalidate_node_list_cache(intern->document); return err; diff --git a/ext/dom/node.c b/ext/dom/node.c index 9ff6c4a489616..c9bf45e887db8 100644 --- a/ext/dom/node.c +++ b/ext/dom/node.c @@ -185,8 +185,8 @@ zend_result dom_node_node_value_write(dom_object *obj, zval *newval) { DOM_PROP_NODE(xmlNodePtr, nodep, obj); - /* Cannot fail because the type is either null or a string. */ - zend_string *str = zval_get_string(newval); + /* Type is ?string */ + zend_string *str = Z_TYPE_P(newval) == IS_NULL ? ZSTR_EMPTY_ALLOC() : Z_STR_P(newval); /* Access to Element node is implemented as a convenience method */ switch (nodep->type) { @@ -213,7 +213,6 @@ zend_result dom_node_node_value_write(dom_object *obj, zval *newval) php_libxml_invalidate_node_list_cache(obj->document); - zend_string_release_ex(str, 0); return SUCCESS; } diff --git a/ext/dom/tests/gh17847.phpt b/ext/dom/tests/gh17847.phpt new file mode 100644 index 0000000000000..c32263bfe240f --- /dev/null +++ b/ext/dom/tests/gh17847.phpt @@ -0,0 +1,41 @@ +--TEST-- +GH-17847 (xinclude destroys live node) +--EXTENSIONS-- +dom +--FILE-- +loadXML(<< + + fallback

garbage

+

garbage

+
+ + +

garbage

+
+
+ +XML); + +$xpath = new DOMXPath($doc); + +$garbage = []; +foreach ($xpath->query('//p') as $entry) + $garbage[] = $entry; + +@$doc->xinclude(); + +foreach ($garbage as $node) { + try { + var_dump($node->localName); + } catch (DOMException $e) { + echo $e->getMessage(), "\n"; + } +} +?> +--EXPECT-- +Invalid State Error +Invalid State Error +Invalid State Error diff --git a/ext/dom/tests/modern/xml/return_dom_node_from_xpath.phpt b/ext/dom/tests/modern/xml/return_dom_node_from_xpath.phpt new file mode 100644 index 0000000000000..4388139c43cbb --- /dev/null +++ b/ext/dom/tests/modern/xml/return_dom_node_from_xpath.phpt @@ -0,0 +1,17 @@ +--TEST-- +Returning a Dom\Node from Dom\XPath callback +--EXTENSIONS-- +dom +--FILE-- +'); +$xpath = new Dom\XPath($dom); +$xpath->registerPhpFunctionNs('urn:x', 'test', fn() => $dom->createElement('foo')); +$xpath->registerNamespace('x', 'urn:x'); +$test = $xpath->query('x:test()'); +var_dump($test[0]->nodeName); + +?> +--EXPECT-- +string(3) "foo" diff --git a/ext/dom/xpath_callbacks.c b/ext/dom/xpath_callbacks.c index 3b12a80ac1eeb..c4715fa67e80a 100644 --- a/ext/dom/xpath_callbacks.c +++ b/ext/dom/xpath_callbacks.c @@ -24,6 +24,7 @@ #if defined(HAVE_LIBXML) && defined(HAVE_DOM) #include "php_dom.h" +#include "internal_helpers.h" #include static void xpath_callbacks_entry_dtor(zval *zv) @@ -205,13 +206,14 @@ static zend_result php_dom_xpath_callback_ns_update_method_handler( ZVAL_PTR(®istered_value, fcc); if (!key) { - zend_string *str = zval_try_get_string(entry); + zend_string *tmp_str; + zend_string *str = zval_try_get_tmp_string(entry, &tmp_str); if (str && php_dom_xpath_is_callback_name_valid_and_throw(str, name_validation, true)) { zend_hash_update(&ns->functions, str, ®istered_value); if (register_func) { register_func(ctxt, namespace, str); } - zend_string_release_ex(str, false); + zend_tmp_string_release(tmp_str); } else { zend_fcc_dtor(fcc); efree(fcc); @@ -425,7 +427,8 @@ static zend_result php_dom_xpath_callback_dispatch(php_dom_xpath_callbacks *xpat } if (Z_TYPE(callback_retval) != IS_UNDEF) { - if (Z_TYPE(callback_retval) == IS_OBJECT && instanceof_function(Z_OBJCE(callback_retval), dom_node_class_entry)) { + if (Z_TYPE(callback_retval) == IS_OBJECT + && (instanceof_function(Z_OBJCE(callback_retval), dom_get_node_ce(php_dom_follow_spec_node((const xmlNode *) ctxt->context->doc))))) { xmlNode *nodep; dom_object *obj; if (xpath_callbacks->node_list == NULL) { @@ -439,13 +442,14 @@ static zend_result php_dom_xpath_callback_dispatch(php_dom_xpath_callbacks *xpat } else if (Z_TYPE(callback_retval) == IS_FALSE || Z_TYPE(callback_retval) == IS_TRUE) { valuePush(ctxt, xmlXPathNewBoolean(Z_TYPE(callback_retval) == IS_TRUE)); } else if (Z_TYPE(callback_retval) == IS_OBJECT) { - zend_type_error("Only objects that are instances of DOMNode can be converted to an XPath expression"); + zend_type_error("Only objects that are instances of DOM nodes can be converted to an XPath expression"); zval_ptr_dtor(&callback_retval); return FAILURE; } else { - zend_string *str = zval_get_string(&callback_retval); + zend_string *tmp_str; + zend_string *str = zval_get_tmp_string(&callback_retval, &tmp_str); valuePush(ctxt, xmlXPathNewString(BAD_CAST ZSTR_VAL(str))); - zend_string_release_ex(str, 0); + zend_tmp_string_release(tmp_str); } zval_ptr_dtor(&callback_retval); } diff --git a/ext/gd/tests/gh17373.phpt b/ext/gd/tests/gh17373.phpt index 354cdd07362b2..f62c74fbd3e05 100644 --- a/ext/gd/tests/gh17373.phpt +++ b/ext/gd/tests/gh17373.phpt @@ -2,6 +2,10 @@ Bug GH-17373 (imagefttext() ignores clipping rect for palette images) --EXTENSIONS-- gd +--SKIPIF-- + --FILE-- 0) && !IS_SLASH(ZSTR_VAL(parent_script)[parent_script_len])); + while (parent_script_len > 0) { + --parent_script_len; + if (IS_SLASH(ZSTR_VAL(parent_script)[parent_script_len])) { + break; + } + } if (UNEXPECTED((size_t)(key_length + parent_script_len + 1) >= ZCG_KEY_LEN)) { return NULL; @@ -2616,6 +2621,7 @@ static void zend_reset_cache_vars(void) ZCSG(restart_pending) = false; ZCSG(force_restart_time) = 0; ZCSG(map_ptr_last) = CG(map_ptr_last); + ZCSG(map_ptr_static_last) = zend_map_ptr_static_last; } static void accel_reset_pcre_cache(void) @@ -2631,7 +2637,7 @@ static void accel_reset_pcre_cache(void) } ZEND_HASH_FOREACH_END(); } -zend_result accel_activate(INIT_FUNC_ARGS) +ZEND_RINIT_FUNCTION(zend_accelerator) { if (!ZCG(enabled) || !accel_startup_ok) { ZCG(accelerator_enabled) = false; @@ -2967,12 +2973,15 @@ static void accel_globals_ctor(zend_accel_globals *accel_globals) GC_MAKE_PERSISTENT_LOCAL(accel_globals->key); } -#ifdef ZTS static void accel_globals_dtor(zend_accel_globals *accel_globals) { +#ifdef ZTS zend_string_free(accel_globals->key); -} #endif + if (accel_globals->preloaded_internal_run_time_cache) { + pefree(accel_globals->preloaded_internal_run_time_cache, 1); + } +} #ifdef HAVE_HUGE_CODE_PAGES # ifndef _WIN32 @@ -3461,6 +3470,8 @@ void accel_shutdown(void) if (!ZCG(enabled) || !accel_startup_ok) { #ifdef ZTS ts_free_id(accel_globals_id); +#else + accel_globals_dtor(&accel_globals); #endif return; } @@ -3477,6 +3488,8 @@ void accel_shutdown(void) #ifdef ZTS ts_free_id(accel_globals_id); +#else + accel_globals_dtor(&accel_globals); #endif if (!_file_cache_only) { @@ -4377,7 +4390,7 @@ static zend_persistent_script* preload_script_in_shared_memory(zend_persistent_s return new_persistent_script; } -static void preload_load(void) +static void preload_load(size_t orig_map_ptr_static_last) { /* Load into process tables */ zend_script *script = &ZCSG(preload_script)->script; @@ -4412,14 +4425,42 @@ static void preload_load(void) if (EG(class_table)) { EG(persistent_classes_count) = EG(class_table)->nNumUsed; } - if (CG(map_ptr_last) != ZCSG(map_ptr_last)) { - size_t old_map_ptr_last = CG(map_ptr_last); + + size_t old_map_ptr_last = CG(map_ptr_last); + if (zend_map_ptr_static_last != ZCSG(map_ptr_static_last) || old_map_ptr_last != ZCSG(map_ptr_last)) { CG(map_ptr_last) = ZCSG(map_ptr_last); - CG(map_ptr_size) = ZEND_MM_ALIGNED_SIZE_EX(CG(map_ptr_last) + 1, 4096); - CG(map_ptr_real_base) = perealloc(CG(map_ptr_real_base), CG(map_ptr_size) * sizeof(void*), 1); + CG(map_ptr_size) = ZEND_MM_ALIGNED_SIZE_EX(ZCSG(map_ptr_last) + 1, 4096); + zend_map_ptr_static_last = ZCSG(map_ptr_static_last); + + /* Grow map_ptr table as needed, but allocate once for static + regular map_ptrs */ + size_t new_static_size = ZEND_MM_ALIGNED_SIZE_EX(zend_map_ptr_static_last, 4096); + if (zend_map_ptr_static_size != new_static_size) { + void *new_base = pemalloc((new_static_size + CG(map_ptr_size)) * sizeof(void *), 1); + if (CG(map_ptr_real_base)) { + memcpy((void **) new_base + new_static_size - zend_map_ptr_static_size, CG(map_ptr_real_base), (old_map_ptr_last + zend_map_ptr_static_size) * sizeof(void *)); + pefree(CG(map_ptr_real_base), 1); + } + CG(map_ptr_real_base) = new_base; + zend_map_ptr_static_size = new_static_size; + } else { + CG(map_ptr_real_base) = perealloc(CG(map_ptr_real_base), (zend_map_ptr_static_size + CG(map_ptr_size)) * sizeof(void *), 1); + } + + memset((void **) CG(map_ptr_real_base) + zend_map_ptr_static_size + old_map_ptr_last, 0, (CG(map_ptr_last) - old_map_ptr_last) * sizeof(void *)); CG(map_ptr_base) = ZEND_MAP_PTR_BIASED_BASE(CG(map_ptr_real_base)); - memset((void **) CG(map_ptr_real_base) + old_map_ptr_last, 0, - (CG(map_ptr_last) - old_map_ptr_last) * sizeof(void *)); + } + + if (orig_map_ptr_static_last != zend_map_ptr_static_last) { + /* preloaded static entries currently are all runtime cache pointers, just assign them as such */ + size_t runtime_cache_size = zend_internal_run_time_cache_reserved_size(); + ZCG(preloaded_internal_run_time_cache_size) = (zend_map_ptr_static_last - orig_map_ptr_static_last) * runtime_cache_size; + char *cache = pemalloc(ZCG(preloaded_internal_run_time_cache_size), 1); + ZCG(preloaded_internal_run_time_cache) = cache; + + for (size_t cur_static_map_ptr = orig_map_ptr_static_last; cur_static_map_ptr < zend_map_ptr_static_last; ++cur_static_map_ptr) { + *ZEND_MAP_PTR_STATIC_NUM_TO_PTR(cur_static_map_ptr) = cache; + cache += runtime_cache_size; + } } } @@ -4428,7 +4469,7 @@ static zend_result accel_preload(const char *config, bool in_child) zend_file_handle file_handle; zend_result ret; char *orig_open_basedir; - size_t orig_map_ptr_last; + size_t orig_map_ptr_last, orig_map_ptr_static_last; uint32_t orig_compiler_options; ZCG(enabled) = false; @@ -4439,6 +4480,7 @@ static zend_result accel_preload(const char *config, bool in_child) accelerator_orig_compile_file = preload_compile_file; orig_map_ptr_last = CG(map_ptr_last); + orig_map_ptr_static_last = zend_map_ptr_static_last; /* Compile and execute preloading script */ zend_stream_init_filename(&file_handle, (char *) config); @@ -4618,7 +4660,7 @@ static zend_result accel_preload(const char *config, bool in_child) SHM_PROTECT(); HANDLE_UNBLOCK_INTERRUPTIONS(); - preload_load(); + preload_load(orig_map_ptr_static_last); /* Store individual scripts with unlinked classes */ HANDLE_BLOCK_INTERRUPTIONS(); @@ -4869,7 +4911,7 @@ static zend_result accel_finish_startup(void) if (ZCSG(preload_script)) { /* Preloading was done in another process */ - preload_load(); + preload_load(zend_map_ptr_static_last); zend_shared_alloc_unlock(); return SUCCESS; } @@ -4897,7 +4939,7 @@ static zend_result accel_finish_startup(void) } if (ZCSG(preload_script)) { - preload_load(); + preload_load(zend_map_ptr_static_last); } zend_shared_alloc_unlock(); @@ -4911,6 +4953,12 @@ static zend_result accel_finish_startup(void) #endif /* ZEND_WIN32 */ } +static void accel_activate(void) { + if (ZCG(preloaded_internal_run_time_cache)) { + memset(ZCG(preloaded_internal_run_time_cache), 0, ZCG(preloaded_internal_run_time_cache_size)); + } +} + ZEND_EXT_API zend_extension zend_extension_entry = { ACCELERATOR_PRODUCT_NAME, /* name */ PHP_VERSION, /* version */ @@ -4919,7 +4967,7 @@ ZEND_EXT_API zend_extension zend_extension_entry = { "Copyright (c)", /* copyright */ accel_startup, /* startup */ NULL, /* shutdown */ - NULL, /* per-script activation */ + accel_activate, /* per-script activation */ #ifdef HAVE_JIT accel_deactivate, /* per-script deactivation */ #else diff --git a/ext/opcache/ZendAccelerator.h b/ext/opcache/ZendAccelerator.h index 440d09e235dc5..1bac9af9b8b7a 100644 --- a/ext/opcache/ZendAccelerator.h +++ b/ext/opcache/ZendAccelerator.h @@ -50,6 +50,7 @@ #include "zend_extensions.h" #include "zend_compile.h" +#include "zend_API.h" #include "Optimizer/zend_optimizer.h" #include "zend_accelerator_hash.h" @@ -217,6 +218,8 @@ typedef struct _zend_accel_globals { #ifndef ZEND_WIN32 zend_ulong root_hash; #endif + void *preloaded_internal_run_time_cache; + size_t preloaded_internal_run_time_cache_size; /* preallocated shared-memory block to save current script */ void *mem; zend_persistent_script *current_persistent_script; @@ -252,6 +255,7 @@ typedef struct _zend_accel_shared_globals { zend_accel_hash hash; /* hash table for cached scripts */ size_t map_ptr_last; + size_t map_ptr_static_last; /* Directives & Maintenance */ time_t start_time; @@ -311,7 +315,7 @@ extern const char *zps_api_failure_reason; BEGIN_EXTERN_C() void accel_shutdown(void); -zend_result accel_activate(INIT_FUNC_ARGS); +ZEND_RINIT_FUNCTION(zend_accelerator); zend_result accel_post_deactivate(void); void zend_accel_schedule_restart(zend_accel_restart_reason reason); void zend_accel_schedule_restart_if_necessary(zend_accel_restart_reason reason); diff --git a/ext/opcache/tests/preload_enum_observed.phpt b/ext/opcache/tests/preload_enum_observed.phpt new file mode 100644 index 0000000000000..7898fa084a5ff --- /dev/null +++ b/ext/opcache/tests/preload_enum_observed.phpt @@ -0,0 +1,55 @@ +--TEST-- +Enum preloading with observers +--EXTENSIONS-- +opcache +zend_test +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +opcache.preload={PWD}/preload_enum.inc +zend_test.observer.enabled=1 +zend_test.observer.show_output=1 +zend_test.observer.observe_all=1 +--SKIPIF-- + +--FILE-- + +--EXPECTF-- + + + + +enum(MyEnum::Bar) + + + + + + + + + + + + +array(2) { + [0]=> + enum(MyEnum::Foo) + [1]=> + enum(MyEnum::Bar) +} + + diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c index e6642c76e1a93..0c52b98dc453c 100644 --- a/ext/opcache/zend_accelerator_module.c +++ b/ext/opcache/zend_accelerator_module.c @@ -559,7 +559,7 @@ static zend_module_entry accel_module_entry = { ext_functions, ZEND_MINIT(zend_accelerator), ZEND_MSHUTDOWN(zend_accelerator), - accel_activate, + ZEND_RINIT(zend_accelerator), NULL, zend_accel_info, PHP_VERSION, diff --git a/ext/opcache/zend_persist.c b/ext/opcache/zend_persist.c index df088d1231b75..3d45c63a98781 100644 --- a/ext/opcache/zend_persist.c +++ b/ext/opcache/zend_persist.c @@ -748,7 +748,11 @@ static zend_op_array *zend_persist_class_method(zend_op_array *op_array, zend_cl // Real dynamically created internal functions like enum methods must have their own run_time_cache pointer. They're always on the same scope as their defining class. // However, copies - as caused by inheritance of internal methods - must retain the original run_time_cache pointer, shared with the source function. if (!op_array->scope || (op_array->scope == ce && !(op_array->fn_flags & ZEND_ACC_TRAIT_CLONE))) { - ZEND_MAP_PTR_NEW(op_array->run_time_cache); + if (op_array->fn_flags & ZEND_ACC_PRELOADED) { + ZEND_MAP_PTR_NEW_STATIC(op_array->run_time_cache); + } else { + ZEND_MAP_PTR_NEW(op_array->run_time_cache); + } } } } @@ -1426,6 +1430,7 @@ zend_persistent_script *zend_accel_script_persist(zend_persistent_script *script if (for_shm) { ZCSG(map_ptr_last) = CG(map_ptr_last); + ZCSG(map_ptr_static_last) = zend_map_ptr_static_last; } #ifdef HAVE_JIT diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 339ed2390413d..a2a577a6745a0 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -1563,9 +1563,12 @@ static zend_string *preg_do_repl_func(zend_fcall_info *fci, zend_fcall_info_cach fci->params = &arg; zend_call_function(fci, fcc); zval_ptr_dtor(&arg); + if (EXPECTED(Z_TYPE(retval) == IS_STRING)) { + return Z_STR(retval); + } /* No Exception has occurred */ - if (EXPECTED(Z_TYPE(retval) != IS_UNDEF)) { - result_str = zval_try_get_string(&retval); + else if (EXPECTED(Z_TYPE(retval) != IS_UNDEF)) { + result_str = zval_try_get_string_func(&retval); } zval_ptr_dtor(&retval); diff --git a/ext/pdo_firebird/firebird_driver.c b/ext/pdo_firebird/firebird_driver.c index 9d7cb20d2cdeb..0666057b66b6e 100644 --- a/ext/pdo_firebird/firebird_driver.c +++ b/ext/pdo_firebird/firebird_driver.c @@ -599,13 +599,13 @@ static void firebird_handle_closer(pdo_dbh_t *dbh) /* {{{ */ } if (H->date_format) { - efree(H->date_format); + zend_string_release_ex(H->date_format, false); } if (H->time_format) { - efree(H->time_format); + zend_string_release_ex(H->time_format, false); } if (H->timestamp_format) { - efree(H->timestamp_format); + zend_string_release_ex(H->timestamp_format, false); } if (H->einfo.errmsg) { @@ -1091,10 +1091,9 @@ static bool pdo_firebird_set_attribute(pdo_dbh_t *dbh, zend_long attr, zval *val return false; } if (H->date_format) { - efree(H->date_format); + zend_string_release_ex(H->date_format, false); } - spprintf(&H->date_format, 0, "%s", ZSTR_VAL(str)); - zend_string_release_ex(str, 0); + H->date_format = str; } return true; @@ -1105,10 +1104,9 @@ static bool pdo_firebird_set_attribute(pdo_dbh_t *dbh, zend_long attr, zval *val return false; } if (H->time_format) { - efree(H->time_format); + zend_string_release_ex(H->time_format, false); } - spprintf(&H->time_format, 0, "%s", ZSTR_VAL(str)); - zend_string_release_ex(str, 0); + H->time_format = str; } return true; @@ -1119,10 +1117,9 @@ static bool pdo_firebird_set_attribute(pdo_dbh_t *dbh, zend_long attr, zval *val return false; } if (H->timestamp_format) { - efree(H->timestamp_format); + zend_string_release_ex(H->timestamp_format, false); } - spprintf(&H->timestamp_format, 0, "%s", ZSTR_VAL(str)); - zend_string_release_ex(str, 0); + H->timestamp_format = str; } return true; @@ -1243,15 +1240,27 @@ static int pdo_firebird_get_attribute(pdo_dbh_t *dbh, zend_long attr, zval *val) return 1; case PDO_FB_ATTR_DATE_FORMAT: - ZVAL_STRING(val, H->date_format ? H->date_format : PDO_FB_DEF_DATE_FMT); + if (H->date_format) { + ZVAL_STR_COPY(val, H->date_format); + } else { + ZVAL_STRING(val, PDO_FB_DEF_DATE_FMT); + } return 1; case PDO_FB_ATTR_TIME_FORMAT: - ZVAL_STRING(val, H->time_format ? H->time_format : PDO_FB_DEF_TIME_FMT); + if (H->time_format) { + ZVAL_STR_COPY(val, H->time_format); + } else { + ZVAL_STRING(val, PDO_FB_DEF_TIME_FMT); + } return 1; case PDO_FB_ATTR_TIMESTAMP_FORMAT: - ZVAL_STRING(val, H->timestamp_format ? H->timestamp_format : PDO_FB_DEF_TIMESTAMP_FMT); + if (H->timestamp_format) { + ZVAL_STR_COPY(val, H->timestamp_format); + } else { + ZVAL_STRING(val, PDO_FB_DEF_TIMESTAMP_FMT); + } return 1; case PDO_FB_TRANSACTION_ISOLATION_LEVEL: diff --git a/ext/pdo_firebird/firebird_statement.c b/ext/pdo_firebird/firebird_statement.c index 60a5e60e11bde..4310269314ce0 100644 --- a/ext/pdo_firebird/firebird_statement.c +++ b/ext/pdo_firebird/firebird_statement.c @@ -93,7 +93,7 @@ static int get_formatted_time_tz(pdo_stmt_t *stmt, const ISC_TIME_TZ* timeTz, zv } time = fb_encode_time(hours, minutes, seconds, fractions); isc_decode_sql_time(&time, &t); - fmt = S->H->time_format ? S->H->time_format : PDO_FB_DEF_TIME_FMT; + fmt = S->H->time_format ? ZSTR_VAL(S->H->time_format) : PDO_FB_DEF_TIME_FMT; size_t len = strftime(timeBuf, sizeof(timeBuf), fmt, &t); if (len == 0) { @@ -123,7 +123,7 @@ static int get_formatted_timestamp_tz(pdo_stmt_t *stmt, const ISC_TIMESTAMP_TZ* ts.timestamp_time = fb_encode_time(hours, minutes, seconds, fractions); isc_decode_timestamp(&ts, &t); - fmt = S->H->timestamp_format ? S->H->timestamp_format : PDO_FB_DEF_TIMESTAMP_FMT; + fmt = S->H->timestamp_format ? ZSTR_VAL(S->H->timestamp_format) : PDO_FB_DEF_TIMESTAMP_FMT; size_t len = strftime(timestampBuf, sizeof(timestampBuf), fmt, &t); if (len == 0) { @@ -546,18 +546,18 @@ static int pdo_firebird_stmt_get_col( break; case SQL_TYPE_DATE: isc_decode_sql_date((ISC_DATE*)var->sqldata, &t); - fmt = S->H->date_format ? S->H->date_format : PDO_FB_DEF_DATE_FMT; + fmt = S->H->date_format ? ZSTR_VAL(S->H->date_format) : PDO_FB_DEF_DATE_FMT; if (0) { case SQL_TYPE_TIME: isc_decode_sql_time((ISC_TIME*)var->sqldata, &t); - fmt = S->H->time_format ? S->H->time_format : PDO_FB_DEF_TIME_FMT; + fmt = S->H->time_format ? ZSTR_VAL(S->H->time_format) : PDO_FB_DEF_TIME_FMT; } else if (0) { case SQL_TIMESTAMP: { ISC_TIMESTAMP timestamp = php_get_isc_timestamp_from_sqldata(var->sqldata); isc_decode_timestamp(×tamp, &t); } - fmt = S->H->timestamp_format ? S->H->timestamp_format : PDO_FB_DEF_TIMESTAMP_FMT; + fmt = S->H->timestamp_format ? ZSTR_VAL(S->H->timestamp_format) : PDO_FB_DEF_TIMESTAMP_FMT; } /* convert the timestamp into a string */ char buf[80]; diff --git a/ext/pdo_firebird/php_pdo_firebird_int.h b/ext/pdo_firebird/php_pdo_firebird_int.h index a62c152ffab3e..1d58be1c4b717 100644 --- a/ext/pdo_firebird/php_pdo_firebird_int.h +++ b/ext/pdo_firebird/php_pdo_firebird_int.h @@ -73,9 +73,9 @@ typedef struct { zend_ulong txn_isolation_level; /* date and time format strings, can be set by the set_attribute method */ - char *date_format; - char *time_format; - char *timestamp_format; + zend_string *date_format; + zend_string *time_format; + zend_string *timestamp_format; unsigned sql_dialect:2; diff --git a/ext/pdo_sqlite/sqlite_driver.c b/ext/pdo_sqlite/sqlite_driver.c index 708abe444c829..645d7bc3333ed 100644 --- a/ext/pdo_sqlite/sqlite_driver.c +++ b/ext/pdo_sqlite/sqlite_driver.c @@ -512,7 +512,7 @@ void pdo_sqlite_create_function_internal(INTERNAL_FUNCTION_PARAMETERS) ZEND_PARSE_PARAMETERS_END_EX(goto error;); dbh = Z_PDO_DBH_P(ZEND_THIS); - PDO_CONSTRUCT_CHECK; + PDO_CONSTRUCT_CHECK_WITH_CLEANUP(error); H = (pdo_sqlite_db_handle *)dbh->driver_data; @@ -569,7 +569,7 @@ void pdo_sqlite_create_aggregate_internal(INTERNAL_FUNCTION_PARAMETERS) ZEND_PARSE_PARAMETERS_END_EX(goto error;); dbh = Z_PDO_DBH_P(ZEND_THIS); - PDO_CONSTRUCT_CHECK; + PDO_CONSTRUCT_CHECK_WITH_CLEANUP(error); H = (pdo_sqlite_db_handle *)dbh->driver_data; @@ -640,7 +640,7 @@ void pdo_sqlite_create_collation_internal(INTERNAL_FUNCTION_PARAMETERS, pdo_sqli ZEND_PARSE_PARAMETERS_END(); dbh = Z_PDO_DBH_P(ZEND_THIS); - PDO_CONSTRUCT_CHECK; + PDO_CONSTRUCT_CHECK_WITH_CLEANUP(cleanup_fcc); H = (pdo_sqlite_db_handle *)dbh->driver_data; @@ -660,12 +660,12 @@ void pdo_sqlite_create_collation_internal(INTERNAL_FUNCTION_PARAMETERS, pdo_sqli zend_release_fcall_info_cache(&fcc); - if (UNEXPECTED(EG(exception))) { - RETURN_THROWS(); - } - efree(collation); RETURN_FALSE; + +cleanup_fcc: + zend_release_fcall_info_cache(&fcc); + RETURN_THROWS(); } /* {{{ bool SQLite::sqliteCreateCollation(string name, callable callback) diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c index 92621b9c3c084..068f437c6984b 100644 --- a/ext/sqlite3/sqlite3.c +++ b/ext/sqlite3/sqlite3.c @@ -2122,7 +2122,6 @@ static int php_sqlite3_authorizer(void *autharg, int action, const char *arg1, c /* Free local return and argument values */ zval_ptr_dtor(&retval); - zval_ptr_dtor(&argv[0]); zval_ptr_dtor(&argv[1]); zval_ptr_dtor(&argv[2]); zval_ptr_dtor(&argv[3]); @@ -2215,7 +2214,7 @@ static HashTable *php_sqlite3_get_gc(zend_object *object, zval **table, int *n) { php_sqlite3_db_object *intern = php_sqlite3_db_from_obj(object); - if (intern->funcs == NULL && intern->collations == NULL) { + if (intern->funcs == NULL && intern->collations == NULL && !ZEND_FCC_INITIALIZED(intern->authorizer_fcc)) { /* Fast path without allocations */ *table = NULL; *n = 0; @@ -2223,6 +2222,8 @@ static HashTable *php_sqlite3_get_gc(zend_object *object, zval **table, int *n) } else { zend_get_gc_buffer *gc_buffer = zend_get_gc_buffer_create(); + php_sqlite3_gc_buffer_add_fcc(gc_buffer, &intern->authorizer_fcc); + php_sqlite3_func *func = intern->funcs; while (func != NULL) { php_sqlite3_gc_buffer_add_fcc(gc_buffer, &func->func); diff --git a/ext/sqlite3/tests/setauthorizer_cycle_leak.phpt b/ext/sqlite3/tests/setauthorizer_cycle_leak.phpt new file mode 100644 index 0000000000000..b0ff384c72273 --- /dev/null +++ b/ext/sqlite3/tests/setauthorizer_cycle_leak.phpt @@ -0,0 +1,21 @@ +--TEST-- +setAuthorizer() cycle leak +--EXTENSIONS-- +sqlite3 +--FILE-- +setAuthorizer([$this, "foo"]); + } + + public function foo() {} +} + +$test = new Foo; + +echo "Done\n"; +?> +--EXPECT-- +Done diff --git a/ext/standard/tests/file/readfile_variation9.phpt b/ext/standard/tests/file/readfile_variation9.phpt index a09846587a6dd..382186fed10ba 100644 --- a/ext/standard/tests/file/readfile_variation9.phpt +++ b/ext/standard/tests/file/readfile_variation9.phpt @@ -5,8 +5,8 @@ Dave Kelsey --FILE-- --EXPECT-- -Only objects that are instances of DOMNode can be converted to an XPath expression +Only objects that are instances of DOM nodes can be converted to an XPath expression diff --git a/ext/zend_test/tests/gh17797.phpt b/ext/zend_test/tests/gh17797.phpt index 9ae1bedb67425..271841b4389db 100644 --- a/ext/zend_test/tests/gh17797.phpt +++ b/ext/zend_test/tests/gh17797.phpt @@ -10,6 +10,7 @@ $source = ''; try {zend_test_compile_string($source,$source,$c);} catch (Exception $e) { echo($e); } +?> --EXPECTF-- Warning: Undefined variable $c in %s on line %d diff --git a/ext/zend_test/tests/gh17899.phpt b/ext/zend_test/tests/gh17899.phpt new file mode 100644 index 0000000000000..184fe0b2aa39d --- /dev/null +++ b/ext/zend_test/tests/gh17899.phpt @@ -0,0 +1,35 @@ +--TEST-- +GH-17899 (zend_test_compile_string with opcache crash on invalid script path) +--EXTENSIONS-- +zend_test +--INI-- +opcache.enable_cli=1 +--CREDITS-- +YuanchengJiang +--FILE-- +'; +try {zend_test_compile_string($source,$source,$c);} catch (Exception $e) { echo($e); } +?> +--EXPECTF-- + +Warning: Undefined variable $c in %s on line %d + +Deprecated: zend_test_compile_string(): Passing null to parameter #3 ($position) of type int is deprecated in %s on line %d + +Warning: require(sumfile.php): Failed to open stream: No such file or directory in on line %d + +Fatal error: Uncaught Error: Failed opening required 'sumfile.php' (include_path='.%s') in :%d +Stack trace: +#0 %s(%d): zend_test_compile_string(' on line %d +