forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Const variables #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
joshuaruesweg
wants to merge
10,000
commits into
master
Choose a base branch
from
const_variables
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If the array is packed, then we don't have to loop to get the highest index. For this script: ```php $array = range(1, 100); for ($i=0;$i<1000000;$i++) { SplFixedArray::fromArray($array); } ``` On an i7-4790: ``` Benchmark 1: ./sapi/cli/php spl.php Time (mean ± σ): 376.5 ms ± 2.0 ms [User: 372.1 ms, System: 2.6 ms] Range (min … max): 373.7 ms … 379.5 ms 10 runs Benchmark 2: ./sapi/cli/php_old spl.php Time (mean ± σ): 511.6 ms ± 1.9 ms [User: 508.0 ms, System: 2.3 ms] Range (min … max): 509.2 ms … 515.1 ms 10 runs Summary ./sapi/cli/php spl.php ran 1.36 ± 0.01 times faster than ./sapi/cli/php_old spl.php ``` On an i7-1185G7: ``` Benchmark 1: ./sapi/cli/php spl.php Time (mean ± σ): 250.4 ms ± 3.5 ms [User: 246.6 ms, System: 2.6 ms] Range (min … max): 247.0 ms … 258.5 ms 11 runs Benchmark 2: ./sapi/cli/php_old spl.php Time (mean ± σ): 328.4 ms ± 1.0 ms [User: 324.4 ms, System: 3.8 ms] Range (min … max): 327.5 ms … 331.0 ms 10 runs Summary ./sapi/cli/php spl.php ran 1.31 ± 0.02 times faster than ./sapi/cli/php_old spl.php ``` Bonus: this also decreases the code size of the function.
From ext/standard/file.h to main/streams/php_stream_context.h This reduces some dependency of main/ on ext/standard
…al without errors This is intended to replace the few manual usages of zend_fetch_resource2_ex() to fetch a php_stream from a zval. This will simplify the conversion from resource to object for streams when this actually happens.
returns the ongoing name of the service, if there is. available since postgres 18 close phpGH-18198
Debugging memory corruption issues in production can be difficult when it's not possible to use a debug build or ASAN/MSAN/Valgrind (e.g. for performance reasons). This change makes it possible to enable some basic heap debugging helpers without rebuilding PHP. This is controlled by the environment variable ZEND_MM_DEBUG. The env var takes a comma-separated list of parameters: - poison_free=byte: Override freed blocks with the specified byte value (represented as a number) - poison_alloc=byte: Override newly allocated blocks with the specified byte value (represented as a number) - padding=bytes: Pad allocated blocks with the specified amount of bytes (if non-zero, a value >= 16 is recommended to not break alignments) - check_freelists_on_shutdown=0|1: Enable checking freelist consistency [1] on shutdown Example: ZEND_MM_DEBUG=poison_free=0xbe,poison_alloc=0xeb,padding=16,check_freelists_on_shutdown=1 php ... This is implemented by installing custom handlers when ZEND_MM_DEBUG is set. This has zero overhead when ZEND_MM_DEBUG is not set. When ZEND_MM_DEBUG is set, the overhead is about 8.5% on the Symfony Demo benchmark. Goals: - Crash earlier after a memory corruption, to extract a useful backtrace - Be usable in production with reasonable overhead - Having zero overhead when not enabled Non-goals: - Replace debug builds, valgrind, ASAN, MSAN or other sanitizers [1] php#14054 Co-authored-by: Tim Düsterhus <[email protected]>
This is more efficient than manually dealing with a garbage copy.
After the loop, `parent` will for sure be ce_SplFixedArray, and inherited will be true; for inherited cases.
This option is semi-deprecated [1] and shouldn't influence much anyway. The anticipated BC break is low. [1] PCRE2Project/pcre2#736 (comment) [2] PCRE2Project/pcre2#736 (comment) Closes phpGH-18150.
* PHP-8.4: Address deprecated PHP 8.4 session options to prevent test failures
Static __invoke() is disallowed since PHP 8.0. Closes phpGH-18171
* PHP-8.3: Add missing EXTENSIONS section to intl test
* PHP-8.4: Add missing EXTENSIONS section to intl test
* PHP-8.3: Use-after-free in extract() with EXTR_REFS
* PHP-8.4: Use-after-free in extract() with EXTR_REFS
The test doesn't test what it says it does. And depending on what it is actually trying to test, it is redundant with either Zend/tests/traits/error_009.phpt, Zend/tests/traits/error_010.phpt or Zend/tests/traits/language015.phpt.
This more accurately matches the "copy & paste" semantics described in the documentation. Abstract trait methods diverge from this behavior, given that a parent method can satisfy trait methods used in the child. In that case, the method is not copied, but the check is performed after the parent has been bound. Fixes phpGH-15753 Fixes phpGH-16198 Close phpGH-15878
This function is a noop and always returns `true`.
…p#18397) This also removes an accidentally committed file.
* PHP-8.3: fileinfo: Fix cleanup in ext/fileinfo/tests/cve-2014-1943-mb.phpt (php#18397)
* PHP-8.4: fileinfo: Fix cleanup in ext/fileinfo/tests/cve-2014-1943-mb.phpt (php#18397)
* PHP-8.3: [skip ci] NEWS for php#18317
* PHP-8.4: [skip ci] NEWS for php#18317
It looks like it's no longer supported. We don't test tidy on FreeBSD anyway.
* PHP-8.1: backporting C++17 detection support for recent icu4c releases. Drop tidyp from FreeBSD build
* PHP-8.2: backporting C++17 detection support for recent icu4c releases. Drop tidyp from FreeBSD build
* PHP-8.3: backporting C++17 detection support for recent icu4c releases. Drop tidyp from FreeBSD build
* PHP-8.4: backporting C++17 detection support for recent icu4c releases. Drop tidyp from FreeBSD build
* PHP-8.4: [skip ci] NEWS for php#18317
* fileinfo: Remove `php_fileinfo` struct This is just a needless layer of indirection and requires an additional allocation. * fileinfo: Remove options field from `finfo_object` This was only required to restore the original options when options are given for `finfo_file()` or `finfo_buffer()`. This can more reliably be achieved using `magic_getflags()` and is therefore redundant. * fileinfo: Preserve error for uninitialized `finfo` objects
This makes the output in PHPInfo a little more readable.
DOM HTML serializer will be closer compliant to HTML5 in the next libxml2 version, so the tests need to be adapted. Ref: https://gitlab.gnome.org/GNOME/libxml2/-/merge_requests/309 Closes phpGH-18406.
* PHP-8.3: Fix DOM tests for upcoming libxml2 serializer changes
* PHP-8.4: Fix DOM tests for upcoming libxml2 serializer changes
This function is a noop and will be proposed for deprecation. This patch removes the useless calls.
joshuaruesweg
pushed a commit
that referenced
this pull request
Sep 10, 2025
``` ext/gd/libgd/gd.c:2275:14: runtime error: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int' #0 0x5d6a2103e1db in php_gd_gdImageCopy /home/dcarlier/Contribs/php-src/ext/gd/libgd/gd.c:2275 #1 0x5d6a210a2b63 in gdImageCrop /home/dcarlier/Contribs/php-src/ext/gd/libgd/gd_crop.c:57 php#2 0x5d6a21018ca4 in zif_imagecrop /home/dcarlier/Contribs/php-src/ext/gd/gd.c:3575 php#3 0x5d6a21e46e7a in ZEND_DO_ICALL_SPEC_RETVAL_USED_HANDLER /home/dcarlier/Contribs/php-src/Zend/zend_vm_execute.h:1337 php#4 0x5d6a221188da in execute_ex /home/dcarlier/Contribs/php-src/Zend/zend_vm_execute.h:57246 php#5 0x5d6a221366bd in zend_execute /home/dcarlier/Contribs/php-src/Zend/zend_vm_execute.h:61634 php#6 0x5d6a21d107a6 in zend_execute_scripts /home/dcarlier/Contribs/php-src/Zend/zend.c:1895 php#7 0x5d6a21a63409 in php_execute_script /home/dcarlier/Contribs/php-src/main/main.c:2529 php#8 0x5d6a22516d5e in do_cli /home/dcarlier/Contribs/php-src/sapi/cli/php_cli.c:966 php#9 0x5d6a2251981d in main /home/dcarlier/Contribs/php-src/sapi/cli/php_cli.c:1341 php#10 0x7f10d002a3b7 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 php#11 0x7f10d002a47a in __libc_start_main_impl ../csu/libc-start.c:360 php#12 0x5d6a20a06da4 in _start (/home/dcarlier/Contribs/php-src/sapi/cli/php+0x2806da4) (BuildId: d9a79c7e0e4872311439d7313cb3a81fe04190a2) ``` close phpGH-18006
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.