1
0
mirror of https://github.com/php/php-src.git synced 2026-03-27 09:42:22 +01:00
Commit Graph

70434 Commits

Author SHA1 Message Date
Máté Kocsis
66376389fe Update uriparser to commit 5f7c6d88c50f548d0c7f499c22d36f51d34775b3
While there, fix Windows build by adding UriResolve.c to the sources.
2025-07-01 21:53:33 +02:00
Niels Dossche
30662e4e2b Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-18979: DOM\XMLDocument::createComment() triggers undefined behavior with null byte
2025-07-01 18:51:31 +02:00
Niels Dossche
1d5089e574 Fix GH-18979: DOM\XMLDocument::createComment() triggers undefined behavior with null byte
Closes GH-18983.
2025-07-01 18:51:21 +02:00
Ilija Tovilo
927aecaf6d Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix missing HAVE_JIT guard
2025-07-01 17:50:48 +02:00
Ilija Tovilo
49d94cced0 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GHSA-453j-q27h-5p8x
  Fix GHSA-hrwm-9436-5mv3: pgsql escaping no error checks
  Fix GHSA-3cr5-j632-f35r: Null byte in hostnames
2025-07-01 17:48:00 +02:00
Ilija Tovilo
c57ec92eb6 Fix missing HAVE_JIT guard
Closes GH-18993
2025-07-01 17:44:11 +02:00
Ahmed Lekssays
a179e39c38 Fix GHSA-453j-q27h-5p8x
Libxml versions prior to 2.13 cannot correctly handle a call to
xmlNodeSetName() with a name longer than 2G. It will leave the node
object in an invalid state with a NULL name. This later causes a NULL
pointer dereference when using the name during message serialization.

To solve this, implement a workaround that resets the name to the
sentinel name if this situation arises.

Versions of libxml of 2.13 and higher are not affected.

This can be exploited if a SoapVar is created with a fully qualified
name that is longer than 2G. This would be possible if some application
code uses a namespace prefix from an untrusted source like from a remote
SOAP service.

Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
2025-07-01 23:01:17 +09:00
Jakub Zelenka
66bd809ac9 Fix GHSA-hrwm-9436-5mv3: pgsql escaping no error checks
This adds error checks for escape function is pgsql and pdo_pgsql
extensions. It prevents possibility of storing not properly escaped
data which could potentially lead to some security issues.
2025-07-01 23:01:16 +09:00
Jakub Zelenka
5ef0dc7666 Fix GHSA-3cr5-j632-f35r: Null byte in hostnames
This fixes stream_socket_client() and fsockopen().

Specifically it adds a check to parse_ip_address_ex and it also makes
sure that the \0 is not ignored in fsockopen() hostname formatting.
2025-07-01 23:01:16 +09:00
Niels Dossche
4a98b36416 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-18898: SEGV zend_jit_op_array_hot with property hooks and preloading
2025-06-30 18:38:30 +02:00
Niels Dossche
53f2aa93ae Fix GH-18898: SEGV zend_jit_op_array_hot with property hooks and preloading
Property hooks were not handled for JIT+trait+preloading.
Split the existing functions that handle op arrays, and add iterations
for property hooks.

Closes GH-18923.
2025-06-30 18:38:11 +02:00
David Carlier
9644ba6dcd Merge branch 'PHP-8.4' 2025-06-29 16:59:04 +01:00
David Carlier
ef08bce645 Merge branch 'PHP-8.3' into PHP-8.4 2025-06-29 16:58:05 +01:00
David Carlier
865739e5b1 Fix GH-18976: pack with h or H format string overflow.
adding with its own remainder, INT_MAX overflows here (negative values are
discarded).

close GH-18977
2025-06-29 16:57:10 +01:00
Niels Dossche
1a5128f51e [ci skip] Fix comment typo in opcache 2025-06-29 16:51:23 +02:00
David CARLIER
1d5da8660b ext/sqlite3: relax sqlite3 explain test conditions (#18949) 2025-06-29 13:58:58 +01:00
Peter Kokot
fffe642d67 Remove HAVE_PTRDIFF_T and SIZEOF_PTRDIFF_T (#18968)
The ptrdiff_t is a C89 standard type defined in `<stddef.h>` and widely
available on current platforms. Using it conditionally as in these
occurrences is not needed anymore.
2025-06-28 20:16:12 +02:00
Niels Dossche
984bcb5d69 ext/mysqli: Get rid of calls to strcpy (#18970)
strcpy is a dangerous API that should be avoided.
2025-06-28 14:04:39 +02:00
Niels Dossche
737db4a7dc Use hasThis() where appropriate (#18967)
This macro was introduced to solve false compilers warning about the getThis()
condition not making sense for the address-taken part of the ternary.
2025-06-28 10:12:43 +02:00
Niels Dossche
44955943f9 ext/intl: Use zval_get_tmp_string where possible (#18966) 2025-06-28 10:12:20 +02:00
Arnaud Le Blanc
e0ab056d0c Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix pcntl_rfork / pcntl_forkx with zend-max-execution-timers
2025-06-27 15:47:36 +02:00
Arnaud Le Blanc
dd1a07f207 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix pcntl_rfork / pcntl_forkx with zend-max-execution-timers
2025-06-27 15:47:21 +02:00
Arnaud Le Blanc
aee1d7fb96 Fix pcntl_rfork / pcntl_forkx with zend-max-execution-timers 2025-06-27 15:46:20 +02:00
Niels Dossche
c7c6a79bd0 Add support for ParentNode::$children (#18908)
ParentNode::$children returns a HTMLCollection of all directly
descendant child elements of a container.

I had to move around some properties such that the ParentNode property
offsets are always at a fixed offset, to simplify the code.
This also adds the necessary code to deal with GC cycles in
HTMLCollections.
Furthermore, we also disable cloning a HTMLCollection as that never
worked and furthermore it also conflicts with the [[SameObject]] WebIDL
requirement of $children.
2025-06-27 09:03:50 +02:00
Gina Peter Banyard
1b7f4567cb ext/date: Fix tests (#18891) 2025-06-26 22:38:08 +02:00
DanielEScherzer
171501b93f Replace @deprecated with #[\Deprecated] for internal constants (#18780)
Only covers constants declared via stub files, others will be handled
separately in a later commit.

Does not include the intl extension, since that had some errors relating to the
cpp code; that extension will be updated separately.
2025-06-26 11:27:15 -07:00
Niels Dossche
be23be08dc Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix RCN violations in array functions
2025-06-24 23:30:08 +02:00
Niels Dossche
f77c04d007 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix RCN violations in array functions
2025-06-24 23:29:50 +02:00
Niels Dossche
359a21f102 Fix RCN violations in array functions
When the array functions perform their operation in-place, the
`@refcount 1` annotation is wrong and causes a failure under
`ZEND_VERIFY_FUNC_INFO`.
The test file tests all functions that have the in-place optimization,
even those that didn't have the refcount annotation, just to prevent
future regressions.

Closes GH-18929.
2025-06-24 23:29:00 +02:00
David CARLIER
2965fb843d ext/pcntl: following up #15921 rework SYS_pidfd_open configure detection. (#18931) 2025-06-24 21:55:00 +01:00
Niels Dossche
6d15475815 sqlite3: Split off column name cache generation
Also no need to reset the cache unconditionally in fetchAll().
2025-06-24 22:09:54 +02:00
Niels Dossche
e7678cdaa4 sqlite3: Use Z_TRY_ADDREF 2025-06-24 22:09:54 +02:00
Vladimir Vrzić
aea3ade74f ext/pcntl: Added rusage parameter to pcntl_waitid
This functionality is not part of the POSIX interface.

- On FreeBSD, the wait6 system call provides it
- On Linux, the raw waitid system call provides it (glibc does not)

close GH-15921
2025-06-24 19:21:03 +01:00
Tim Düsterhus
ca49a7bec2 RFC: Turn clone() into a function (#18919)
RFC: https://wiki.php.net/rfc/clone_with_v2

Co-authored-by: Volker Dusch <volker@tideways-gmbh.com>
2025-06-24 20:14:40 +02:00
Niels Dossche
5ed8b2be55 Fix GH-18897: printf: empty precision is interpreted as precision 6, not as precision 0 (#18912)
Like in other languages, and especially C where printf originates from,
a missing precision should be treated as a 0 precision.
Because the ADJ_PRECISION flag was not set, the double formatting code
resetted the precision to the default float precision of 6.
2025-06-24 19:06:47 +02:00
Jesse Hathaway
6a7561203d mail: add logging on errors
Prior to this commit the exit code of the sendmail command, called by
the mail function was lost, since the mail function only returns true or
false. Add additional logging to the mail function to capture the exit
code when the sendmail command fails.
2025-06-24 11:55:45 +02:00
Jesse Hathaway
c5e7490963 mail: fix exit code handling of sendmail cmd
Prior to this commit the return code of the pclose function was assumed
to be the exit code of the process. However, the returned value as
specified in wait(2) is a bit packed integer and must be interpreted
with the provided macros. This has no effect in success cases as the
integer is still zero, but in failure cases the wrong value is used,
since the 8 least significant bits contain the status code. After this
commit we use the macros to obtain the status code, which fixes the
EX_TEMPFAIL conditional.

For WIN32 the TSRM popen_ex and pclose function are used. The return
value of TSRM's pclose is not bit packed so we only check if the return
value is non-zero, which should solve, #43327,
https://bugs.php.net/bug.php?id=43327
2025-06-24 11:55:34 +02:00
Peter Kokot
ecc602e3bb Remove non-existing INI directive detect_unicode (#18909)
The detect_unicode was removed and zend.detect_unicode was added in PHP
5.4 (bbf3d43c1e).
2025-06-23 23:44:20 +02:00
Niels Dossche
d8c48903c4 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-14082: Segmentation fault on unknown address 0x600000000018 in ext/opcache/jit/zend_jit.c
2025-06-23 22:29:00 +02:00
Niels Dossche
3664f4a859 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-14082: Segmentation fault on unknown address 0x600000000018 in ext/opcache/jit/zend_jit.c
2025-06-23 22:28:00 +02:00
Niels Dossche
1e3d92f8a9 Fix GH-14082: Segmentation fault on unknown address 0x600000000018 in ext/opcache/jit/zend_jit.c
During persisting, the JIT may trigger and fill in the call graph.
The call graph info is allocated on the arena which will be gone after preloading.
To prevent invalid accesses during normal requests, the arena data should be cleared.
This has to be done after all scripts have been persisted because shared op arrays between
scripts can change the call graph.

Closes GH-18916.
2025-06-23 22:27:36 +02:00
Niels Dossche
6eed02bacc Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-18899: JIT function crash when emitting undefined variable warning and opline is not set yet
2025-06-23 20:10:27 +02:00
Niels Dossche
56c4ddfaf6 Fix GH-18899: JIT function crash when emitting undefined variable warning and opline is not set yet
The crash happens because EX(opline) is attempted to be accessed but
it's not set yet.

Closes GH-18904.
2025-06-23 20:10:09 +02:00
Niels Dossche
9b7252b8bd Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-18639: Internal class aliases can break preloading + JIT
2025-06-23 20:01:49 +02:00
Niels Dossche
ee2c0d7e7f Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-18639: Internal class aliases can break preloading + JIT
2025-06-23 20:01:40 +02:00
Niels Dossche
8e731ca622 Fix GH-18639: Internal class aliases can break preloading + JIT
ZEND_FUNC_INFO() can not be used on internal CE's. If preloading makes a
CE that's an alias of an internal class, the invalid access happens when
setting the FUNC_INFO.

While we could check the class type to be of user code, we can just skip
aliases altogether anyway which may be faster.

Closes GH-18915.
2025-06-23 20:01:15 +02:00
Niels Dossche
8493495361 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix misleading errors in printf()
  Unbreak PRINTF_DEBUG macro usages
2025-06-23 19:59:22 +02:00
Niels Dossche
eb78a0b53f Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix misleading errors in printf()
  Unbreak PRINTF_DEBUG macro usages
2025-06-23 19:59:16 +02:00
Niels Dossche
799ec7b8c5 Fix misleading errors in printf()
The precision and width _can_ be zero.

Closes GH-18911.
2025-06-23 19:58:49 +02:00
Niels Dossche
b50898894d Unbreak PRINTF_DEBUG macro usages
Clearly nobody has used this in a while given the compile errors and
warnings.
This patch fixes them so there are no errors nor warnings anymore.

Closes GH-18910.
2025-06-23 19:58:19 +02:00