From 7b8a61a18c150b992dc9d392046c20739cad0c4d Mon Sep 17 00:00:00 2001 From: DanielEScherzer Date: Fri, 21 Feb 2025 10:37:39 -0800 Subject: [PATCH 01/20] Zend/tests: merge `constant_expressions` into `constexpr`, update names (#17872) While reviewing the existing tests in the `constexpr` directory, I found that some of the names were not updated to reflect the contents when the contents were changed in #9301. Follow-up to #15638 --- .../class_on_expression_in_constant_expression.phpt | 0 .../constant_expressions.phpt | 0 .../constant_expressions_arrays.phpt | 0 .../constant_expressions_classes.phpt | 0 .../constant_expressions_coalesce.phpt | 0 .../constant_expressions_coalesce_empty_dim.phpt | 0 .../constant_expressions_dynamic.phpt | 0 .../constant_expressions_dynamic_class_name_error.phpt | 0 .../constant_expressions_exceptions.inc | 0 .../constant_expressions_exceptions_001.phpt | 0 .../constant_expressions_exceptions_002.phpt | 0 .../constant_expressions_invalid_offset_type_error.phpt | 0 .../constant_expressions_self_referencing_array.phpt | 0 .../constant_expressions_static_class_name_error.phpt | 0 Zend/tests/{constant_expressions => constexpr}/gh10014.phpt | 0 Zend/tests/{constant_expressions => constexpr}/gh10356.phpt | 0 Zend/tests/{constant_expressions => constexpr}/gh7771_1.phpt | 0 .../{constant_expressions => constexpr}/gh7771_1_definition.inc | 0 Zend/tests/{constant_expressions => constexpr}/gh7771_2.phpt | 0 .../{constant_expressions => constexpr}/gh7771_2_definition.inc | 0 Zend/tests/{constant_expressions => constexpr}/gh7771_3.phpt | 0 Zend/tests/{constant_expressions => constexpr}/gh9136.phpt | 0 Zend/tests/{constant_expressions => constexpr}/gh9136_2.phpt | 0 Zend/tests/{constant_expressions => constexpr}/gh9138.phpt | 0 Zend/tests/{constant_expressions => constexpr}/gh9138_2.phpt | 0 Zend/tests/constexpr/new_dynamic_class_name.phpt | 2 +- Zend/tests/constexpr/new_invalid_operation_in_arg.phpt | 2 +- Zend/tests/constexpr/new_static.phpt | 2 +- 28 files changed, 3 insertions(+), 3 deletions(-) rename Zend/tests/{constant_expressions => constexpr}/class_on_expression_in_constant_expression.phpt (100%) rename Zend/tests/{constant_expressions => constexpr}/constant_expressions.phpt (100%) rename Zend/tests/{constant_expressions => constexpr}/constant_expressions_arrays.phpt (100%) rename Zend/tests/{constant_expressions => constexpr}/constant_expressions_classes.phpt (100%) rename Zend/tests/{constant_expressions => constexpr}/constant_expressions_coalesce.phpt (100%) rename Zend/tests/{constant_expressions => constexpr}/constant_expressions_coalesce_empty_dim.phpt (100%) rename Zend/tests/{constant_expressions => constexpr}/constant_expressions_dynamic.phpt (100%) rename Zend/tests/{constant_expressions => constexpr}/constant_expressions_dynamic_class_name_error.phpt (100%) rename Zend/tests/{constant_expressions => constexpr}/constant_expressions_exceptions.inc (100%) rename Zend/tests/{constant_expressions => constexpr}/constant_expressions_exceptions_001.phpt (100%) rename Zend/tests/{constant_expressions => constexpr}/constant_expressions_exceptions_002.phpt (100%) rename Zend/tests/{constant_expressions => constexpr}/constant_expressions_invalid_offset_type_error.phpt (100%) rename Zend/tests/{constant_expressions => constexpr}/constant_expressions_self_referencing_array.phpt (100%) rename Zend/tests/{constant_expressions => constexpr}/constant_expressions_static_class_name_error.phpt (100%) rename Zend/tests/{constant_expressions => constexpr}/gh10014.phpt (100%) rename Zend/tests/{constant_expressions => constexpr}/gh10356.phpt (100%) rename Zend/tests/{constant_expressions => constexpr}/gh7771_1.phpt (100%) rename Zend/tests/{constant_expressions => constexpr}/gh7771_1_definition.inc (100%) rename Zend/tests/{constant_expressions => constexpr}/gh7771_2.phpt (100%) rename Zend/tests/{constant_expressions => constexpr}/gh7771_2_definition.inc (100%) rename Zend/tests/{constant_expressions => constexpr}/gh7771_3.phpt (100%) rename Zend/tests/{constant_expressions => constexpr}/gh9136.phpt (100%) rename Zend/tests/{constant_expressions => constexpr}/gh9136_2.phpt (100%) rename Zend/tests/{constant_expressions => constexpr}/gh9138.phpt (100%) rename Zend/tests/{constant_expressions => constexpr}/gh9138_2.phpt (100%) 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/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-- Date: Fri, 21 Feb 2025 19:25:35 +0100 Subject: [PATCH 02/20] Fix GH-17847: xinclude destroys live node dom_xinclude_strip_fallback_references() now also takes into account xi:include nodes children. This now subsumes all work done normally by the old start/end node removal, so we can remove that code and start using XML_PARSE_NOXINCNODE. Closes GH-17878. --- NEWS | 3 ++ ext/dom/document.c | 65 ++++---------------------------------- ext/dom/tests/gh17847.phpt | 49 ++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+), 58 deletions(-) create mode 100644 ext/dom/tests/gh17847.phpt diff --git a/NEWS b/NEWS index a26321e6ca7d7..2f542eef11ac4 100644 --- a/NEWS +++ b/NEWS @@ -16,6 +16,9 @@ PHP NEWS . Fixed bug GH-17797 (zend_test_compile_string crash on invalid script path). (David Carlier) +- DOM: + . Fixed bug GH-17847 (xinclude destroys live node). (nielsdos) + - FFI: . Fix FFI Parsing of Pointer Declaration Lists. (davnotdev) diff --git a/ext/dom/document.c b/ext/dom/document.c index d1437f1f42923..0388249766e1f 100644 --- a/ext/dom/document.c +++ b/ext/dom/document.c @@ -1586,47 +1586,6 @@ PHP_METHOD(DOMDocument, 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; - } - } -} -/* }}} */ - /* Backported from master branch xml_common.h */ static zend_always_inline xmlNodePtr php_dom_next_in_tree_order(const xmlNode *nodep, const xmlNode *basep) { @@ -1660,17 +1619,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); } @@ -1684,7 +1645,6 @@ PHP_METHOD(DOMDocument, xinclude) { zval *id; xmlDoc *docp; - xmlNodePtr root; zend_long flags = 0; int err; dom_object *intern; @@ -1703,22 +1663,11 @@ PHP_METHOD(DOMDocument, xinclude) dom_xinclude_strip_fallback_references((const xmlNode *) docp); + flags |= XML_PARSE_NOXINCNODE; PHP_LIBXML_SANITIZE_GLOBALS(xinclude); 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 */ - root = (xmlNodePtr) 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); if (err) { diff --git a/ext/dom/tests/gh17847.phpt b/ext/dom/tests/gh17847.phpt new file mode 100644 index 0000000000000..5d5df0b3be05f --- /dev/null +++ b/ext/dom/tests/gh17847.phpt @@ -0,0 +1,49 @@ +--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(); + +var_dump($garbage); +?> +--EXPECT-- +array(3) { + [0]=> + object(DOMElement)#3 (1) { + ["schemaTypeInfo"]=> + NULL + } + [1]=> + object(DOMElement)#4 (1) { + ["schemaTypeInfo"]=> + NULL + } + [2]=> + object(DOMElement)#5 (1) { + ["schemaTypeInfo"]=> + NULL + } +} From 769f292a7a8fb95f17dc75c8c445f8ce0804fa75 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Fri, 21 Feb 2025 22:35:03 +0100 Subject: [PATCH 03/20] Fix GH-17879: readfile_variation8-win32.phpt test conflict Apparently a copy and paste issue. Closes GH-17881. --- ext/standard/tests/file/readfile_variation9.phpt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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-- Date: Sat, 22 Feb 2025 13:34:45 +0100 Subject: [PATCH 04/20] Fix using Dom\Node with Dom\XPath callbacks This code was introduced when the Dom\Node and DOMNode classes were still aliases, so the type check was never updated. We fix this by checking if the doc pointer follows the spec and pick the right node CE based on that. Closes GH-17888. --- NEWS | 1 + .../modern/xml/return_dom_node_from_xpath.phpt | 17 +++++++++++++++++ ext/dom/xpath_callbacks.c | 6 ++++-- ext/xsl/tests/xslt_non_dom_node.phpt | 2 +- 4 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 ext/dom/tests/modern/xml/return_dom_node_from_xpath.phpt diff --git a/NEWS b/NEWS index d08748de8aa5b..052f33c44fae5 100644 --- a/NEWS +++ b/NEWS @@ -24,6 +24,7 @@ PHP NEWS . Fixed bug GH-17802 (\Dom\HTMLDocument querySelector attribute name is case sensitive in HTML). (nielsdos) . Fixed bug GH-17847 (xinclude destroys live node). (nielsdos) + . Fix using Dom\Node with Dom\XPath callbacks. (nielsdos) - GD: . Fixed bug GH-17703 (imagescale with both width and height negative values 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 00b5ccb5911cd..283ccd8f7cc62 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) @@ -425,7 +426,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,7 +441,7 @@ 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 { diff --git a/ext/xsl/tests/xslt_non_dom_node.phpt b/ext/xsl/tests/xslt_non_dom_node.phpt index 9ead8a67fb581..0fbebc122874c 100644 --- a/ext/xsl/tests/xslt_non_dom_node.phpt +++ b/ext/xsl/tests/xslt_non_dom_node.phpt @@ -28,4 +28,4 @@ try { } ?> --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 From 618190127e891751eaeb8972be03f6785265c67c Mon Sep 17 00:00:00 2001 From: DanielEScherzer Date: Sat, 22 Feb 2025 11:10:59 -0800 Subject: [PATCH 05/20] Zend/tests: organize some tests with sub directories (8) (#17873) Create new sub directories for tests related to backtraces and for tests related to `$this` being reserved in different places and not being usable or reassignable. Work towards GH-15631 --- Zend/tests/{ => backtrace}/bug28377.phpt | 0 Zend/tests/{ => backtrace}/bug30828.phpt | 0 Zend/tests/{ => backtrace}/bug39445.phpt | 0 Zend/tests/{ => backtrace}/bug64239_2.phpt | 0 Zend/tests/{ => backtrace}/bug64239_3.phpt | 0 Zend/tests/{ => backtrace}/bug64239_4.phpt | 0 Zend/tests/{ => backtrace}/bug69180-backtrace.phpt | 0 Zend/tests/{ => backtrace}/bug70547.phpt | 0 Zend/tests/{ => backtrace}/bug76047.phpt | 0 Zend/tests/{ => backtrace}/bug79108.phpt | 0 Zend/tests/{ => backtrace}/bug_debug_backtrace.phpt | 0 .../bug_debug_backtrace_replace_zend_execute_ex.phpt | 0 Zend/tests/{ => backtrace}/debug_backtrace_limit.phpt | 0 Zend/tests/{ => backtrace}/debug_backtrace_options.phpt | 0 .../{ => backtrace}/debug_backtrace_with_include_and_this.phpt | 0 Zend/tests/{ => backtrace}/debug_print_backtrace_from_main.phpt | 0 Zend/tests/{ => backtrace}/debug_print_backtrace_limit.phpt | 0 Zend/tests/{ => backtrace}/fatal_error_backtraces_001.phpt | 0 Zend/tests/{ => backtrace}/fatal_error_backtraces_002.phpt | 0 Zend/tests/{ => backtrace}/fatal_error_backtraces_003.phpt | 0 Zend/tests/{ => constants}/008.phpt | 0 Zend/tests/{ => constants}/018.phpt | 0 Zend/tests/{ => constants}/bug42820.phpt | 0 Zend/tests/{ => constants}/const_deprecation.phpt | 0 Zend/tests/{ => constants}/defined_fn_no_ns_fallback.phpt | 0 Zend/tests/{ => constants}/selfParent_001.phpt | 0 Zend/tests/{ => constants}/selfParent_002.phpt | 0 Zend/tests/{ => constexpr}/const_expr_dim_on_null_warning.phpt | 0 Zend/tests/{ => enum}/enum_in_stack_trace.phpt | 0 Zend/tests/{ => errmsg}/bug30519.phpt | 0 Zend/tests/{ => exceptions}/bug54043.phpt | 0 .../{ => function_arguments}/function_default_argument_cache.phpt | 0 .../alternative_offset_syntax_compile_error_in_const_expr.phpt | 0 ...lternative_offset_syntax_compile_error_outside_const_expr.phpt | 0 .../{ => grammar}/alternative_offset_syntax_in_encaps_string.phpt | 0 Zend/tests/{ => grammar}/bug31341.phpt | 0 Zend/tests/{ => grammar}/bug35411.phpt | 0 Zend/tests/{ => grammar}/bug41401.phpt | 0 Zend/tests/{ => grammar}/bug45147.phpt | 0 Zend/tests/{ => grammar}/bug55445.phpt | 0 Zend/tests/{ => grammar}/bug60099.phpt | 0 Zend/tests/{ => grammar}/bug61095.phpt | 0 Zend/tests/{ => grammar}/bug61225.phpt | 0 Zend/tests/{ => grammar}/bug61681.phpt | 0 Zend/tests/{ => grammar}/bug70430.phpt | 0 Zend/tests/{ => grammar}/bug77993.phpt | 0 Zend/tests/{ => grammar}/readonly_function.phpt | 0 Zend/tests/{ => heredoc_nowdoc}/bug76439.phpt | 0 Zend/tests/{ => heredoc_nowdoc}/bug76439_2.phpt | 0 .../{ => heredoc_nowdoc}/warning_during_heredoc_scan_ahead.phpt | 0 .../deprecation_to_exception_during_inheritance.phpt | 0 Zend/tests/{ => magic_methods}/bug28444.phpt | 0 Zend/tests/{ => magic_methods}/bug34893.phpt | 0 Zend/tests/{ => magic_methods}/bug39449.phpt | 0 Zend/tests/{ => magic_methods}/bug39775.phpt | 0 Zend/tests/{ => magic_methods}/bug71359.phpt | 0 Zend/tests/{ => magic_methods}/call_static.phpt | 0 Zend/tests/{ => magic_methods}/call_static_002.phpt | 0 Zend/tests/{ => magic_methods}/call_static_003.phpt | 0 Zend/tests/{ => magic_methods}/call_static_004.phpt | 0 Zend/tests/{ => magic_methods}/call_static_006.phpt | 0 Zend/tests/{ => magic_methods}/call_static_007.phpt | 0 .../{ => magic_methods}/stringable_automatic_implementation.phpt | 0 Zend/tests/{ => magic_methods}/stringable_internal_class.phpt | 0 Zend/tests/{ => magic_methods}/stringable_trait.phpt | 0 Zend/tests/{ => magic_methods}/stringable_trait_invalid.phpt | 0 Zend/tests/{ => nullsafe_operator}/oss-fuzz-69765.phpt | 0 Zend/tests/{ => nullsafe_operator}/oss_fuzz_60011_1.phpt | 0 Zend/tests/{ => nullsafe_operator}/oss_fuzz_60011_2.phpt | 0 Zend/tests/{ => property_hooks}/oss-fuzz-391975641.phpt | 0 Zend/tests/{ => switch}/034.phpt | 0 Zend/tests/{ => switch}/bug80046.phpt | 0 Zend/tests/{ => switch}/switch_on_numeric_strings.phpt | 0 Zend/tests/{ => this-reserved}/030.phpt | 0 Zend/tests/{ => this-reserved}/bug34358.phpt | 0 Zend/tests/{ => this-reserved}/bug41117_1.phpt | 0 Zend/tests/{ => this-reserved}/bug71737.phpt | 0 Zend/tests/{ => this-reserved}/this_as_global.phpt | 0 Zend/tests/{ => this-reserved}/this_as_lexical_var_error.phpt | 0 Zend/tests/{ => this-reserved}/this_as_parameter.phpt | 0 Zend/tests/{ => this-reserved}/this_as_static.phpt | 0 Zend/tests/{ => this-reserved}/this_in_catch.phpt | 0 Zend/tests/{ => this-reserved}/this_in_extract.phpt | 0 Zend/tests/{ => this-reserved}/this_reassign.phpt | 0 84 files changed, 0 insertions(+), 0 deletions(-) rename Zend/tests/{ => backtrace}/bug28377.phpt (100%) rename Zend/tests/{ => backtrace}/bug30828.phpt (100%) rename Zend/tests/{ => backtrace}/bug39445.phpt (100%) rename Zend/tests/{ => backtrace}/bug64239_2.phpt (100%) rename Zend/tests/{ => backtrace}/bug64239_3.phpt (100%) rename Zend/tests/{ => backtrace}/bug64239_4.phpt (100%) rename Zend/tests/{ => backtrace}/bug69180-backtrace.phpt (100%) rename Zend/tests/{ => backtrace}/bug70547.phpt (100%) rename Zend/tests/{ => backtrace}/bug76047.phpt (100%) rename Zend/tests/{ => backtrace}/bug79108.phpt (100%) rename Zend/tests/{ => backtrace}/bug_debug_backtrace.phpt (100%) rename Zend/tests/{ => backtrace}/bug_debug_backtrace_replace_zend_execute_ex.phpt (100%) rename Zend/tests/{ => backtrace}/debug_backtrace_limit.phpt (100%) rename Zend/tests/{ => backtrace}/debug_backtrace_options.phpt (100%) rename Zend/tests/{ => backtrace}/debug_backtrace_with_include_and_this.phpt (100%) rename Zend/tests/{ => backtrace}/debug_print_backtrace_from_main.phpt (100%) rename Zend/tests/{ => backtrace}/debug_print_backtrace_limit.phpt (100%) rename Zend/tests/{ => backtrace}/fatal_error_backtraces_001.phpt (100%) rename Zend/tests/{ => backtrace}/fatal_error_backtraces_002.phpt (100%) rename Zend/tests/{ => backtrace}/fatal_error_backtraces_003.phpt (100%) rename Zend/tests/{ => constants}/008.phpt (100%) rename Zend/tests/{ => constants}/018.phpt (100%) rename Zend/tests/{ => constants}/bug42820.phpt (100%) rename Zend/tests/{ => constants}/const_deprecation.phpt (100%) rename Zend/tests/{ => constants}/defined_fn_no_ns_fallback.phpt (100%) rename Zend/tests/{ => constants}/selfParent_001.phpt (100%) rename Zend/tests/{ => constants}/selfParent_002.phpt (100%) rename Zend/tests/{ => constexpr}/const_expr_dim_on_null_warning.phpt (100%) rename Zend/tests/{ => enum}/enum_in_stack_trace.phpt (100%) rename Zend/tests/{ => errmsg}/bug30519.phpt (100%) rename Zend/tests/{ => exceptions}/bug54043.phpt (100%) rename Zend/tests/{ => function_arguments}/function_default_argument_cache.phpt (100%) rename Zend/tests/{ => grammar}/alternative_offset_syntax_compile_error_in_const_expr.phpt (100%) rename Zend/tests/{ => grammar}/alternative_offset_syntax_compile_error_outside_const_expr.phpt (100%) rename Zend/tests/{ => grammar}/alternative_offset_syntax_in_encaps_string.phpt (100%) rename Zend/tests/{ => grammar}/bug31341.phpt (100%) rename Zend/tests/{ => grammar}/bug35411.phpt (100%) rename Zend/tests/{ => grammar}/bug41401.phpt (100%) rename Zend/tests/{ => grammar}/bug45147.phpt (100%) rename Zend/tests/{ => grammar}/bug55445.phpt (100%) rename Zend/tests/{ => grammar}/bug60099.phpt (100%) rename Zend/tests/{ => grammar}/bug61095.phpt (100%) rename Zend/tests/{ => grammar}/bug61225.phpt (100%) rename Zend/tests/{ => grammar}/bug61681.phpt (100%) rename Zend/tests/{ => grammar}/bug70430.phpt (100%) rename Zend/tests/{ => grammar}/bug77993.phpt (100%) rename Zend/tests/{ => grammar}/readonly_function.phpt (100%) rename Zend/tests/{ => heredoc_nowdoc}/bug76439.phpt (100%) rename Zend/tests/{ => heredoc_nowdoc}/bug76439_2.phpt (100%) rename Zend/tests/{ => heredoc_nowdoc}/warning_during_heredoc_scan_ahead.phpt (100%) rename Zend/tests/{ => inheritance}/deprecation_to_exception_during_inheritance.phpt (100%) rename Zend/tests/{ => magic_methods}/bug28444.phpt (100%) rename Zend/tests/{ => magic_methods}/bug34893.phpt (100%) rename Zend/tests/{ => magic_methods}/bug39449.phpt (100%) rename Zend/tests/{ => magic_methods}/bug39775.phpt (100%) rename Zend/tests/{ => magic_methods}/bug71359.phpt (100%) rename Zend/tests/{ => magic_methods}/call_static.phpt (100%) rename Zend/tests/{ => magic_methods}/call_static_002.phpt (100%) rename Zend/tests/{ => magic_methods}/call_static_003.phpt (100%) rename Zend/tests/{ => magic_methods}/call_static_004.phpt (100%) rename Zend/tests/{ => magic_methods}/call_static_006.phpt (100%) rename Zend/tests/{ => magic_methods}/call_static_007.phpt (100%) rename Zend/tests/{ => magic_methods}/stringable_automatic_implementation.phpt (100%) rename Zend/tests/{ => magic_methods}/stringable_internal_class.phpt (100%) rename Zend/tests/{ => magic_methods}/stringable_trait.phpt (100%) rename Zend/tests/{ => magic_methods}/stringable_trait_invalid.phpt (100%) rename Zend/tests/{ => nullsafe_operator}/oss-fuzz-69765.phpt (100%) rename Zend/tests/{ => nullsafe_operator}/oss_fuzz_60011_1.phpt (100%) rename Zend/tests/{ => nullsafe_operator}/oss_fuzz_60011_2.phpt (100%) rename Zend/tests/{ => property_hooks}/oss-fuzz-391975641.phpt (100%) rename Zend/tests/{ => switch}/034.phpt (100%) rename Zend/tests/{ => switch}/bug80046.phpt (100%) rename Zend/tests/{ => switch}/switch_on_numeric_strings.phpt (100%) rename Zend/tests/{ => this-reserved}/030.phpt (100%) rename Zend/tests/{ => this-reserved}/bug34358.phpt (100%) rename Zend/tests/{ => this-reserved}/bug41117_1.phpt (100%) rename Zend/tests/{ => this-reserved}/bug71737.phpt (100%) rename Zend/tests/{ => this-reserved}/this_as_global.phpt (100%) rename Zend/tests/{ => this-reserved}/this_as_lexical_var_error.phpt (100%) rename Zend/tests/{ => this-reserved}/this_as_parameter.phpt (100%) rename Zend/tests/{ => this-reserved}/this_as_static.phpt (100%) rename Zend/tests/{ => this-reserved}/this_in_catch.phpt (100%) rename Zend/tests/{ => this-reserved}/this_in_extract.phpt (100%) rename Zend/tests/{ => this-reserved}/this_reassign.phpt (100%) 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/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/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/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/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/enum_in_stack_trace.phpt b/Zend/tests/enum/enum_in_stack_trace.phpt similarity index 100% rename from Zend/tests/enum_in_stack_trace.phpt rename to Zend/tests/enum/enum_in_stack_trace.phpt diff --git a/Zend/tests/bug30519.phpt b/Zend/tests/errmsg/bug30519.phpt similarity index 100% rename from Zend/tests/bug30519.phpt rename to Zend/tests/errmsg/bug30519.phpt diff --git a/Zend/tests/bug54043.phpt b/Zend/tests/exceptions/bug54043.phpt similarity index 100% rename from Zend/tests/bug54043.phpt rename to Zend/tests/exceptions/bug54043.phpt diff --git a/Zend/tests/function_default_argument_cache.phpt b/Zend/tests/function_arguments/function_default_argument_cache.phpt similarity index 100% rename from Zend/tests/function_default_argument_cache.phpt rename to Zend/tests/function_arguments/function_default_argument_cache.phpt diff --git a/Zend/tests/alternative_offset_syntax_compile_error_in_const_expr.phpt b/Zend/tests/grammar/alternative_offset_syntax_compile_error_in_const_expr.phpt similarity index 100% rename from Zend/tests/alternative_offset_syntax_compile_error_in_const_expr.phpt rename to Zend/tests/grammar/alternative_offset_syntax_compile_error_in_const_expr.phpt diff --git a/Zend/tests/alternative_offset_syntax_compile_error_outside_const_expr.phpt b/Zend/tests/grammar/alternative_offset_syntax_compile_error_outside_const_expr.phpt similarity index 100% rename from Zend/tests/alternative_offset_syntax_compile_error_outside_const_expr.phpt rename to Zend/tests/grammar/alternative_offset_syntax_compile_error_outside_const_expr.phpt diff --git a/Zend/tests/alternative_offset_syntax_in_encaps_string.phpt b/Zend/tests/grammar/alternative_offset_syntax_in_encaps_string.phpt similarity index 100% rename from Zend/tests/alternative_offset_syntax_in_encaps_string.phpt rename to Zend/tests/grammar/alternative_offset_syntax_in_encaps_string.phpt diff --git a/Zend/tests/bug31341.phpt b/Zend/tests/grammar/bug31341.phpt similarity index 100% rename from Zend/tests/bug31341.phpt rename to Zend/tests/grammar/bug31341.phpt diff --git a/Zend/tests/bug35411.phpt b/Zend/tests/grammar/bug35411.phpt similarity index 100% rename from Zend/tests/bug35411.phpt rename to Zend/tests/grammar/bug35411.phpt diff --git a/Zend/tests/bug41401.phpt b/Zend/tests/grammar/bug41401.phpt similarity index 100% rename from Zend/tests/bug41401.phpt rename to Zend/tests/grammar/bug41401.phpt diff --git a/Zend/tests/bug45147.phpt b/Zend/tests/grammar/bug45147.phpt similarity index 100% rename from Zend/tests/bug45147.phpt rename to Zend/tests/grammar/bug45147.phpt diff --git a/Zend/tests/bug55445.phpt b/Zend/tests/grammar/bug55445.phpt similarity index 100% rename from Zend/tests/bug55445.phpt rename to Zend/tests/grammar/bug55445.phpt diff --git a/Zend/tests/bug60099.phpt b/Zend/tests/grammar/bug60099.phpt similarity index 100% rename from Zend/tests/bug60099.phpt rename to Zend/tests/grammar/bug60099.phpt diff --git a/Zend/tests/bug61095.phpt b/Zend/tests/grammar/bug61095.phpt similarity index 100% rename from Zend/tests/bug61095.phpt rename to Zend/tests/grammar/bug61095.phpt diff --git a/Zend/tests/bug61225.phpt b/Zend/tests/grammar/bug61225.phpt similarity index 100% rename from Zend/tests/bug61225.phpt rename to Zend/tests/grammar/bug61225.phpt diff --git a/Zend/tests/bug61681.phpt b/Zend/tests/grammar/bug61681.phpt similarity index 100% rename from Zend/tests/bug61681.phpt rename to Zend/tests/grammar/bug61681.phpt diff --git a/Zend/tests/bug70430.phpt b/Zend/tests/grammar/bug70430.phpt similarity index 100% rename from Zend/tests/bug70430.phpt rename to Zend/tests/grammar/bug70430.phpt diff --git a/Zend/tests/bug77993.phpt b/Zend/tests/grammar/bug77993.phpt similarity index 100% rename from Zend/tests/bug77993.phpt rename to Zend/tests/grammar/bug77993.phpt diff --git a/Zend/tests/readonly_function.phpt b/Zend/tests/grammar/readonly_function.phpt similarity index 100% rename from Zend/tests/readonly_function.phpt rename to Zend/tests/grammar/readonly_function.phpt diff --git a/Zend/tests/bug76439.phpt b/Zend/tests/heredoc_nowdoc/bug76439.phpt similarity index 100% rename from Zend/tests/bug76439.phpt rename to Zend/tests/heredoc_nowdoc/bug76439.phpt diff --git a/Zend/tests/bug76439_2.phpt b/Zend/tests/heredoc_nowdoc/bug76439_2.phpt similarity index 100% rename from Zend/tests/bug76439_2.phpt rename to Zend/tests/heredoc_nowdoc/bug76439_2.phpt diff --git a/Zend/tests/warning_during_heredoc_scan_ahead.phpt b/Zend/tests/heredoc_nowdoc/warning_during_heredoc_scan_ahead.phpt similarity index 100% rename from Zend/tests/warning_during_heredoc_scan_ahead.phpt rename to Zend/tests/heredoc_nowdoc/warning_during_heredoc_scan_ahead.phpt diff --git a/Zend/tests/deprecation_to_exception_during_inheritance.phpt b/Zend/tests/inheritance/deprecation_to_exception_during_inheritance.phpt similarity index 100% rename from Zend/tests/deprecation_to_exception_during_inheritance.phpt rename to Zend/tests/inheritance/deprecation_to_exception_during_inheritance.phpt diff --git a/Zend/tests/bug28444.phpt b/Zend/tests/magic_methods/bug28444.phpt similarity index 100% rename from Zend/tests/bug28444.phpt rename to Zend/tests/magic_methods/bug28444.phpt diff --git a/Zend/tests/bug34893.phpt b/Zend/tests/magic_methods/bug34893.phpt similarity index 100% rename from Zend/tests/bug34893.phpt rename to Zend/tests/magic_methods/bug34893.phpt diff --git a/Zend/tests/bug39449.phpt b/Zend/tests/magic_methods/bug39449.phpt similarity index 100% rename from Zend/tests/bug39449.phpt rename to Zend/tests/magic_methods/bug39449.phpt diff --git a/Zend/tests/bug39775.phpt b/Zend/tests/magic_methods/bug39775.phpt similarity index 100% rename from Zend/tests/bug39775.phpt rename to Zend/tests/magic_methods/bug39775.phpt diff --git a/Zend/tests/bug71359.phpt b/Zend/tests/magic_methods/bug71359.phpt similarity index 100% rename from Zend/tests/bug71359.phpt rename to Zend/tests/magic_methods/bug71359.phpt diff --git a/Zend/tests/call_static.phpt b/Zend/tests/magic_methods/call_static.phpt similarity index 100% rename from Zend/tests/call_static.phpt rename to Zend/tests/magic_methods/call_static.phpt diff --git a/Zend/tests/call_static_002.phpt b/Zend/tests/magic_methods/call_static_002.phpt similarity index 100% rename from Zend/tests/call_static_002.phpt rename to Zend/tests/magic_methods/call_static_002.phpt diff --git a/Zend/tests/call_static_003.phpt b/Zend/tests/magic_methods/call_static_003.phpt similarity index 100% rename from Zend/tests/call_static_003.phpt rename to Zend/tests/magic_methods/call_static_003.phpt diff --git a/Zend/tests/call_static_004.phpt b/Zend/tests/magic_methods/call_static_004.phpt similarity index 100% rename from Zend/tests/call_static_004.phpt rename to Zend/tests/magic_methods/call_static_004.phpt diff --git a/Zend/tests/call_static_006.phpt b/Zend/tests/magic_methods/call_static_006.phpt similarity index 100% rename from Zend/tests/call_static_006.phpt rename to Zend/tests/magic_methods/call_static_006.phpt diff --git a/Zend/tests/call_static_007.phpt b/Zend/tests/magic_methods/call_static_007.phpt similarity index 100% rename from Zend/tests/call_static_007.phpt rename to Zend/tests/magic_methods/call_static_007.phpt diff --git a/Zend/tests/stringable_automatic_implementation.phpt b/Zend/tests/magic_methods/stringable_automatic_implementation.phpt similarity index 100% rename from Zend/tests/stringable_automatic_implementation.phpt rename to Zend/tests/magic_methods/stringable_automatic_implementation.phpt diff --git a/Zend/tests/stringable_internal_class.phpt b/Zend/tests/magic_methods/stringable_internal_class.phpt similarity index 100% rename from Zend/tests/stringable_internal_class.phpt rename to Zend/tests/magic_methods/stringable_internal_class.phpt diff --git a/Zend/tests/stringable_trait.phpt b/Zend/tests/magic_methods/stringable_trait.phpt similarity index 100% rename from Zend/tests/stringable_trait.phpt rename to Zend/tests/magic_methods/stringable_trait.phpt diff --git a/Zend/tests/stringable_trait_invalid.phpt b/Zend/tests/magic_methods/stringable_trait_invalid.phpt similarity index 100% rename from Zend/tests/stringable_trait_invalid.phpt rename to Zend/tests/magic_methods/stringable_trait_invalid.phpt diff --git a/Zend/tests/oss-fuzz-69765.phpt b/Zend/tests/nullsafe_operator/oss-fuzz-69765.phpt similarity index 100% rename from Zend/tests/oss-fuzz-69765.phpt rename to Zend/tests/nullsafe_operator/oss-fuzz-69765.phpt diff --git a/Zend/tests/oss_fuzz_60011_1.phpt b/Zend/tests/nullsafe_operator/oss_fuzz_60011_1.phpt similarity index 100% rename from Zend/tests/oss_fuzz_60011_1.phpt rename to Zend/tests/nullsafe_operator/oss_fuzz_60011_1.phpt diff --git a/Zend/tests/oss_fuzz_60011_2.phpt b/Zend/tests/nullsafe_operator/oss_fuzz_60011_2.phpt similarity index 100% rename from Zend/tests/oss_fuzz_60011_2.phpt rename to Zend/tests/nullsafe_operator/oss_fuzz_60011_2.phpt diff --git a/Zend/tests/oss-fuzz-391975641.phpt b/Zend/tests/property_hooks/oss-fuzz-391975641.phpt similarity index 100% rename from Zend/tests/oss-fuzz-391975641.phpt rename to Zend/tests/property_hooks/oss-fuzz-391975641.phpt diff --git a/Zend/tests/034.phpt b/Zend/tests/switch/034.phpt similarity index 100% rename from Zend/tests/034.phpt rename to Zend/tests/switch/034.phpt diff --git a/Zend/tests/bug80046.phpt b/Zend/tests/switch/bug80046.phpt similarity index 100% rename from Zend/tests/bug80046.phpt rename to Zend/tests/switch/bug80046.phpt diff --git a/Zend/tests/switch_on_numeric_strings.phpt b/Zend/tests/switch/switch_on_numeric_strings.phpt similarity index 100% rename from Zend/tests/switch_on_numeric_strings.phpt rename to Zend/tests/switch/switch_on_numeric_strings.phpt diff --git a/Zend/tests/030.phpt b/Zend/tests/this-reserved/030.phpt similarity index 100% rename from Zend/tests/030.phpt rename to Zend/tests/this-reserved/030.phpt diff --git a/Zend/tests/bug34358.phpt b/Zend/tests/this-reserved/bug34358.phpt similarity index 100% rename from Zend/tests/bug34358.phpt rename to Zend/tests/this-reserved/bug34358.phpt diff --git a/Zend/tests/bug41117_1.phpt b/Zend/tests/this-reserved/bug41117_1.phpt similarity index 100% rename from Zend/tests/bug41117_1.phpt rename to Zend/tests/this-reserved/bug41117_1.phpt diff --git a/Zend/tests/bug71737.phpt b/Zend/tests/this-reserved/bug71737.phpt similarity index 100% rename from Zend/tests/bug71737.phpt rename to Zend/tests/this-reserved/bug71737.phpt diff --git a/Zend/tests/this_as_global.phpt b/Zend/tests/this-reserved/this_as_global.phpt similarity index 100% rename from Zend/tests/this_as_global.phpt rename to Zend/tests/this-reserved/this_as_global.phpt diff --git a/Zend/tests/this_as_lexical_var_error.phpt b/Zend/tests/this-reserved/this_as_lexical_var_error.phpt similarity index 100% rename from Zend/tests/this_as_lexical_var_error.phpt rename to Zend/tests/this-reserved/this_as_lexical_var_error.phpt diff --git a/Zend/tests/this_as_parameter.phpt b/Zend/tests/this-reserved/this_as_parameter.phpt similarity index 100% rename from Zend/tests/this_as_parameter.phpt rename to Zend/tests/this-reserved/this_as_parameter.phpt diff --git a/Zend/tests/this_as_static.phpt b/Zend/tests/this-reserved/this_as_static.phpt similarity index 100% rename from Zend/tests/this_as_static.phpt rename to Zend/tests/this-reserved/this_as_static.phpt diff --git a/Zend/tests/this_in_catch.phpt b/Zend/tests/this-reserved/this_in_catch.phpt similarity index 100% rename from Zend/tests/this_in_catch.phpt rename to Zend/tests/this-reserved/this_in_catch.phpt diff --git a/Zend/tests/this_in_extract.phpt b/Zend/tests/this-reserved/this_in_extract.phpt similarity index 100% rename from Zend/tests/this_in_extract.phpt rename to Zend/tests/this-reserved/this_in_extract.phpt diff --git a/Zend/tests/this_reassign.phpt b/Zend/tests/this-reserved/this_reassign.phpt similarity index 100% rename from Zend/tests/this_reassign.phpt rename to Zend/tests/this-reserved/this_reassign.phpt From 1eacd4aea0f9a7c3481b3ba2cc3d29c28bd51ac7 Mon Sep 17 00:00:00 2001 From: Niels Dossche <7771979+nielsdos@users.noreply.github.com> Date: Sun, 23 Feb 2025 00:23:22 +0100 Subject: [PATCH 06/20] Avoid unnecessary string refcounting in ext/dom (#17889) --- ext/dom/document.c | 11 ++++------- ext/dom/node.c | 5 ++--- ext/dom/xpath_callbacks.c | 10 ++++++---- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/ext/dom/document.c b/ext/dom/document.c index 60687136927b9..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; } 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/xpath_callbacks.c b/ext/dom/xpath_callbacks.c index 3155b0d626af6..c4715fa67e80a 100644 --- a/ext/dom/xpath_callbacks.c +++ b/ext/dom/xpath_callbacks.c @@ -206,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); @@ -445,9 +446,10 @@ static zend_result php_dom_xpath_callback_dispatch(php_dom_xpath_callbacks *xpat 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); } From 03f97fc34b7940f7cb752c64f611b6fbcf6cc094 Mon Sep 17 00:00:00 2001 From: Niels Dossche <7771979+nielsdos@users.noreply.github.com> Date: Sun, 23 Feb 2025 00:23:39 +0100 Subject: [PATCH 07/20] Avoid unnecessary string refcounting in ext/pcre (#17893) --- ext/pcre/php_pcre.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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); From b1841fdfa22a7cc0aaff73a84398f5becc8c43e2 Mon Sep 17 00:00:00 2001 From: Niels Dossche <7771979+nielsdos@users.noreply.github.com> Date: Sun, 23 Feb 2025 00:23:53 +0100 Subject: [PATCH 08/20] Avoid unnecessary string refcounting in ext/mbstring (#17892) --- ext/mbstring/mbstring.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c index 90792c3e4bb96..d38e2193d6379 100644 --- a/ext/mbstring/mbstring.c +++ b/ext/mbstring/mbstring.c @@ -390,7 +390,8 @@ static zend_result php_mb_parse_encoding_array(HashTable *target_hash, const mbf size_t n = 0; zval *hash_entry; ZEND_HASH_FOREACH_VAL(target_hash, hash_entry) { - zend_string *encoding_str = zval_try_get_string(hash_entry); + zend_string *tmp_encoding_str; + zend_string *encoding_str = zval_try_get_tmp_string(hash_entry, &tmp_encoding_str); if (UNEXPECTED(!encoding_str)) { efree(ZEND_VOIDP(list)); return FAILURE; @@ -415,12 +416,12 @@ static zend_result php_mb_parse_encoding_array(HashTable *target_hash, const mbf n++; } else { zend_argument_value_error(arg_num, "contains invalid encoding \"%s\"", ZSTR_VAL(encoding_str)); - zend_string_release(encoding_str); + zend_tmp_string_release(tmp_encoding_str); efree(ZEND_VOIDP(list)); return FAILURE; } } - zend_string_release(encoding_str); + zend_tmp_string_release(tmp_encoding_str); } ZEND_HASH_FOREACH_END(); *return_list = list; *return_size = n; From 67a349d8f3dd1ce3b14096a9158102a89d722ffc Mon Sep 17 00:00:00 2001 From: David CARLIER Date: Sun, 23 Feb 2025 10:16:00 +0000 Subject: [PATCH 09/20] ext/bz2: removing useless casts for filter ZendMM parts. (#17887) --- ext/bz2/bz2_filter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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); } /* }}} */ From cefdf00e7edf2a06e3413a733556f5f5e5d3980b Mon Sep 17 00:00:00 2001 From: David Carlier Date: Sun, 23 Feb 2025 09:36:05 +0000 Subject: [PATCH 10/20] Fix GH-17899: zend_test_compile_string crash on invalid script path. when opcache is enabled. close GH-17901 --- NEWS | 2 ++ ext/opcache/ZendAccelerator.c | 7 ++++++- ext/zend_test/tests/gh17899.phpt | 34 ++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 ext/zend_test/tests/gh17899.phpt diff --git a/NEWS b/NEWS index 2f542eef11ac4..71711936262d8 100644 --- a/NEWS +++ b/NEWS @@ -42,6 +42,8 @@ PHP NEWS . Fixed bug GH-17654 (Multiple classes using same trait causes function JIT crash). (nielsdos) . Fixed bug GH-17577 (JIT packed type guard crash). (nielsdos, Dmitry) + . Fixed bug GH-17899 (zend_test_compile_string with invalid path + when opcache is enabled). (David Carlier) - PDO_SQLite: . Fixed GH-17837 ()::getColumnMeta() on unexecuted statement segfaults). diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index a71a512c03edd..eac5cbbc41f7d 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -1334,7 +1334,12 @@ zend_string *accel_make_persistent_key(zend_string *str) EXPECTED((parent_script = zend_get_executed_filename_ex()) != NULL)) { parent_script_len = ZSTR_LEN(parent_script); - while ((--parent_script_len > 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; diff --git a/ext/zend_test/tests/gh17899.phpt b/ext/zend_test/tests/gh17899.phpt new file mode 100644 index 0000000000000..6286243046047 --- /dev/null +++ b/ext/zend_test/tests/gh17899.phpt @@ -0,0 +1,34 @@ +--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 + From 404c96e2bb5e65324dd7447ea37ab7c3bb73261a Mon Sep 17 00:00:00 2001 From: Niels Dossche <7771979+nielsdos@users.noreply.github.com> Date: Sun, 23 Feb 2025 14:14:42 +0100 Subject: [PATCH 11/20] Avoid string copies for date/time format in firebird (#17902) --- ext/pdo_firebird/firebird_driver.c | 39 +++++++++++++++---------- ext/pdo_firebird/firebird_statement.c | 10 +++---- ext/pdo_firebird/php_pdo_firebird_int.h | 6 ++-- 3 files changed, 32 insertions(+), 23 deletions(-) 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; From 2c251f945cea63cf140d1669c7211e75e8a6cb00 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Sun, 23 Feb 2025 13:23:26 +0000 Subject: [PATCH 12/20] [skip ci] zend_test adding closing tags to newer tests --- ext/zend_test/tests/gh17797.phpt | 1 + ext/zend_test/tests/gh17899.phpt | 1 + 2 files changed, 2 insertions(+) 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 index 6286243046047..184fe0b2aa39d 100644 --- a/ext/zend_test/tests/gh17899.phpt +++ b/ext/zend_test/tests/gh17899.phpt @@ -12,6 +12,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 From 674663464eacb2b8f0c80da58e2430fd90c310c3 Mon Sep 17 00:00:00 2001 From: DanielEScherzer Date: Sun, 23 Feb 2025 06:41:49 -0800 Subject: [PATCH 13/20] Zend/tests: organize some tests with sub directories (9) (#17897) Add directories for tests relating to - calling user functions (`call_user_func()` and `call_user_func_array()`) - using `::class` to access class names - null coalescing with `??` - concatenation with `.` - indirect function calls (e.g. by calling a variable with a function name) - reporting of line numbers - static variables in functions - type casts As well as organizing a couple of tests into existing sub directories along the way Work towards GH-15631 --- Zend/tests/{ => call_user_functions}/bug32290.phpt | 0 Zend/tests/{ => call_user_functions}/bug43426.phpt | 0 Zend/tests/{ => call_user_functions}/bug66719.phpt | 0 Zend/tests/{ => call_user_functions}/call_user_func_001.phpt | 0 Zend/tests/{ => call_user_functions}/call_user_func_002.phpt | 0 Zend/tests/{ => call_user_functions}/call_user_func_003.phpt | 0 Zend/tests/{ => call_user_functions}/call_user_func_005.phpt | 0 Zend/tests/{ => call_user_functions}/call_user_func_006.phpt | 0 Zend/tests/{ => call_user_functions}/call_user_func_007.phpt | 0 Zend/tests/{ => call_user_functions}/call_user_func_008.phpt | 0 Zend/tests/{ => call_user_functions}/call_user_func_009.phpt | 0 .../call_user_func_array_array_slice_named_args.phpt | 0 .../call_user_func_array_array_slice_type.phpt | 0 .../call_user_func_array_array_slice_type_strict.phpt | 0 .../call_user_func_array_invalid_type.phpt | 0 .../call_user_func_array_prefer_ref.phpt | 0 Zend/tests/{ => call_user_functions}/call_user_func_by_ref.phpt | 0 .../call_user_func_closure_from_static_method.phpt | 0 .../call_user_func_strict_arginfo_check.phpt | 0 Zend/tests/{ => class_name}/class_name_as_scalar.phpt | 0 Zend/tests/{ => class_name}/class_name_as_scalar_error_001.phpt | 0 Zend/tests/{ => class_name}/class_name_as_scalar_error_002.phpt | 0 Zend/tests/{ => class_name}/class_name_as_scalar_error_003.phpt | 0 Zend/tests/{ => class_name}/class_name_as_scalar_error_004.phpt | 0 Zend/tests/{ => class_name}/class_name_as_scalar_error_005.phpt | 0 Zend/tests/{ => class_name}/class_name_as_scalar_error_006.phpt | 0 Zend/tests/{ => class_name}/class_name_as_scalar_error_007.phpt | 0 .../{ => class_name}/class_on_constant_evaluated_expression.phpt | 0 Zend/tests/{ => class_name}/class_on_object.phpt | 0 Zend/tests/{ => class_name}/parent_class_name_without_parent.phpt | 0 .../tests/{ => class_name}/self_class_const_in_unknown_scope.phpt | 0 Zend/tests/{ => coalesce}/assign_coalesce_001.phpt | 0 Zend/tests/{ => coalesce}/assign_coalesce_002.phpt | 0 Zend/tests/{ => coalesce}/assign_coalesce_003.phpt | 0 Zend/tests/{ => coalesce}/assign_coalesce_004.phpt | 0 Zend/tests/{ => coalesce}/assign_coalesce_005.phpt | 0 Zend/tests/{ => coalesce}/assign_coalesce_006.phpt | 0 Zend/tests/{ => coalesce}/assign_coalesce_007.phpt | 0 Zend/tests/{ => coalesce}/assign_coalesce_008.phpt | 0 Zend/tests/{ => coalesce}/assign_coalesce_009.phpt | 0 Zend/tests/{ => coalesce}/bug69889.phpt | 0 Zend/tests/{ => coalesce}/bug81684.phpt | 0 Zend/tests/{ => coalesce}/coalesce_assign_optimization.phpt | 0 Zend/tests/{ => coalesce}/gh11108.phpt | 0 Zend/tests/{ => coalesce}/gh11108_shutdown.inc | 0 Zend/tests/{ => coalesce}/gh11108_test.inc | 0 Zend/tests/{ => concat}/assign_concat_array_empty_string.phpt | 0 Zend/tests/{ => concat}/bug32833.phpt | 0 Zend/tests/{ => concat}/bug40809.phpt | 0 Zend/tests/{ => concat}/bug44069.phpt | 0 Zend/tests/{ => concat}/bug68118.phpt | 0 Zend/tests/{ => concat}/bug79836.phpt | 0 Zend/tests/{ => concat}/bug79836_1.phpt | 0 Zend/tests/{ => concat}/bug79836_2.phpt | 0 Zend/tests/{ => concat}/bug79836_3.phpt | 0 Zend/tests/{ => concat}/bug79836_4.phpt | 0 Zend/tests/{ => concat}/bug81705.phpt | 0 Zend/tests/{ => concat}/concat_001.phpt | 0 Zend/tests/{ => concat}/concat_002.phpt | 0 Zend/tests/{ => concat}/concat_003.phpt | 0 Zend/tests/{ => constants}/bug76430.phpt | 0 Zend/tests/{ => constants}/gh17222.phpt | 0 Zend/tests/{ => constants}/oss_fuzz_57821.phpt | 0 Zend/tests/{ => debug_info}/recursive_debug_info.phpt | 0 Zend/tests/{ => grammar}/gh14961.phpt | 0 Zend/tests/{ => in-de-crement}/oss_fuzz_63802.phpt | 0 Zend/tests/{ => in-de-crement}/post_inc_without_use.phpt | 0 .../{ => indirect_function_call}/indirect_call_array_001.phpt | 0 .../{ => indirect_function_call}/indirect_call_array_002.phpt | 0 .../{ => indirect_function_call}/indirect_call_array_003.phpt | 0 .../{ => indirect_function_call}/indirect_call_array_004.phpt | 0 .../{ => indirect_function_call}/indirect_call_array_005.phpt | 0 .../{ => indirect_function_call}/indirect_call_from_constant.phpt | 0 .../{ => indirect_function_call}/indirect_call_string_001.phpt | 0 .../{ => indirect_function_call}/indirect_call_string_002.phpt | 0 .../{ => indirect_function_call}/indirect_call_string_003.phpt | 0 .../{ => indirect_function_call}/indirect_method_call_001.phpt | 0 .../{ => indirect_function_call}/indirect_method_call_002.phpt | 0 .../{ => indirect_function_call}/indirect_method_call_003.phpt | 0 .../{ => indirect_function_call}/indirect_method_call_004.phpt | 0 .../{ => indirect_function_call}/indirect_method_call_005.phpt | 0 Zend/tests/{ => line_numbers}/bug81631.phpt | 0 Zend/tests/{ => line_numbers}/gh16509.inc | 0 Zend/tests/{ => line_numbers}/gh16509.phpt | 0 Zend/tests/{ => line_numbers}/gh8810_1.phpt | 0 Zend/tests/{ => line_numbers}/gh8810_2.phpt | 0 Zend/tests/{ => line_numbers}/gh8810_3.phpt | 0 Zend/tests/{ => line_numbers}/gh8810_4.phpt | 0 Zend/tests/{ => line_numbers}/gh8810_5.phpt | 0 Zend/tests/{ => line_numbers}/gh8810_6.phpt | 0 Zend/tests/{ => line_numbers}/gh8810_7.phpt | 0 Zend/tests/{ => line_numbers}/gh8821.phpt | 0 .../tests/{ => magic_methods}/overloaded_prop_assign_op_refs.phpt | 0 .../{ => magic_methods}/trampoline_closure_named_arguments.phpt | 0 Zend/tests/{ => serialize}/serializable_deprecation.phpt | 0 Zend/tests/{ => static_variables}/static_variable.phpt | 0 Zend/tests/{ => static_variables}/static_variable_func_call.phpt | 0 .../static_variable_in_dynamic_function.phpt | 0 .../static_variable_in_dynamic_function_2.phpt | 0 .../{ => static_variables}/static_variable_in_private_method.phpt | 0 .../static_variable_in_private_trait_method.phpt | 0 .../{ => static_variables}/static_variables_closure_bind.phpt | 0 .../tests/{ => static_variables}/static_variables_destructor.phpt | 0 Zend/tests/{ => static_variables}/static_variables_global.phpt | 0 Zend/tests/{ => static_variables}/static_variables_global_2.phpt | 0 Zend/tests/{ => static_variables}/static_variables_recursive.phpt | 0 .../static_variables_throwing_initializer.phpt | 0 Zend/tests/{ => static_variables}/static_variables_traits.phpt | 0 Zend/tests/{ => traits}/class_uses_static.phpt | 0 Zend/tests/{ => type_casts}/cast_to_array.phpt | 0 Zend/tests/{ => type_casts}/cast_to_bool.phpt | 0 Zend/tests/{ => type_casts}/cast_to_double.phpt | 0 Zend/tests/{ => type_casts}/cast_to_int.phpt | 0 Zend/tests/{ => type_casts}/cast_to_object.phpt | 0 Zend/tests/{ => type_casts}/cast_to_string.phpt | 0 Zend/tests/{ => type_casts}/real_cast.phpt | 0 116 files changed, 0 insertions(+), 0 deletions(-) rename Zend/tests/{ => call_user_functions}/bug32290.phpt (100%) rename Zend/tests/{ => call_user_functions}/bug43426.phpt (100%) rename Zend/tests/{ => call_user_functions}/bug66719.phpt (100%) rename Zend/tests/{ => call_user_functions}/call_user_func_001.phpt (100%) rename Zend/tests/{ => call_user_functions}/call_user_func_002.phpt (100%) rename Zend/tests/{ => call_user_functions}/call_user_func_003.phpt (100%) rename Zend/tests/{ => call_user_functions}/call_user_func_005.phpt (100%) rename Zend/tests/{ => call_user_functions}/call_user_func_006.phpt (100%) rename Zend/tests/{ => call_user_functions}/call_user_func_007.phpt (100%) rename Zend/tests/{ => call_user_functions}/call_user_func_008.phpt (100%) rename Zend/tests/{ => call_user_functions}/call_user_func_009.phpt (100%) rename Zend/tests/{ => call_user_functions}/call_user_func_array_array_slice_named_args.phpt (100%) rename Zend/tests/{ => call_user_functions}/call_user_func_array_array_slice_type.phpt (100%) rename Zend/tests/{ => call_user_functions}/call_user_func_array_array_slice_type_strict.phpt (100%) rename Zend/tests/{ => call_user_functions}/call_user_func_array_invalid_type.phpt (100%) rename Zend/tests/{ => call_user_functions}/call_user_func_array_prefer_ref.phpt (100%) rename Zend/tests/{ => call_user_functions}/call_user_func_by_ref.phpt (100%) rename Zend/tests/{ => call_user_functions}/call_user_func_closure_from_static_method.phpt (100%) rename Zend/tests/{ => call_user_functions}/call_user_func_strict_arginfo_check.phpt (100%) rename Zend/tests/{ => class_name}/class_name_as_scalar.phpt (100%) rename Zend/tests/{ => class_name}/class_name_as_scalar_error_001.phpt (100%) rename Zend/tests/{ => class_name}/class_name_as_scalar_error_002.phpt (100%) rename Zend/tests/{ => class_name}/class_name_as_scalar_error_003.phpt (100%) rename Zend/tests/{ => class_name}/class_name_as_scalar_error_004.phpt (100%) rename Zend/tests/{ => class_name}/class_name_as_scalar_error_005.phpt (100%) rename Zend/tests/{ => class_name}/class_name_as_scalar_error_006.phpt (100%) rename Zend/tests/{ => class_name}/class_name_as_scalar_error_007.phpt (100%) rename Zend/tests/{ => class_name}/class_on_constant_evaluated_expression.phpt (100%) rename Zend/tests/{ => class_name}/class_on_object.phpt (100%) rename Zend/tests/{ => class_name}/parent_class_name_without_parent.phpt (100%) rename Zend/tests/{ => class_name}/self_class_const_in_unknown_scope.phpt (100%) rename Zend/tests/{ => coalesce}/assign_coalesce_001.phpt (100%) rename Zend/tests/{ => coalesce}/assign_coalesce_002.phpt (100%) rename Zend/tests/{ => coalesce}/assign_coalesce_003.phpt (100%) rename Zend/tests/{ => coalesce}/assign_coalesce_004.phpt (100%) rename Zend/tests/{ => coalesce}/assign_coalesce_005.phpt (100%) rename Zend/tests/{ => coalesce}/assign_coalesce_006.phpt (100%) rename Zend/tests/{ => coalesce}/assign_coalesce_007.phpt (100%) rename Zend/tests/{ => coalesce}/assign_coalesce_008.phpt (100%) rename Zend/tests/{ => coalesce}/assign_coalesce_009.phpt (100%) rename Zend/tests/{ => coalesce}/bug69889.phpt (100%) rename Zend/tests/{ => coalesce}/bug81684.phpt (100%) rename Zend/tests/{ => coalesce}/coalesce_assign_optimization.phpt (100%) rename Zend/tests/{ => coalesce}/gh11108.phpt (100%) rename Zend/tests/{ => coalesce}/gh11108_shutdown.inc (100%) rename Zend/tests/{ => coalesce}/gh11108_test.inc (100%) rename Zend/tests/{ => concat}/assign_concat_array_empty_string.phpt (100%) rename Zend/tests/{ => concat}/bug32833.phpt (100%) rename Zend/tests/{ => concat}/bug40809.phpt (100%) rename Zend/tests/{ => concat}/bug44069.phpt (100%) rename Zend/tests/{ => concat}/bug68118.phpt (100%) rename Zend/tests/{ => concat}/bug79836.phpt (100%) rename Zend/tests/{ => concat}/bug79836_1.phpt (100%) rename Zend/tests/{ => concat}/bug79836_2.phpt (100%) rename Zend/tests/{ => concat}/bug79836_3.phpt (100%) rename Zend/tests/{ => concat}/bug79836_4.phpt (100%) rename Zend/tests/{ => concat}/bug81705.phpt (100%) rename Zend/tests/{ => concat}/concat_001.phpt (100%) rename Zend/tests/{ => concat}/concat_002.phpt (100%) rename Zend/tests/{ => concat}/concat_003.phpt (100%) rename Zend/tests/{ => constants}/bug76430.phpt (100%) rename Zend/tests/{ => constants}/gh17222.phpt (100%) rename Zend/tests/{ => constants}/oss_fuzz_57821.phpt (100%) rename Zend/tests/{ => debug_info}/recursive_debug_info.phpt (100%) rename Zend/tests/{ => grammar}/gh14961.phpt (100%) rename Zend/tests/{ => in-de-crement}/oss_fuzz_63802.phpt (100%) rename Zend/tests/{ => in-de-crement}/post_inc_without_use.phpt (100%) rename Zend/tests/{ => indirect_function_call}/indirect_call_array_001.phpt (100%) rename Zend/tests/{ => indirect_function_call}/indirect_call_array_002.phpt (100%) rename Zend/tests/{ => indirect_function_call}/indirect_call_array_003.phpt (100%) rename Zend/tests/{ => indirect_function_call}/indirect_call_array_004.phpt (100%) rename Zend/tests/{ => indirect_function_call}/indirect_call_array_005.phpt (100%) rename Zend/tests/{ => indirect_function_call}/indirect_call_from_constant.phpt (100%) rename Zend/tests/{ => indirect_function_call}/indirect_call_string_001.phpt (100%) rename Zend/tests/{ => indirect_function_call}/indirect_call_string_002.phpt (100%) rename Zend/tests/{ => indirect_function_call}/indirect_call_string_003.phpt (100%) rename Zend/tests/{ => indirect_function_call}/indirect_method_call_001.phpt (100%) rename Zend/tests/{ => indirect_function_call}/indirect_method_call_002.phpt (100%) rename Zend/tests/{ => indirect_function_call}/indirect_method_call_003.phpt (100%) rename Zend/tests/{ => indirect_function_call}/indirect_method_call_004.phpt (100%) rename Zend/tests/{ => indirect_function_call}/indirect_method_call_005.phpt (100%) rename Zend/tests/{ => line_numbers}/bug81631.phpt (100%) rename Zend/tests/{ => line_numbers}/gh16509.inc (100%) rename Zend/tests/{ => line_numbers}/gh16509.phpt (100%) rename Zend/tests/{ => line_numbers}/gh8810_1.phpt (100%) rename Zend/tests/{ => line_numbers}/gh8810_2.phpt (100%) rename Zend/tests/{ => line_numbers}/gh8810_3.phpt (100%) rename Zend/tests/{ => line_numbers}/gh8810_4.phpt (100%) rename Zend/tests/{ => line_numbers}/gh8810_5.phpt (100%) rename Zend/tests/{ => line_numbers}/gh8810_6.phpt (100%) rename Zend/tests/{ => line_numbers}/gh8810_7.phpt (100%) rename Zend/tests/{ => line_numbers}/gh8821.phpt (100%) rename Zend/tests/{ => magic_methods}/overloaded_prop_assign_op_refs.phpt (100%) rename Zend/tests/{ => magic_methods}/trampoline_closure_named_arguments.phpt (100%) rename Zend/tests/{ => serialize}/serializable_deprecation.phpt (100%) rename Zend/tests/{ => static_variables}/static_variable.phpt (100%) rename Zend/tests/{ => static_variables}/static_variable_func_call.phpt (100%) rename Zend/tests/{ => static_variables}/static_variable_in_dynamic_function.phpt (100%) rename Zend/tests/{ => static_variables}/static_variable_in_dynamic_function_2.phpt (100%) rename Zend/tests/{ => static_variables}/static_variable_in_private_method.phpt (100%) rename Zend/tests/{ => static_variables}/static_variable_in_private_trait_method.phpt (100%) rename Zend/tests/{ => static_variables}/static_variables_closure_bind.phpt (100%) rename Zend/tests/{ => static_variables}/static_variables_destructor.phpt (100%) rename Zend/tests/{ => static_variables}/static_variables_global.phpt (100%) rename Zend/tests/{ => static_variables}/static_variables_global_2.phpt (100%) rename Zend/tests/{ => static_variables}/static_variables_recursive.phpt (100%) rename Zend/tests/{ => static_variables}/static_variables_throwing_initializer.phpt (100%) rename Zend/tests/{ => static_variables}/static_variables_traits.phpt (100%) rename Zend/tests/{ => traits}/class_uses_static.phpt (100%) rename Zend/tests/{ => type_casts}/cast_to_array.phpt (100%) rename Zend/tests/{ => type_casts}/cast_to_bool.phpt (100%) rename Zend/tests/{ => type_casts}/cast_to_double.phpt (100%) rename Zend/tests/{ => type_casts}/cast_to_int.phpt (100%) rename Zend/tests/{ => type_casts}/cast_to_object.phpt (100%) rename Zend/tests/{ => type_casts}/cast_to_string.phpt (100%) rename Zend/tests/{ => type_casts}/real_cast.phpt (100%) 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/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/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/recursive_debug_info.phpt b/Zend/tests/debug_info/recursive_debug_info.phpt similarity index 100% rename from Zend/tests/recursive_debug_info.phpt rename to Zend/tests/debug_info/recursive_debug_info.phpt diff --git a/Zend/tests/gh14961.phpt b/Zend/tests/grammar/gh14961.phpt similarity index 100% rename from Zend/tests/gh14961.phpt rename to Zend/tests/grammar/gh14961.phpt diff --git a/Zend/tests/oss_fuzz_63802.phpt b/Zend/tests/in-de-crement/oss_fuzz_63802.phpt similarity index 100% rename from Zend/tests/oss_fuzz_63802.phpt rename to Zend/tests/in-de-crement/oss_fuzz_63802.phpt diff --git a/Zend/tests/post_inc_without_use.phpt b/Zend/tests/in-de-crement/post_inc_without_use.phpt similarity index 100% rename from Zend/tests/post_inc_without_use.phpt rename to Zend/tests/in-de-crement/post_inc_without_use.phpt diff --git a/Zend/tests/indirect_call_array_001.phpt b/Zend/tests/indirect_function_call/indirect_call_array_001.phpt similarity index 100% rename from Zend/tests/indirect_call_array_001.phpt rename to Zend/tests/indirect_function_call/indirect_call_array_001.phpt diff --git a/Zend/tests/indirect_call_array_002.phpt b/Zend/tests/indirect_function_call/indirect_call_array_002.phpt similarity index 100% rename from Zend/tests/indirect_call_array_002.phpt rename to Zend/tests/indirect_function_call/indirect_call_array_002.phpt diff --git a/Zend/tests/indirect_call_array_003.phpt b/Zend/tests/indirect_function_call/indirect_call_array_003.phpt similarity index 100% rename from Zend/tests/indirect_call_array_003.phpt rename to Zend/tests/indirect_function_call/indirect_call_array_003.phpt diff --git a/Zend/tests/indirect_call_array_004.phpt b/Zend/tests/indirect_function_call/indirect_call_array_004.phpt similarity index 100% rename from Zend/tests/indirect_call_array_004.phpt rename to Zend/tests/indirect_function_call/indirect_call_array_004.phpt diff --git a/Zend/tests/indirect_call_array_005.phpt b/Zend/tests/indirect_function_call/indirect_call_array_005.phpt similarity index 100% rename from Zend/tests/indirect_call_array_005.phpt rename to Zend/tests/indirect_function_call/indirect_call_array_005.phpt diff --git a/Zend/tests/indirect_call_from_constant.phpt b/Zend/tests/indirect_function_call/indirect_call_from_constant.phpt similarity index 100% rename from Zend/tests/indirect_call_from_constant.phpt rename to Zend/tests/indirect_function_call/indirect_call_from_constant.phpt diff --git a/Zend/tests/indirect_call_string_001.phpt b/Zend/tests/indirect_function_call/indirect_call_string_001.phpt similarity index 100% rename from Zend/tests/indirect_call_string_001.phpt rename to Zend/tests/indirect_function_call/indirect_call_string_001.phpt diff --git a/Zend/tests/indirect_call_string_002.phpt b/Zend/tests/indirect_function_call/indirect_call_string_002.phpt similarity index 100% rename from Zend/tests/indirect_call_string_002.phpt rename to Zend/tests/indirect_function_call/indirect_call_string_002.phpt diff --git a/Zend/tests/indirect_call_string_003.phpt b/Zend/tests/indirect_function_call/indirect_call_string_003.phpt similarity index 100% rename from Zend/tests/indirect_call_string_003.phpt rename to Zend/tests/indirect_function_call/indirect_call_string_003.phpt diff --git a/Zend/tests/indirect_method_call_001.phpt b/Zend/tests/indirect_function_call/indirect_method_call_001.phpt similarity index 100% rename from Zend/tests/indirect_method_call_001.phpt rename to Zend/tests/indirect_function_call/indirect_method_call_001.phpt diff --git a/Zend/tests/indirect_method_call_002.phpt b/Zend/tests/indirect_function_call/indirect_method_call_002.phpt similarity index 100% rename from Zend/tests/indirect_method_call_002.phpt rename to Zend/tests/indirect_function_call/indirect_method_call_002.phpt diff --git a/Zend/tests/indirect_method_call_003.phpt b/Zend/tests/indirect_function_call/indirect_method_call_003.phpt similarity index 100% rename from Zend/tests/indirect_method_call_003.phpt rename to Zend/tests/indirect_function_call/indirect_method_call_003.phpt diff --git a/Zend/tests/indirect_method_call_004.phpt b/Zend/tests/indirect_function_call/indirect_method_call_004.phpt similarity index 100% rename from Zend/tests/indirect_method_call_004.phpt rename to Zend/tests/indirect_function_call/indirect_method_call_004.phpt diff --git a/Zend/tests/indirect_method_call_005.phpt b/Zend/tests/indirect_function_call/indirect_method_call_005.phpt similarity index 100% rename from Zend/tests/indirect_method_call_005.phpt rename to Zend/tests/indirect_function_call/indirect_method_call_005.phpt diff --git a/Zend/tests/bug81631.phpt b/Zend/tests/line_numbers/bug81631.phpt similarity index 100% rename from Zend/tests/bug81631.phpt rename to Zend/tests/line_numbers/bug81631.phpt diff --git a/Zend/tests/gh16509.inc b/Zend/tests/line_numbers/gh16509.inc similarity index 100% rename from Zend/tests/gh16509.inc rename to Zend/tests/line_numbers/gh16509.inc diff --git a/Zend/tests/gh16509.phpt b/Zend/tests/line_numbers/gh16509.phpt similarity index 100% rename from Zend/tests/gh16509.phpt rename to Zend/tests/line_numbers/gh16509.phpt diff --git a/Zend/tests/gh8810_1.phpt b/Zend/tests/line_numbers/gh8810_1.phpt similarity index 100% rename from Zend/tests/gh8810_1.phpt rename to Zend/tests/line_numbers/gh8810_1.phpt diff --git a/Zend/tests/gh8810_2.phpt b/Zend/tests/line_numbers/gh8810_2.phpt similarity index 100% rename from Zend/tests/gh8810_2.phpt rename to Zend/tests/line_numbers/gh8810_2.phpt diff --git a/Zend/tests/gh8810_3.phpt b/Zend/tests/line_numbers/gh8810_3.phpt similarity index 100% rename from Zend/tests/gh8810_3.phpt rename to Zend/tests/line_numbers/gh8810_3.phpt diff --git a/Zend/tests/gh8810_4.phpt b/Zend/tests/line_numbers/gh8810_4.phpt similarity index 100% rename from Zend/tests/gh8810_4.phpt rename to Zend/tests/line_numbers/gh8810_4.phpt diff --git a/Zend/tests/gh8810_5.phpt b/Zend/tests/line_numbers/gh8810_5.phpt similarity index 100% rename from Zend/tests/gh8810_5.phpt rename to Zend/tests/line_numbers/gh8810_5.phpt diff --git a/Zend/tests/gh8810_6.phpt b/Zend/tests/line_numbers/gh8810_6.phpt similarity index 100% rename from Zend/tests/gh8810_6.phpt rename to Zend/tests/line_numbers/gh8810_6.phpt diff --git a/Zend/tests/gh8810_7.phpt b/Zend/tests/line_numbers/gh8810_7.phpt similarity index 100% rename from Zend/tests/gh8810_7.phpt rename to Zend/tests/line_numbers/gh8810_7.phpt diff --git a/Zend/tests/gh8821.phpt b/Zend/tests/line_numbers/gh8821.phpt similarity index 100% rename from Zend/tests/gh8821.phpt rename to Zend/tests/line_numbers/gh8821.phpt diff --git a/Zend/tests/overloaded_prop_assign_op_refs.phpt b/Zend/tests/magic_methods/overloaded_prop_assign_op_refs.phpt similarity index 100% rename from Zend/tests/overloaded_prop_assign_op_refs.phpt rename to Zend/tests/magic_methods/overloaded_prop_assign_op_refs.phpt diff --git a/Zend/tests/trampoline_closure_named_arguments.phpt b/Zend/tests/magic_methods/trampoline_closure_named_arguments.phpt similarity index 100% rename from Zend/tests/trampoline_closure_named_arguments.phpt rename to Zend/tests/magic_methods/trampoline_closure_named_arguments.phpt diff --git a/Zend/tests/serializable_deprecation.phpt b/Zend/tests/serialize/serializable_deprecation.phpt similarity index 100% rename from Zend/tests/serializable_deprecation.phpt rename to Zend/tests/serialize/serializable_deprecation.phpt diff --git a/Zend/tests/static_variable.phpt b/Zend/tests/static_variables/static_variable.phpt similarity index 100% rename from Zend/tests/static_variable.phpt rename to Zend/tests/static_variables/static_variable.phpt diff --git a/Zend/tests/static_variable_func_call.phpt b/Zend/tests/static_variables/static_variable_func_call.phpt similarity index 100% rename from Zend/tests/static_variable_func_call.phpt rename to Zend/tests/static_variables/static_variable_func_call.phpt diff --git a/Zend/tests/static_variable_in_dynamic_function.phpt b/Zend/tests/static_variables/static_variable_in_dynamic_function.phpt similarity index 100% rename from Zend/tests/static_variable_in_dynamic_function.phpt rename to Zend/tests/static_variables/static_variable_in_dynamic_function.phpt diff --git a/Zend/tests/static_variable_in_dynamic_function_2.phpt b/Zend/tests/static_variables/static_variable_in_dynamic_function_2.phpt similarity index 100% rename from Zend/tests/static_variable_in_dynamic_function_2.phpt rename to Zend/tests/static_variables/static_variable_in_dynamic_function_2.phpt diff --git a/Zend/tests/static_variable_in_private_method.phpt b/Zend/tests/static_variables/static_variable_in_private_method.phpt similarity index 100% rename from Zend/tests/static_variable_in_private_method.phpt rename to Zend/tests/static_variables/static_variable_in_private_method.phpt diff --git a/Zend/tests/static_variable_in_private_trait_method.phpt b/Zend/tests/static_variables/static_variable_in_private_trait_method.phpt similarity index 100% rename from Zend/tests/static_variable_in_private_trait_method.phpt rename to Zend/tests/static_variables/static_variable_in_private_trait_method.phpt diff --git a/Zend/tests/static_variables_closure_bind.phpt b/Zend/tests/static_variables/static_variables_closure_bind.phpt similarity index 100% rename from Zend/tests/static_variables_closure_bind.phpt rename to Zend/tests/static_variables/static_variables_closure_bind.phpt diff --git a/Zend/tests/static_variables_destructor.phpt b/Zend/tests/static_variables/static_variables_destructor.phpt similarity index 100% rename from Zend/tests/static_variables_destructor.phpt rename to Zend/tests/static_variables/static_variables_destructor.phpt diff --git a/Zend/tests/static_variables_global.phpt b/Zend/tests/static_variables/static_variables_global.phpt similarity index 100% rename from Zend/tests/static_variables_global.phpt rename to Zend/tests/static_variables/static_variables_global.phpt diff --git a/Zend/tests/static_variables_global_2.phpt b/Zend/tests/static_variables/static_variables_global_2.phpt similarity index 100% rename from Zend/tests/static_variables_global_2.phpt rename to Zend/tests/static_variables/static_variables_global_2.phpt diff --git a/Zend/tests/static_variables_recursive.phpt b/Zend/tests/static_variables/static_variables_recursive.phpt similarity index 100% rename from Zend/tests/static_variables_recursive.phpt rename to Zend/tests/static_variables/static_variables_recursive.phpt diff --git a/Zend/tests/static_variables_throwing_initializer.phpt b/Zend/tests/static_variables/static_variables_throwing_initializer.phpt similarity index 100% rename from Zend/tests/static_variables_throwing_initializer.phpt rename to Zend/tests/static_variables/static_variables_throwing_initializer.phpt diff --git a/Zend/tests/static_variables_traits.phpt b/Zend/tests/static_variables/static_variables_traits.phpt similarity index 100% rename from Zend/tests/static_variables_traits.phpt rename to Zend/tests/static_variables/static_variables_traits.phpt diff --git a/Zend/tests/class_uses_static.phpt b/Zend/tests/traits/class_uses_static.phpt similarity index 100% rename from Zend/tests/class_uses_static.phpt rename to Zend/tests/traits/class_uses_static.phpt diff --git a/Zend/tests/cast_to_array.phpt b/Zend/tests/type_casts/cast_to_array.phpt similarity index 100% rename from Zend/tests/cast_to_array.phpt rename to Zend/tests/type_casts/cast_to_array.phpt diff --git a/Zend/tests/cast_to_bool.phpt b/Zend/tests/type_casts/cast_to_bool.phpt similarity index 100% rename from Zend/tests/cast_to_bool.phpt rename to Zend/tests/type_casts/cast_to_bool.phpt diff --git a/Zend/tests/cast_to_double.phpt b/Zend/tests/type_casts/cast_to_double.phpt similarity index 100% rename from Zend/tests/cast_to_double.phpt rename to Zend/tests/type_casts/cast_to_double.phpt diff --git a/Zend/tests/cast_to_int.phpt b/Zend/tests/type_casts/cast_to_int.phpt similarity index 100% rename from Zend/tests/cast_to_int.phpt rename to Zend/tests/type_casts/cast_to_int.phpt diff --git a/Zend/tests/cast_to_object.phpt b/Zend/tests/type_casts/cast_to_object.phpt similarity index 100% rename from Zend/tests/cast_to_object.phpt rename to Zend/tests/type_casts/cast_to_object.phpt diff --git a/Zend/tests/cast_to_string.phpt b/Zend/tests/type_casts/cast_to_string.phpt similarity index 100% rename from Zend/tests/cast_to_string.phpt rename to Zend/tests/type_casts/cast_to_string.phpt diff --git a/Zend/tests/real_cast.phpt b/Zend/tests/type_casts/real_cast.phpt similarity index 100% rename from Zend/tests/real_cast.phpt rename to Zend/tests/type_casts/real_cast.phpt From 353f21487f4dbdfbf80cb818d83787b013443550 Mon Sep 17 00:00:00 2001 From: Niels Dossche <7771979+nielsdos@users.noreply.github.com> Date: Sun, 23 Feb 2025 14:15:40 +0100 Subject: [PATCH 14/20] Fix cycle leak in sqlite3 setAuthorizer() Closes GH-17903. --- NEWS | 1 + ext/sqlite3/sqlite3.c | 4 +++- .../tests/setauthorizer_cycle_leak.phpt | 21 +++++++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 ext/sqlite3/tests/setauthorizer_cycle_leak.phpt diff --git a/NEWS b/NEWS index 71711936262d8..e587a7c770b29 100644 --- a/NEWS +++ b/NEWS @@ -48,6 +48,7 @@ PHP NEWS - PDO_SQLite: . Fixed GH-17837 ()::getColumnMeta() on unexecuted statement segfaults). (cmb) + . Fix cycle leak in sqlite3 setAuthorizer(). (nielsdos) - Phar: . Fixed bug GH-17808: PharFileInfo refcount bug. (nielsdos) diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c index badcfcc29b0c5..09cb57410c87f 100644 --- a/ext/sqlite3/sqlite3.c +++ b/ext/sqlite3/sqlite3.c @@ -2256,7 +2256,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; @@ -2264,6 +2264,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 From 635fe263acfef00bd4f324fb885a179d16283e96 Mon Sep 17 00:00:00 2001 From: Niels Dossche <7771979+nielsdos@users.noreply.github.com> Date: Sun, 23 Feb 2025 15:06:07 +0100 Subject: [PATCH 15/20] Fix memory leaks in pdo_sqlite callback registration * We need to clean the trampoline if the construction check fails * Checking for an exception and then returning causes a leak on `collation`. Returning early is pointless anyway. Closes GH-17904. --- NEWS | 1 + ext/pdo_sqlite/sqlite_driver.c | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index b35692f872ec6..b8e830ca10ea7 100644 --- a/NEWS +++ b/NEWS @@ -60,6 +60,7 @@ PHP NEWS . Fixed GH-17837 ()::getColumnMeta() on unexecuted statement segfaults). (cmb) . Fix cycle leak in sqlite3 setAuthorizer(). (nielsdos) + . Fix memory leaks in pdo_sqlite callback registration. (nielsdos) - Phar: . Fixed bug GH-17808: PharFileInfo refcount bug. (nielsdos) diff --git a/ext/pdo_sqlite/sqlite_driver.c b/ext/pdo_sqlite/sqlite_driver.c index 3c2b4efde16fb..e7eb710030c35 100644 --- a/ext/pdo_sqlite/sqlite_driver.c +++ b/ext/pdo_sqlite/sqlite_driver.c @@ -513,7 +513,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; @@ -571,7 +571,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; @@ -643,7 +643,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; @@ -663,12 +663,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) From 065b4ec1255affac290473f8980a24092f4e3324 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 23 Aug 2023 18:42:17 -0400 Subject: [PATCH 16/20] ext/gd/tests: backport optional PNG support - Three of our gd tests could be skipped with a message about requiring bundled GD, but those tests don't actually require bundled GD. We update the messages to mention the specific functions that are required. - add SKIPIF stanzas for missing PNG support The bundled libgd always has PNG support, but an external one may not. - imagerotate() is always available Following 59ec80c5, the imagerotate() function is always available. We may therefore remove its function_exists() checks without harm. close GH-17894 --- ext/gd/tests/bug22544-mb.phpt | 6 ++++++ ext/gd/tests/bug22544.phpt | 6 ++++++ ext/gd/tests/bug24155.phpt | 4 +++- ext/gd/tests/bug27582_1.phpt | 6 ++++++ ext/gd/tests/bug39366.phpt | 4 ---- ext/gd/tests/bug39780_extern.phpt | 3 +++ ext/gd/tests/bug43073.phpt | 3 +++ ext/gd/tests/bug43475.phpt | 3 +++ ext/gd/tests/bug43828.phpt | 3 +++ ext/gd/tests/bug45799.phpt | 6 ++++++ ext/gd/tests/bug47946.phpt | 3 +++ ext/gd/tests/bug48732-mb.phpt | 3 +++ ext/gd/tests/bug48732.phpt | 4 ++++ ext/gd/tests/bug50194.phpt | 4 +++- ext/gd/tests/bug51498.phpt | 3 +++ ext/gd/tests/bug52070.phpt | 6 ++++++ ext/gd/tests/bug53504.phpt | 3 +++ ext/gd/tests/bug64641.phpt | 3 +++ ext/gd/tests/bug66005.phpt | 6 ++++++ ext/gd/tests/bug72482_2.phpt | 6 ++++++ ext/gd/tests/bug72604.phpt | 6 ++++++ ext/gd/tests/bug72913.phpt | 6 ++++++ ext/gd/tests/bug73213.phpt | 6 ++++++ ext/gd/tests/bug73272.phpt | 6 ++++++ ext/gd/tests/bug73549.phpt | 6 ++++++ ext/gd/tests/bug73614.phpt | 3 +++ ext/gd/tests/bug74031.phpt | 6 ++++++ ext/gd/tests/bug75124.phpt | 3 +++ ext/gd/tests/bug77943.phpt | 6 ++++++ ext/gd/tests/bug79945.phpt | 3 +++ ext/gd/tests/imagearc_basic.phpt | 6 ++++++ ext/gd/tests/imagearc_variation1.phpt | 6 ++++++ ext/gd/tests/imagearc_variation2.phpt | 6 ++++++ ext/gd/tests/imagechar_basic.phpt | 6 ++++++ ext/gd/tests/imagecharup_basic.phpt | 6 ++++++ ext/gd/tests/imagecolorallocatealpha_basic.phpt | 3 +++ ext/gd/tests/imagecolorset_basic.phpt | 6 ++++++ ext/gd/tests/imageconvolution_basic.phpt | 6 ++++++ ext/gd/tests/imagecopyresampled_basic.phpt | 6 ++++++ ext/gd/tests/imagecreatefrombmp_basic.phpt | 3 +++ ext/gd/tests/imagecreatefromstring_bmp.phpt | 3 +++ ext/gd/tests/imagecreatefromtga_basic.phpt | 3 +++ ext/gd/tests/imagecreatefromtga_variation.phpt | 3 +++ ext/gd/tests/imagecreatetruecolor_basic.phpt | 3 +++ ext/gd/tests/imagecrop_auto.phpt | 3 +++ ext/gd/tests/imagedashedline_basic.phpt | 3 +++ ext/gd/tests/imageellipse_basic.phpt | 6 ++++++ ext/gd/tests/imagefilledarc_basic.phpt | 3 +++ ext/gd/tests/imagefilledarc_variation1.phpt | 3 +++ ext/gd/tests/imagefilledarc_variation2.phpt | 3 +++ ext/gd/tests/imagefilledellipse_basic.phpt | 6 ++++++ ext/gd/tests/imagefilledpolygon_basic.phpt | 3 +++ ext/gd/tests/imagefilltoborder_basic.phpt | 6 ++++++ ext/gd/tests/imagefilter.phpt | 5 ++++- ext/gd/tests/imagegammacorrect_basic.phpt | 3 +++ ext/gd/tests/imagegammacorrect_variation1.phpt | 3 +++ ext/gd/tests/imagegammacorrect_variation2.phpt | 6 ++++++ ext/gd/tests/imageopenpolygon_basic.phpt | 6 ++++++ ext/gd/tests/imagepolygon_aa.phpt | 6 ++++++ ext/gd/tests/imagepolygon_basic.phpt | 3 +++ ext/gd/tests/imagerectangle_basic.phpt | 6 ++++++ ext/gd/tests/imageresolution_png.phpt | 6 ++++++ ext/gd/tests/imagerotate_overflow.phpt | 6 ------ ext/gd/tests/imagesetbrush_basic.phpt | 6 ++++++ ext/gd/tests/imagesetthickness_basic.phpt | 3 +++ ext/gd/tests/imagestring_basic.phpt | 6 ++++++ ext/gd/tests/imagestringup_basic.phpt | 6 ++++++ ext/gd/tests/imagetruecolortopalette_basic.phpt | 3 +++ ext/gd/tests/libgd00086_extern.phpt | 3 +++ ext/gd/tests/test_image_equals_file_palette.phpt | 6 ++++++ 70 files changed, 308 insertions(+), 13 deletions(-) diff --git a/ext/gd/tests/bug22544-mb.phpt b/ext/gd/tests/bug22544-mb.phpt index b67478e558c47..f99307df1212b 100644 --- a/ext/gd/tests/bug22544-mb.phpt +++ b/ext/gd/tests/bug22544-mb.phpt @@ -2,6 +2,12 @@ Bug #22544 (TrueColor transparency in PNG images). --EXTENSIONS-- gd +--SKIPIF-- + --FILE-- --FILE-- --FILE-- --FILE-- 45) --EXTENSIONS-- gd ---SKIPIF-- - --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- = 2.2.5'); } +if (!(imagetypes() & IMG_PNG)) { + die("skip No PNG support"); +} ?> --FILE-- --FILE-- #testfest PHPSP on 2009-06-20 --EXTENSIONS-- gd +--SKIPIF-- + --FILE-- #testfest PHPSP on 2009-06-20 --EXTENSIONS-- gd +--SKIPIF-- + --FILE-- #testfest PHPSP on 2009-06-20 --EXTENSIONS-- gd +--SKIPIF-- + --FILE-- #testfest PHPSP on 2009-06-20 --EXTENSIONS-- gd +--SKIPIF-- + --FILE-- #testfest PHPSP on 2009-06-20 --EXTENSIONS-- gd +--SKIPIF-- + --FILE-- --FILE-- #testfest PHPSP on 2009-06-20 --EXTENSIONS-- gd +--SKIPIF-- + --FILE-- #testfest PHPSP on 2009-06-20 --EXTENSIONS-- gd +--SKIPIF-- + --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- #testfest PHPSP on 2009-06-20 --EXTENSIONS-- gd +--SKIPIF-- + --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- #testfest PHPSP on 2009-06-30 --EXTENSIONS-- gd +--SKIPIF-- + --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- --FILE-- #testfest PHPSP on 2009-06-30 --EXTENSIONS-- gd +--SKIPIF-- + --FILE-- --FILE-- --FILE-- #testfest PHPSP on 2009-06-20 --EXTENSIONS-- gd +--SKIPIF-- + --FILE-- --FILE-- #testfest PHPSP on 2009-06-20 --EXTENSIONS-- gd +--SKIPIF-- + --FILE-- #testfest PHPSP on 2009-06-20 --EXTENSIONS-- gd +--SKIPIF-- + --FILE-- --FILE-- --FILE-- --FILE-- Date: Sun, 23 Feb 2025 21:04:47 +0100 Subject: [PATCH 17/20] Remove pointless call to zval_ptr_dtor() in sqlite3 (#17906) This is IS_LONG. --- ext/sqlite3/sqlite3.c | 1 - 1 file changed, 1 deletion(-) diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c index 7cf46dfb07c20..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]); From 174a7fe6f95a6f0d2c53e49489272afecc2ca27c Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sun, 23 Feb 2025 22:35:55 -0500 Subject: [PATCH 18/20] Fix GH-17891 gh17373.phpt test issue without freetype support skip if imagefttext() is not available This test calls imagefttext(), which may not be available if libgd was built without freetype support. Closes GH-17910 --- ext/gd/tests/gh17373.phpt | 4 ++++ 1 file changed, 4 insertions(+) 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-- Date: Mon, 24 Feb 2025 14:35:47 +0100 Subject: [PATCH 19/20] Fix GH-17715: Handle preloaded internal function runtime cache (#17835) This solely affects the builtin enum functions currently. Given that these are stored in SHM, we cannot simply hardwire a pointer into the internal function runtime cache on NTS too, but have to use a MAP_PTR (like on ZTS). Now, by design, the runtime cache of internal functions no longer is reset between requests, hence we need to store them explicitly as static runtime cache. On NTS builds we cannot trivially move the pointers into CG(internal_run_time_cache) as they're directly stored on the individual functions (on ZTS we could simply iterate the static map_ptrs). Hence, we have the choice between having opcache managing the internal run_time_cache for its preloaded functions itself or realloc CG(internal_run_time_cache) and iterate through all functions to assign the new address. We choose the latter for simplicity and initial speed. --- NEWS | 4 +- Zend/zend_enum.c | 5 +- Zend/zend_map_ptr.h | 3 + ext/opcache/ZendAccelerator.c | 73 ++++++++++++++++---- ext/opcache/ZendAccelerator.h | 6 +- ext/opcache/tests/preload_enum_observed.phpt | 55 +++++++++++++++ ext/opcache/zend_accelerator_module.c | 2 +- ext/opcache/zend_persist.c | 7 +- 8 files changed, 135 insertions(+), 20 deletions(-) create mode 100644 ext/opcache/tests/preload_enum_observed.phpt diff --git a/NEWS b/NEWS index b8e830ca10ea7..69c6e954b66b5 100644 --- a/NEWS +++ b/NEWS @@ -55,6 +55,8 @@ PHP NEWS . Fixed bug GH-17577 (JIT packed type guard crash). (nielsdos, Dmitry) . Fixed bug GH-17747 (Exception on reading property in register-based FETCH_OBJ_R breaks JIT). (Dmitry, nielsdos) + . Fixed bug GH-17715 (Null pointer deref in observer API when calling + cases() method on preloaded enum). (Bob) - PDO_SQLite: . Fixed GH-17837 ()::getColumnMeta() on unexecuted statement segfaults). @@ -78,7 +80,7 @@ PHP NEWS . Fix memory leak on overflow in _php_stream_scandir(). (nielsdos) - Windows: - . Fixed phpize for Windows 11 (24H2). (bwoebi) + . Fixed phpize for Windows 11 (24H2). (Bob) . Fixed GH-17855 (CURL_STATICLIB flag set even if linked with shared lib). (cmb) diff --git a/Zend/zend_enum.c b/Zend/zend_enum.c index 8259441fd4228..ccafca48fe9b8 100644 --- a/Zend/zend_enum.c +++ b/Zend/zend_enum.c @@ -418,7 +418,10 @@ static void zend_enum_register_func(zend_class_entry *ce, zend_known_string_id n zif->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/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index 364440639b604..6e53b987d6761 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -2614,6 +2614,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) @@ -2629,7 +2630,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; @@ -2961,12 +2962,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 @@ -3407,6 +3411,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; } @@ -3421,6 +3427,8 @@ void accel_shutdown(void) #ifdef ZTS ts_free_id(accel_globals_id); +#else + accel_globals_dtor(&accel_globals); #endif if (!_file_cache_only) { @@ -4318,7 +4326,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; @@ -4353,14 +4361,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; + } } } @@ -4369,7 +4405,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; @@ -4380,6 +4416,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); @@ -4559,7 +4596,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(); @@ -4811,7 +4848,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; } @@ -4839,7 +4876,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(); @@ -4853,6 +4890,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 */ @@ -4861,7 +4904,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 54d55e10e4f5c..486074ef0012b 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" @@ -216,6 +217,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; @@ -251,6 +254,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; @@ -310,7 +314,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 a59502eb0d5fc..ffa09aaf9e679 100644 --- a/ext/opcache/zend_accelerator_module.c +++ b/ext/opcache/zend_accelerator_module.c @@ -572,7 +572,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 c5ddc040b22d8..1c21e031a1958 100644 --- a/ext/opcache/zend_persist.c +++ b/ext/opcache/zend_persist.c @@ -735,7 +735,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); + } } } } @@ -1413,6 +1417,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 From e71b8cae7e68d0f99d71e66c6cdfab9045c6cafa Mon Sep 17 00:00:00 2001 From: Ilija Tovilo Date: Mon, 24 Feb 2025 12:20:34 +0100 Subject: [PATCH 20/20] [skip ci] Use laravel default branch in community build See: https://github.com/laravel/framework/issues/54754#issuecomment-2678092563 According to this comment, the default branch more actively receives changes throuought the year than master. Hence, it makes more sense to test the default branch. --- .github/workflows/nightly.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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