Commit graph

15131 commits

Author SHA1 Message Date
Niels Dossche
1bba07ecc0
partitioned option for setcookie/setrawcookie and sessions
RFC: https://wiki.php.net/rfc/CHIPS

Closes GH-12646.
Closes GH-12652.
2025-08-15 08:41:24 +02:00
Gina Peter Banyard
cab46b27b9
ext/standard: Deprecate passing integers outside the interval [0, 255] to chr() (#19441)
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_passing_integers_outside_the_interval_0_255_to_chr
2025-08-14 20:48:48 +01:00
Gina Peter Banyard
fb87b14b6c
ext/spl: Deprecate ArrayObject and ArrayIterator with objects (#19420)
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_arrayobject_and_arrayiterator_with_objects

This also moves tests into a subfolder.
2025-08-14 12:38:57 +01:00
Ilija Tovilo
fd8dfe1bfd
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16649: Avoid UAF when using array_splice
2025-08-13 14:16:50 +02:00
Ilija Tovilo
7e01cf59bb
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16649: Avoid UAF when using array_splice
2025-08-13 14:16:12 +02:00
Alexandre Daubois
c8774f9e61
Fix GH-16649: Avoid UAF when using array_splice
Closes GH-19399
2025-08-13 14:15:34 +02:00
Niels Dossche
841f0b1515
Remove dead error checks for php_stream_filter_alloc() (#19194)
php_stream_filter_alloc() can't fail, so simplify the code.
2025-08-12 22:18:39 +02:00
Daniel Scherzer
a68f3d6374
[RFC] Deprecate imagedestroy() (#19454)
https://wiki.php.net/rfc/deprecations_php_8_5
2025-08-12 05:50:09 -07:00
Alexandre Daubois
dfa1307a64
Various return types and values consolidation (#19418) 2025-08-12 11:28:41 +01:00
Tim Düsterhus
3d9d68e1ca
zend_compile: Deprecate backticks as an alias for shell_exec() (#19443)
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_backticks_as_an_alias_for_shell_exec
2025-08-12 12:02:13 +02:00
Gina Peter Banyard
dc0962c243
ext/standard: Deprecate passing null to readdir(), rewinddir(), and closedir() (#19423)
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_passing_null_to_readdir_rewinddir_and_closedir
2025-08-09 18:08:21 +01:00
Tim Düsterhus
21625006e5
standard: Deprecate socket_set_timeout() (#19285)
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#formally_deprecate_socket_set_timeout
2025-08-08 21:23:48 +01:00
Gina Peter Banyard
c5143c0b22
tree: remove some usages of the report_memleaks INI setting (#19407) 2025-08-07 22:17:24 +01:00
Gina Peter Banyard
1e0c8baf05
tree: drop non canonical casts and ZPP tests 2025-08-06 13:20:28 +01:00
Gina Peter Banyard
d9000b3094
tree: replace some unnecessary uses of spprintf (#19354) 2025-08-05 17:25:47 +01:00
Gina Peter Banyard
fa85b38560 streams: voidify php_stream_filter_prepend_ex()
This only ever returned SUCCESS
2025-08-04 15:30:57 +01:00
Gina Peter Banyard
cd13ba73e2 streams: use RETURN_BOOL() when possible 2025-08-04 15:30:57 +01:00
Gina Peter Banyard
b46c5e6186 streams: refactor implementation of stream_select() 2025-08-04 15:30:57 +01:00
Gina Peter Banyard
c50a715a5c streams: remove useless casts 2025-08-04 15:30:57 +01:00
Gina Peter Banyard
0d0f774a6a streams: use call in if statement directly 2025-08-04 15:30:57 +01:00
Gina Peter Banyard
b3551cc31f streams: use type bool instead of type int 2025-08-04 15:30:57 +01:00
Gina Peter Banyard
b35dbe474e streams: reduce scope of variables 2025-08-04 15:30:57 +01:00
Gina Peter Banyard
17b8706bf6 streams: add const specifier 2025-08-04 15:30:57 +01:00
Gina Peter Banyard
105c1e9896
tree: use zend_str_has_nul_byte() API (#19336) 2025-07-31 23:57:27 +01:00
Gina Peter Banyard
65b9cf1db3
ext/standard/proc_open.c: Minor refactorings (#18085)
Add const modifier
Use unsigned types when the source type is unsigned
Use HashTable instead of zvals where possible
2025-07-31 23:02:35 +01:00
Niels Dossche
cee8ed235a
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-19300: Nested array_multisort invocation with error breaks
2025-07-31 19:01:28 +02:00
Niels Dossche
b82c8ba7fe
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-19300: Nested array_multisort invocation with error breaks
2025-07-31 19:01:13 +02:00
Niels Dossche
a96b05e63f
Fix GH-19300: Nested array_multisort invocation with error breaks
There are 2 issues:
1. When a MULTISORT_ABORT happens, it frees func, but func may point to
   ARRAYG(multisort_func), which would be a problem with nested
   invocations as it can destroy that of the "parent" invocation.
   To solve this, delay assigning to the globals.
2. The old globals were not restored which means that nested invocations
   with different flags will cause a wrong sorting function to be used.

Closes GH-19319.
2025-07-31 19:00:45 +02:00
Daniel Scherzer
9999d66bce
ext/standard/tests/file/bug81145.phpt: unlink file before exit (#19293)
If the test is skipped, the `--SKIPIF--` section exits (via `die()`) without
removing the "bug81145_src.bin" file that gets created, and because the test
was skipped the `--CLEAN--` section is not run, leaving the .bin file behind.

Adjust the `--SKIPIF--` section to remove the .bin file before exiting.
2025-07-30 13:14:10 -07:00
Daniel Scherzer
61415942c2
ext/standard: drop old smart_string headers (#19233)
Functionality was removed in PHP 7.2
2025-07-29 07:57:19 -07:00
Dmitrii Derepko
5947fedbbd
ext/standard: handle html entities empty string before processing (#19220) 2025-07-28 12:15:26 +02:00
Daniel Scherzer
ff810d5e36
Arginfo: reuse zend_string objects for initializing attribute values (#19241)
Avoid initializing the same string content multiple times and make use of the
fact that the strings created to initialize attribute values are not freed by
simply making use of an existing zend_string with the same content if one is
available.
2025-07-27 17:27:22 -07:00
Niels Dossche
93b9808004
Merge branch 'PHP-8.4'
* PHP-8.4:
  NEWS for hrtime in FTP and standard
  Handle broken hrtime in ftp
  Fix arginfo/zpp violation if zend_hrtime is not available
2025-07-25 12:05:17 +02:00
Niels Dossche
802e348b49
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  NEWS for hrtime in FTP and standard
  Handle broken hrtime in ftp
  Fix arginfo/zpp violation if zend_hrtime is not available
2025-07-25 12:05:12 +02:00
Niels Dossche
ad2143f3b0
Fix arginfo/zpp violation if zend_hrtime is not available
Part of GH-19210.

Closes GH-19218.
2025-07-25 11:56:17 +02:00
Ilija Tovilo
5b05d429f2
Merge branch 'PHP-8.4'
* PHP-8.4:
  Leak in failed unserialize() with opcache
2025-07-22 15:44:24 +02:00
Ilija Tovilo
f0baf3dc11
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Leak in failed unserialize() with opcache
2025-07-22 15:44:16 +02:00
Ilija Tovilo
5d1636e40b
Leak in failed unserialize() with opcache
With opcache, zend_string_init_interned() will allocate non-interned strings at
runtime because shm is locked. Hence, we need to make sure to actually free this
string.

Fixes OSS-Fuzz #433303828
Closes GH-19211
2025-07-22 15:43:31 +02:00
Niels Dossche
113eb203b0
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix test conflict between chmod_variation2 and file_variation5
2025-07-21 23:57:55 +02:00
Niels Dossche
e572e899bd
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix test conflict between chmod_variation2 and file_variation5
2025-07-21 23:57:49 +02:00
Niels Dossche
7ab37e81e0
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix test conflict between chmod_variation2 and file_variation5
2025-07-21 23:57:42 +02:00
Niels Dossche
27f24bd9bc
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix test conflict between chmod_variation2 and file_variation5
2025-07-21 23:57:34 +02:00
Niels Dossche
605ee05491
Fix test conflict between chmod_variation2 and file_variation5
Both used "somelink".
See 4642146137

Closes GH-19208.
2025-07-21 23:57:21 +02:00
Niels Dossche
1b169bf28e Allocate array eagerly in array_chunk
By preallocating it as a packed array, we save the initial
initialization overhead.
Gives a few extra percentage points improvement.
2025-07-21 22:59:55 +02:00
Niels Dossche
4762d46427 Avoid modulo operation in loop in array_chunk
For this benchmark:
```php
$length = 25;
for ($i=0;$i<1000;$i++)
  array_chunk(range(0, 10000), $length);
```

On an i7-4790, length=25 speeds up by 1.8x and length=1 by 1.27x.
On an i7-1185G7, length=25 speeds up by 1.08x and length=1 by 1.02x.
2025-07-21 22:59:55 +02:00
DanielEScherzer
1eadf553f1
Arginfo: avoid using temporary zvals for initializing attribute values (#19141)
Instead of
* adding a zval on the stack
* initializing it
* copying the value to the attribute

Just initialize the value directly in the zend_attribute_arg
2025-07-21 13:33:51 -07:00
Artem Ukrainskiy
e0c3f46496
Refactor traverse_for_entities for unescape_html_entities
Optimize scanning for '&' and ';' using memchr. Use memcpy instead of
character-by-character copying language.

Closes GH-18092
2025-07-21 20:57:09 +02:00
Niels Dossche
0962c325fa Implement SVG image handler
This implements an SVG handler using the libxml reader API. This does
not parse the entire document but instead uses a pull parser to locate
the root element, check whether it's an svg root, do some extra sanity
checks on the attribute, and fill in the php_gfxinfo structure.
2025-07-20 12:53:57 +02:00
Niels Dossche
8db883c540 Add API to register custom image handlers
This is modelled similarly to the password registry API.
We have an array to which new handlers can be added, and when a built-in
handler cannot handle the image, we try the handlers in the array.
The standard module is in control of registering a new constant for the
image file type so that no clashes can occur. It also updates the image
file type count constant. As such, the registration may only happen
during module startup.
2025-07-20 12:53:57 +02:00
Niels Dossche
05bb051243 Expose gfxinfo as php_gfxinfo
This is necessary for future commits, when we extend the image handling
to support extensions adding their own handlers.
Also extend the struct with fields for when the width and height are not
numbers but strings (e.g. for SVG).
2025-07-20 12:53:57 +02:00