diff --git a/.github/scripts/download-bundled/.gitignore b/.github/scripts/download-bundled/.gitignore new file mode 100644 index 000000000000..69f1bf453095 --- /dev/null +++ b/.github/scripts/download-bundled/.gitignore @@ -0,0 +1 @@ +!*.patch diff --git a/.github/scripts/download-bundled/boost-context.sh b/.github/scripts/download-bundled/boost-context.sh new file mode 100755 index 000000000000..b1fd8708b85b --- /dev/null +++ b/.github/scripts/download-bundled/boost-context.sh @@ -0,0 +1,41 @@ +#!/bin/sh +set -ex +cd "$(dirname "$0")/../../.." + +tmp_dir=/tmp/php-src-download-bundled/boost-context +rm -rf "$tmp_dir" + +revision=refs/tags/boost-1.86.0 + +git clone --depth 1 --revision="$revision" https://github.com/boostorg/context.git "$tmp_dir" + +rm -rf Zend/asm +cp -R "$tmp_dir"/src/asm Zend/asm + +cd Zend/asm + +# remove unneeded files +rm jump_arm_aapcs_pe_armasm.asm +rm jump_i386_ms_pe_clang_gas.S +rm jump_i386_ms_pe_gas.asm +rm jump_i386_x86_64_sysv_macho_gas.S +rm jump_ppc32_ppc64_sysv_macho_gas.S +rm jump_x86_64_ms_pe_clang_gas.S +rm make_arm_aapcs_pe_armasm.asm +rm make_i386_ms_pe_clang_gas.S +rm make_i386_ms_pe_gas.asm +rm make_i386_x86_64_sysv_macho_gas.S +rm make_ppc32_ppc64_sysv_macho_gas.S +rm make_x86_64_ms_pe_clang_gas.S +rm ontop_*.S +rm ontop_*.asm +rm tail_ontop_ppc32_sysv.cpp + +# move renamed files +# GH-13896 introduced these 2 files named as .S but since https://github.com/boostorg/context/pull/265 they are named as .asm +mv jump_x86_64_ms_pe_gas.asm jump_x86_64_ms_pe_gas.S +mv make_x86_64_ms_pe_gas.asm make_x86_64_ms_pe_gas.S + +# add extra files +git restore LICENSE +git restore save_xmm_x86_64_ms_masm.asm # added in GH-18352, not an upstream boost.context file diff --git a/.github/scripts/download-bundled/pcre2.sh b/.github/scripts/download-bundled/pcre2.sh index b43554206c92..360cbb91db82 100755 --- a/.github/scripts/download-bundled/pcre2.sh +++ b/.github/scripts/download-bundled/pcre2.sh @@ -2,12 +2,15 @@ set -ex cd "$(dirname "$0")/../../.." +tmp_dir=/tmp/php-src-download-bundled/pcre2 +rm -rf "$tmp_dir" + revision=refs/tags/pcre2-10.44 -git clone --depth 1 --recurse-submodules --revision="$revision" https://github.com/PCRE2Project/pcre2.git /tmp/php-src-bundled/pcre2 +git clone --depth 1 --recurse-submodules --revision="$revision" https://github.com/PCRE2Project/pcre2.git "$tmp_dir" rm -rf ext/pcre/pcre2lib -cp -R /tmp/php-src-bundled/pcre2/src ext/pcre/pcre2lib +cp -R "$tmp_dir"/src ext/pcre/pcre2lib cd ext/pcre/pcre2lib diff --git a/.github/scripts/download-bundled/uriparser.config.patch b/.github/scripts/download-bundled/uriparser.config.patch new file mode 100644 index 000000000000..9742154e5d7c --- /dev/null +++ b/.github/scripts/download-bundled/uriparser.config.patch @@ -0,0 +1,14 @@ +diff --git a/ext/uri/uriparser/src/UriConfig.h b/ext/uri/uriparser/src/UriConfig.h +index b9a85a8..ab78b96 100644 +--- a/ext/uri/uriparser/src/UriConfig.h ++++ b/ext/uri/uriparser/src/UriConfig.h +@@ -41,7 +41,9 @@ + + # define PACKAGE_VERSION "@PROJECT_VERSION@" + ++/* + #cmakedefine HAVE_WPRINTF + #cmakedefine HAVE_REALLOCARRAY ++*/ + + #endif /* !defined(URI_CONFIG_H) */ diff --git a/.github/scripts/download-bundled/uriparser.sh b/.github/scripts/download-bundled/uriparser.sh new file mode 100755 index 000000000000..8820a67333f0 --- /dev/null +++ b/.github/scripts/download-bundled/uriparser.sh @@ -0,0 +1,24 @@ +#!/bin/sh +set -ex +cd "$(dirname "$0")/../../.." + +tmp_dir=/tmp/php-src-download-bundled/uriparser +rm -rf "$tmp_dir" + +revision=refs/tags/uriparser-1.0.0 + +git clone --depth 1 --revision="$revision" https://github.com/uriparser/uriparser.git "$tmp_dir" + +rm -rf ext/uri/uriparser +mkdir ext/uri/uriparser +cp -R "$tmp_dir"/src ext/uri/uriparser +cp -R "$tmp_dir"/include ext/uri/uriparser +cp "$tmp_dir"/COPYING.BSD-3-Clause ext/uri/uriparser + +cd ext/uri/uriparser + +# move renamed files +mv src/UriConfig.h.in src/UriConfig.h + +# patch customized files +git apply -v ../../../.github/scripts/download-bundled/uriparser.config.patch diff --git a/.github/scripts/test-directory-unchanged.sh b/.github/scripts/test-directory-unchanged.sh index 0ce7fd4cc4af..20ca410e4ec9 100755 --- a/.github/scripts/test-directory-unchanged.sh +++ b/.github/scripts/test-directory-unchanged.sh @@ -1,13 +1,16 @@ #!/bin/sh set -ex -cd "$(dirname "$0")/../../$1" +# use the repo root directory as "--git-dir" +cd "$(dirname "$0")/../.." + +dir="$1" # notify git about untracked (except ignored) files -git add -N . +git add -N "$dir" # display overview of changed files -git status . +git status "$dir" # display diff of working directory vs HEAD commit and set exit code -git diff -a --exit-code HEAD . +git diff -a --exit-code HEAD "$dir" diff --git a/.github/workflows/verify-bundled-files.yml b/.github/workflows/verify-bundled-files.yml index 291cd6adaa3d..473d6e2d8f4d 100644 --- a/.github/workflows/verify-bundled-files.yml +++ b/.github/workflows/verify-bundled-files.yml @@ -3,8 +3,10 @@ name: Verify Bundled Files on: push: paths: &paths - - '.github/scripts/download-bundled/pcre2.sh' + - '.github/scripts/download-bundled/**' + - 'Zend/asm/**' - 'ext/pcre/pcre2lib/**' + - 'ext/uri/uriparser/**' pull_request: paths: *paths schedule: @@ -24,15 +26,30 @@ jobs: uses: actions/checkout@v6 - name: Detect changed files + if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' }} uses: dorny/paths-filter@v3 id: changes with: - base: master filters: | + 'boost-context': + - '.github/scripts/download-bundled/boost-context.*' + - 'Zend/asm/**' pcre2: - - '.github/scripts/download-bundled/pcre2.sh' + - '.github/scripts/download-bundled/pcre2.*' - 'ext/pcre/pcre2lib/**' + uriparser: + - '.github/scripts/download-bundled/uriparser.*' + - 'ext/uri/uriparser/**' + - name: 'boost.context' + if: ${{ !cancelled() && (steps.changes.outputs.boost-context == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') }} + run: | + echo "::group::Download" + .github/scripts/download-bundled/boost-context.sh + echo "::endgroup::" + echo "::group::Verify files" + .github/scripts/test-directory-unchanged.sh Zend/asm + echo "::endgroup::" - name: PCRE2 if: ${{ !cancelled() && (steps.changes.outputs.pcre2 == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') }} run: | @@ -42,3 +59,12 @@ jobs: echo "::group::Verify files" .github/scripts/test-directory-unchanged.sh ext/pcre/pcre2lib echo "::endgroup::" + - name: uriparser + if: ${{ !cancelled() && (steps.changes.outputs.uriparser == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') }} + run: | + echo "::group::Download" + .github/scripts/download-bundled/uriparser.sh + echo "::endgroup::" + echo "::group::Verify files" + .github/scripts/test-directory-unchanged.sh ext/uri/uriparser + echo "::endgroup::" diff --git a/UPGRADING.INTERNALS b/UPGRADING.INTERNALS index 83ef90e55587..06c1d5282622 100644 --- a/UPGRADING.INTERNALS +++ b/UPGRADING.INTERNALS @@ -70,6 +70,8 @@ PHP 8.6 INTERNALS UPGRADE NOTES performed on the result. . The zend_dval_to_lval_cap() function no longer takes a second zend_string* parameter. + . EG(in_autoload) was renamed to EG(autoload_current_classnames) and no + longer is a pointer, but a directly embedded HashTable struct. ======================== 2. Build system changes diff --git a/Zend/zend.c b/Zend/zend.c index 49e18f1a777c..bce1faede8fb 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -811,7 +811,6 @@ static void executor_globals_ctor(zend_executor_globals *executor_globals) /* {{ executor_globals->user_error_handler_error_reporting = 0; ZVAL_UNDEF(&executor_globals->user_error_handler); ZVAL_UNDEF(&executor_globals->user_exception_handler); - executor_globals->in_autoload = NULL; executor_globals->current_execute_data = NULL; executor_globals->current_module = NULL; executor_globals->exit_status = 0; diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index f9309be99f0e..dbd2a9039cfc 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -145,7 +145,6 @@ void init_executor(void) /* {{{ */ EG(function_table) = CG(function_table); EG(class_table) = CG(class_table); - EG(in_autoload) = NULL; EG(error_handling) = EH_NORMAL; EG(flags) = EG_FLAGS_INITIAL; @@ -156,6 +155,7 @@ void init_executor(void) /* {{{ */ zend_llist_apply(&zend_extensions, (llist_apply_func_t) zend_extension_activator); zend_hash_init(&EG(included_files), 8, NULL, NULL, 0); + zend_hash_init(&EG(autoload_current_classnames), 8, NULL, NULL, 0); EG(ticks_count) = 0; @@ -503,16 +503,13 @@ void shutdown_executor(void) /* {{{ */ } zend_hash_destroy(&EG(included_files)); + zend_hash_destroy(&EG(autoload_current_classnames)); zend_stack_destroy(&EG(user_error_handlers_error_reporting)); zend_stack_destroy(&EG(user_error_handlers)); zend_stack_destroy(&EG(user_exception_handlers)); zend_lazy_objects_destroy(&EG(lazy_objects_store)); zend_objects_store_destroy(&EG(objects_store)); - if (EG(in_autoload)) { - zend_hash_destroy(EG(in_autoload)); - FREE_HASHTABLE(EG(in_autoload)); - } if (EG(ht_iterators) != EG(ht_iterators_slots)) { efree(EG(ht_iterators)); @@ -1245,12 +1242,7 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, zend_string * return NULL; } - if (EG(in_autoload) == NULL) { - ALLOC_HASHTABLE(EG(in_autoload)); - zend_hash_init(EG(in_autoload), 8, NULL, NULL, 0); - } - - if (zend_hash_add_empty_element(EG(in_autoload), lc_name) == NULL) { + if (zend_hash_add_empty_element(&EG(autoload_current_classnames), lc_name) == NULL) { if (!key) { zend_string_release_ex(lc_name, 0); } @@ -1272,7 +1264,7 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, zend_string * EG(lineno_override) = previous_lineno; zend_string_release_ex(autoload_name, 0); - zend_hash_del(EG(in_autoload), lc_name); + zend_hash_del(&EG(autoload_current_classnames), lc_name); if (!key) { zend_string_release_ex(lc_name, 0); diff --git a/Zend/zend_globals.h b/Zend/zend_globals.h index f09b81acb315..31f54cd8284b 100644 --- a/Zend/zend_globals.h +++ b/Zend/zend_globals.h @@ -220,7 +220,7 @@ struct _zend_executor_globals { zend_atomic_bool vm_interrupt; zend_atomic_bool timed_out; - HashTable *in_autoload; + HashTable autoload_current_classnames; zend_long hard_timeout; void *stack_base; diff --git a/ext/uri/uriparser/src/UriConfig.h b/ext/uri/uriparser/src/UriConfig.h index e265c0a9a115..ab78b96cd808 100644 --- a/ext/uri/uriparser/src/UriConfig.h +++ b/ext/uri/uriparser/src/UriConfig.h @@ -42,8 +42,8 @@ # define PACKAGE_VERSION "@PROJECT_VERSION@" /* -#define HAVE_WPRINTF -#define HAVE_REALLOCARRAY +#cmakedefine HAVE_WPRINTF +#cmakedefine HAVE_REALLOCARRAY */ #endif /* !defined(URI_CONFIG_H) */ diff --git a/ext/uri/uriparser/src/UriConfig.h.in b/ext/uri/uriparser/src/UriConfig.h.in deleted file mode 100644 index b9a85a8fe02a..000000000000 --- a/ext/uri/uriparser/src/UriConfig.h.in +++ /dev/null @@ -1,47 +0,0 @@ -/* - * uriparser - RFC 3986 URI parsing library - * - * Copyright (C) 2018, Sebastian Pipping - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above - * copyright notice, this list of conditions and the following - * disclaimer. - * - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * 3. Neither the name of the copyright holder nor the names of - * its contributors may be used to endorse or promote products - * derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#if !defined(URI_CONFIG_H) -# define URI_CONFIG_H 1 - -# define PACKAGE_VERSION "@PROJECT_VERSION@" - -#cmakedefine HAVE_WPRINTF -#cmakedefine HAVE_REALLOCARRAY - -#endif /* !defined(URI_CONFIG_H) */