Commit graph

69799 commits

Author SHA1 Message Date
David CARLIER
a5196bf3d6
ext/pdo_pgsql: updating copy from according to pgsql extension workflow. (#18175)
mainly using zend_string instead.
2025-03-28 18:24:45 +00:00
Niels Dossche
b6becada17 Implement packed fast-path for array_map() 2025-03-28 19:09:49 +01:00
Niels Dossche
fca36515b9 Improve performance of array_map()
The refcounting and destruction is not necessary because zend_call_function
will make a copy anyway. And zend_call_function only returns FAILURE if
EG(active) is false in which case array_map shouldn't have been called
in the first place.
2025-03-28 19:09:49 +01:00
David Carlier
18102ec708
Merge branch 'PHP-8.4' 2025-03-28 17:31:50 +00:00
David Carlier
3a5c87f964
Merge branch 'PHP-8.3' into PHP-8.4 2025-03-28 17:31:13 +00:00
David Carlier
a1620048fb
ext/gd: imagecrop rect argument overflow fixes.
```
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
    #2 0x5d6a21018ca4 in zif_imagecrop /home/dcarlier/Contribs/php-src/ext/gd/gd.c:3575
    #3 0x5d6a21e46e7a in ZEND_DO_ICALL_SPEC_RETVAL_USED_HANDLER /home/dcarlier/Contribs/php-src/Zend/zend_vm_execute.h:1337
    #4 0x5d6a221188da in execute_ex /home/dcarlier/Contribs/php-src/Zend/zend_vm_execute.h:57246
    #5 0x5d6a221366bd in zend_execute /home/dcarlier/Contribs/php-src/Zend/zend_vm_execute.h:61634
    #6 0x5d6a21d107a6 in zend_execute_scripts /home/dcarlier/Contribs/php-src/Zend/zend.c:1895
    #7 0x5d6a21a63409 in php_execute_script /home/dcarlier/Contribs/php-src/main/main.c:2529
    #8 0x5d6a22516d5e in do_cli /home/dcarlier/Contribs/php-src/sapi/cli/php_cli.c:966
    #9 0x5d6a2251981d in main /home/dcarlier/Contribs/php-src/sapi/cli/php_cli.c:1341
    #10 0x7f10d002a3b7 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
    #11 0x7f10d002a47a in __libc_start_main_impl ../csu/libc-start.c:360
    #12 0x5d6a20a06da4 in _start (/home/dcarlier/Contribs/php-src/sapi/cli/php+0x2806da4) (BuildId: d9a79c7e0e4872311439d7313cb3a81fe04190a2)
```

close GH-18006
2025-03-28 17:30:25 +00:00
Gina Peter Banyard
6ff9ca12d6 ext/date: Pack php_interval_obj
This reduces the size of the struct from 88 to 80 bytes.
2025-03-28 16:55:37 +00:00
Gina Peter Banyard
77c2fcf147 ext/date: Remove unused parameter 2025-03-28 16:55:37 +00:00
Gina Peter Banyard
8a3dbb0401 ext/date: Change return type of check_id_allowed from int to bool 2025-03-28 16:55:37 +00:00
Gina Peter Banyard
a4685d8b54 ext/date: Add const qualifiers 2025-03-28 16:55:37 +00:00
Gina Peter Banyard
c67e12e718 ext/date: Use Z_PARAM_ARRAY_HT instead of Z_PARAM_ARRAY 2025-03-28 16:55:37 +00:00
Niels Dossche
0943b8b7eb
Improve performance of array_find() etc (#18157)
This avoids destruction logic for the common case, avoids some copy, and
adds an optimization hint.

For this script:
```php
$array = range(1, 10000);

$result = 0;
for ($i = 0; $i < 5000; $i++) {
    $result += array_find($array, static function ($item) {
            return $item === 5000;
    });
}
var_dump($result);
```

On an intel i7 1185G7:
```
Benchmark 1: ./sapi/cli/php x.php
  Time (mean ± σ): 543.7 ms ± 3.8 ms [User: 538.9 ms, System: 4.4 ms]
  Range (min … max): 538.4 ms … 552.9 ms 10 runs

Benchmark 2: ./sapi/cli/php_old x.php
  Time (mean ± σ): 583.0 ms ± 4.2 ms [User: 578.4 ms, System: 3.4 ms]
  Range (min … max): 579.3 ms … 593.9 ms 10 runs

Summary
  ./sapi/cli/php x.php ran
    1.07 ± 0.01 times faster than ./sapi/cli/php_old x.php
```

On an intel i7 4790:
```
Benchmark 1: ./sapi/cli/php x.php
  Time (mean ± σ):     828.6 ms ±   4.8 ms    [User: 824.4 ms, System: 1.6 ms]
  Range (min … max):   822.8 ms … 839.0 ms    10 runs

Benchmark 2: ./sapi/cli/php_old x.php
  Time (mean ± σ):     940.1 ms ±  26.4 ms    [User: 934.4 ms, System: 2.5 ms]
  Range (min … max):   918.0 ms … 981.1 ms    10 runs

Summary
  ./sapi/cli/php x.php ran
    1.13 ± 0.03 times faster than ./sapi/cli/php_old x.php
```
2025-03-27 23:52:54 +01:00
Dmitry Stogov
fd454300b6
Merge branch 'PHP-8.4'
* PHP-8.4:
  Update IR
2025-03-27 22:25:11 +03:00
Dmitry Stogov
2b9840894d
Update IR
IR commit: dd228777b67334d8ed51de44f427d66d4ac99c08
2025-03-27 22:24:46 +03:00
Jakub Zelenka
916528e3f5
Merge branch 'PHP-8.4' 2025-03-27 11:38:17 +01:00
Jakub Zelenka
6cf24cd47c
Merge branch 'PHP-8.3' into PHP-8.4 2025-03-27 11:37:12 +01:00
Jakub Zelenka
2197a490f7
Fix GH-18145: basic_globals_ctor initialization
This resets all basic globals during ctor and just modifies the ones
with a special value. It also switches to using basic_globals_p which
what should be used in this context.

Closes GH-18156
2025-03-27 11:35:55 +01:00
Tim Düsterhus
45d1acf916
Zend: Fix reference counting for Closures in const-expr (#17853)
* Clean up closure static variable handling

* Zend: Fix reference counting for Closures in const-expr

Fixes php/php-src#17851

---------

Co-authored-by: Ilija Tovilo <ilija.tovilo@me.com>
2025-03-27 10:11:44 +01:00
DanielEScherzer
0006522211
Reflection: optimize smart_str building
- When appending a single character to the string, use `smart_str_appendc()`
- When appending a C-string without printf use, use `smart_str_appends()`
- When appending just a `zend_string`, use `smart_str_append()`
2025-03-26 16:00:34 -07:00
Ilija Tovilo
99f72fa499
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix infinite recursion on deprecated attribute evaluation
2025-03-26 23:40:58 +01:00
Ilija Tovilo
272f7f75e2
Fix infinite recursion on deprecated attribute evaluation
Fixes GH-17711
Fixes GH-18022
Closes GH-17712
2025-03-26 23:39:38 +01:00
Daniel Scherzer
4233394e8f ReflectionClass: show enums differently from classes
While internally enums are mostly the same as classes, their output in
`ReflectionClass::__toString()` should show the enum as the developer wrote it,
rather than as the engine stored it. Accordingly

- Say that the enum is an enum, not a final class

- Include the backing type, if any, in the declaration line

- List enum cases separately from constants, and show the underlying values, if
any

GH-15766
2025-03-26 13:45:25 -07:00
Daniel Scherzer
6c81f708c5 ReflectionClass: test enum output
In preparation for improving it, GH-15766
2025-03-26 13:45:25 -07:00
David Carlier
50bffd3284
Merge branch 'PHP-8.4' 2025-03-26 17:46:38 +00:00
David Carlier
9c6fe6b0ff
Fix GH-18148: pg_copy_from() wrong \n offset check.
Close GH-18149
2025-03-26 17:44:01 +00:00
Saki Takamachi
1ce79eb219
ext/bcmath: In the arm processor environment, NEON is used to use SIMD. (#18130) 2025-03-26 07:48:02 +09:00
Gina Peter Banyard
e1845365ea ext/enchant: Remove useless char* casts 2025-03-25 06:59:57 +00:00
Gina Peter Banyard
1fa11f17ff
ext/dba: Add const modifier for argument to php_dba_make_key() 2025-03-25 04:01:40 +00:00
Gina Peter Banyard
fec4f7f389 ext/standard/file: clarify fclose() warning 2025-03-24 22:54:34 +00:00
Gina Peter Banyard
556e4d9008 streams: Indicate which argument fails the stream ZPP check 2025-03-24 22:54:34 +00:00
Tim Düsterhus
8779e2a603 Add (void) cast
RFC: https://wiki.php.net/rfc/marking_return_value_as_important
2025-03-24 19:35:30 +01:00
Derick Rethans
2d30c2e1ad
Updated to version 2025.2 (2025b) 2025-03-24 10:06:36 +00:00
Derick Rethans
22b2a579ba
Updated to version 2025.2 (2025b) 2025-03-24 10:06:34 +00:00
Derick Rethans
0c8a7a77a8
Updated to version 2025.2 (2025b) 2025-03-24 10:06:32 +00:00
Gina Peter Banyard
345d229385
ext/dba: Reduce scope of dba_handler variables 2025-03-23 20:39:34 +00:00
Ilija Tovilo
076811af68
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix segfault when evaluating const expr default value of child prop with added hooks
2025-03-23 16:35:21 +01:00
Ilija Tovilo
d5bdf8f508
Fix segfault when evaluating const expr default value of child prop with added hooks
Introduced by GH-17870. Not adding a NEWS entry since this is fixed in
the same version.

Fixes oss-fuzz #403816122
Closes GH-18098
2025-03-23 16:35:04 +01:00
Peter Kokot
8622362394
Remove unused strcasecmp definition (#17050)
The strcasecmp usage was removed via
dc5f3b9562.
2025-03-21 18:30:22 +01:00
Niels Dossche
19a8e69476
Merge branch 'PHP-8.4'
* PHP-8.4:
  [ci skip] Make sure opcache can output in these tests
2025-03-21 16:36:02 +01:00
Niels Dossche
7d1a2d03e4
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [ci skip] Make sure opcache can output in these tests
2025-03-21 16:35:57 +01:00
Niels Dossche
071f707a6d
[ci skip] Make sure opcache can output in these tests 2025-03-21 16:35:47 +01:00
Niels Dossche
8d7cdbf427
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix intl tests for icu 77 (#18125)
2025-03-21 14:25:23 +01:00
Niels Dossche
fe7f9571d2
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix intl tests for icu 77 (#18125)
2025-03-21 14:25:18 +01:00
Niels Dossche
8823f89a32
Fix intl tests for icu 77 (#18125) 2025-03-21 14:23:03 +01:00
Gina Peter Banyard
484d528b40
ext/standard: Use usual not empty error for proc_open() (#18083) 2025-03-21 13:13:25 +00:00
Niels Dossche
bb265d2700
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-18107: Opcache CFG jmp optimization with try-finally breaks the exception table
2025-03-21 13:58:54 +01:00
Niels Dossche
d765b60778
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-18107: Opcache CFG jmp optimization with try-finally breaks the exception table
2025-03-21 13:57:16 +01:00
Niels Dossche
2ec8d37eb4
Fix GH-18107: Opcache CFG jmp optimization with try-finally breaks the exception table
If there's a try-finally where the try_op starts on a basic block with a
single JMP, and the JMP optimization causes that basic block to become
unreachable, then we update try_op.
In this case, there is no catch_op, so try_op is erroneously set to 0,
we should instead set it to `b->start`.

Closes GH-18110.
2025-03-21 13:56:31 +01:00
Remi Collet
b17df7a07c
Merge branch 'PHP-8.4'
* PHP-8.4:
  NEWS for #66049
  NEWS for #66049
  Fix #66049 Typemap can break parsing in parse_packet_soap leading to a segfault
2025-03-21 08:26:04 +01:00
Remi Collet
1c230c27ec
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  NEWS for #66049
  Fix #66049 Typemap can break parsing in parse_packet_soap leading to a segfault
2025-03-21 08:25:23 +01:00