Commit Graph

15515 Commits

Author SHA1 Message Date
Niels Dossche
b2963e96ee
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-14286 (ffi enum type (when enum has no name) make memory leak)
2024-07-22 17:45:20 +02:00
Niels Dossche
c0de7214aa
Fix GH-14286 (ffi enum type (when enum has no name) make memory leak)
For top-level anonymous type definition we never store the declaration anywhere
else nor the type anywhere else.
The declaration keeps owning the type and it goes out of scope.
For anonymous fields this gets handled by the add_anonymous_field code that
removes the type from the declaration.
This patch does something similar in the parsing code when it is
detected we're dealing with an anonymous enum in a top-level declaration.

Closes GH-14839.
2024-07-22 17:44:47 +02:00
Peter Kokot
f702437cad
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Append -Wno-implicit-fallthrough flag conditionally (#13331)
2024-07-22 06:58:01 +02:00
Peter Kokot
d20d11375f
Append -Wno-implicit-fallthrough flag conditionally (#13331)
Older GCC versions (< 7.0) don't support the -Wno-implicit-fallthrough
compiler flag. This adds the flag conditionally in case some other
compiler will run into same issue.

Fixes GH-13330
2024-07-22 06:57:04 +02:00
Niels Dossche
c26d1a36e2
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-15034: Integer overflow on stream_notification_callback byte_max parameter with files bigger than 2GB
2024-07-21 22:02:47 +02:00
Niels Dossche
cfcc2a3fda
Fix GH-15034: Integer overflow on stream_notification_callback byte_max parameter with files bigger than 2GB
We were using atoi, which is only for integers. When the size does not
fit in an integer this breaks. Use ZEND_STRTOUL instead. Also make sure
invalid data isn't accidentally parsed into a file size.

Closes GH-15035.
2024-07-21 22:02:11 +02:00
Niels Dossche
74de766d41
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix memory leaks in ext/tidy basedir restriction code
2024-07-21 16:28:45 +02:00
Niels Dossche
8de7ccb29b
Fix memory leaks in ext/tidy basedir restriction code
TIDY_APPLY_CONFIG can early return because it's a macro, but then the
cleanup paths are not executed. Transform this to a real function and
handle the cleanups correctly at the callsites.

Closes GH-15046.
2024-07-21 16:28:15 +02:00
Niels Dossche
f21947a7ae
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-15028: Memory leak in ext/phar/stream.c
  Fix GH-15023: Memory leak in Zend/zend_ini.c
  Fix GH-15020: Memory leak in Zend/Optimizer/escape_analysis.c
2024-07-19 14:59:44 +02:00
Niels Dossche
5996227f88
Fix GH-15028: Memory leak in ext/phar/stream.c
Closes GH-15029.
2024-07-19 14:58:28 +02:00
Niels Dossche
8c19efdc97
Fix GH-15023: Memory leak in Zend/zend_ini.c
Closes GH-15024.
2024-07-19 14:57:19 +02:00
Niels Dossche
03d73182d9
Fix GH-15020: Memory leak in Zend/Optimizer/escape_analysis.c
Closes GH-15022.
2024-07-19 14:56:28 +02:00
David Carlier
383d1b0330
Merge branch 'PHP-8.2' into PHP-8.3 2024-07-18 06:26:22 +01:00
David Carlier
efd00b8ff0
ext/curl: curl_error using curl_easy_strerror if CURLOPT_ERRORBUFFER
did not fill the error buffer.

close GH-14984
2024-07-18 06:25:37 +01:00
Niels Dossche
d3caedd6d2
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix bug #55639: Digest autentication dont work
2024-07-17 19:31:54 +02:00
Niels Dossche
911dc5b46c
Fix bug #55639: Digest autentication dont work
RFC 2617 and 7616 describe that for the "Authorization" header we should
not put the qop nor nc value inside quotes. This differs from the
WWW-Authenticate header, which may have been the source of the confusion
in the implementation. While the version with quotes seems to work fine
in some cases, clearly not all servers accept the non-standard form.
To fix the issue, simply removing the quotes of those two header fields
of the client request to be in line with the RFC suffices.

I refer further to example 3.5 in RFC 2617 and example 3.9.1 in
RFC 7616.

RFC 2617: https://datatracker.ietf.org/doc/html/rfc2617
RFC 7616: https://datatracker.ietf.org/doc/html/rfc7616

Closes GH-14328.
2024-07-17 19:23:10 +02:00
Ilija Tovilo
e01e2bb5fd
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix comments between -> and keyword
2024-07-16 23:40:59 +02:00
Ilija Tovilo
b368db204f
Fix comments between -> and keyword
Comments should not fall out of ST_LOOKING_FOR_PROPERTY.

Fixes GH-14961
Closes GH-14976
2024-07-16 23:40:18 +02:00
Pierrick Charron
c21cfa1135
[skip ci] Fix PHP 8.3.10 release date and version in NEWS 2024-07-16 12:23:31 -04:00
Pierrick Charron
e07813ad46
PHP-8.2 is now for PHP 8.2.23-dev 2024-07-16 12:20:55 -04:00
Eric Mann
155e89e12f
PHP-8.3 is now for PHP 8.3.11-dev 2024-07-16 06:45:20 -07:00
Ilija Tovilo
aca2322801
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix use-after-free in property coercion with __toString()
2024-07-16 12:43:29 +02:00
Ilija Tovilo
8c312ba74b
Fix use-after-free in property coercion with __toString()
This was only partially fixed in PHP-8.3. Backports and fixes the case for both
initialized and uninitialized property writes.

Fixes GH-14969
Closes GH-14971
2024-07-16 12:40:14 +02:00
David Carlier
10a94f846d
Merge branch 'PHP-8.2' into PHP-8.3 2024-07-13 16:59:30 +01:00
Denis Ryabov
b456ae8d34
Restore Warning instead of Fatal Error in gd_webp.c
According to the docs (https://www.php.net/manual/en/function.imagecreatefromwebp.php and https://www.php.net/manual/en/function.imagewebp.php), `false` should be returned on errors (similar to other functions of the `gd` extension), but actually all errors result in a `Fatal Error`. It doesn't look normal when trying to read an empty file or a file in the wrong format causes the program to stop. The problem seems to be related to a mega-patch that replaced `zend_error` with `zend_error_noreturn` almost everywhere. My patch fixes this behavior by switching from `zend_error_noerror` to `gd_error` (i.e. to `E_WARNING` level). All necessary memory cleanup is already in the code (as it was before the "zend_error_noreturn" patch).

Close GH-13774
2024-07-13 16:58:54 +01:00
Joe Cai
38501ed48a
Fix GH-14930: Custom stream wrapper dir_readdir output truncated to 255 characters in PHP 8.3
Revert "Reserve less file space if possible in a directory entry"
This reverts commit 00c1e7bf0f.

Closes GH-14933.
2024-07-12 19:26:42 +02:00
Christoph M. Becker
a23775a30d
Fix GH-14888: README.REDIST.BINS refers to non-existing LICENSE [ci skip]
The LICENSE file of libmagic had been inadvertently removed when the
lib had been upgraded to 5.43.  So we add the file `COPYING` from that
release[1], and rename it to `LICENSE`.

[1] <https://github.com/file/file/releases/tag/FILE5_43>

Closes GH-14917.
2024-07-11 16:39:22 +02:00
Niels Dossche
361644b78d
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  ext/gd/tests/gh10614.phpt: skip if no PNG support
2024-07-10 19:51:11 +02:00
Michael Orlitzky
09957ab9a8
ext/gd/tests/gh10614.phpt: skip if no PNG support
This test uses imagecreatefrompng(), which won't be there if libgd was
built without PNG support.

Closes GH-14905.
2024-07-10 19:50:48 +02:00
Niels Dossche
4c95cb37f5
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-14741: Segmentation fault in Zend/zend_types.h
2024-07-09 00:57:28 +02:00
Niels Dossche
eb8c3cb79a
Fix GH-14741: Segmentation fault in Zend/zend_types.h
The create_obj handler of InternalIterator is overwritten, but not the
clone_obj handler. This is not allowed.
In PHP 8.2 this didn't cause a segfault because the standard object
handler was used for the clone instead of the internal handler.
So then it allocates and frees the object using the standard object handlers.
In 8.3 however, the object is created using the standard object handler and
freed using the custom handler, resulting in the buffer overflow.
Even though bisect points to 1e1ea4f this only reveals the bug.

Closes GH-14882.
2024-07-09 00:56:53 +02:00
Niels Dossche
b8077e46ed
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix memory leak in tidy_repair_file()
2024-07-08 13:25:10 +02:00
Niels Dossche
c34def581a
Fix memory leak in tidy_repair_file()
When dealing with a file, we must free the contents if the function
fails. While here, also fix the error message because previously it
sounded like the filename was too long while in fact the file itself
is too large.

Closes GH-14862.
2024-07-08 13:24:32 +02:00
Niels Dossche
d3992b6d09
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-14550: No warning message when Zend DTrace is enabled that opcache.jit is implictly disabled
2024-07-07 13:18:35 +02:00
Niels Dossche
b44ad27a78
Fix GH-14550: No warning message when Zend DTrace is enabled that opcache.jit is implictly disabled
Closes GH-14847.
2024-07-07 13:18:01 +02:00
Niels Dossche
8ea3f154be
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-14639: Member access within null pointer in ext/spl/spl_observer.c
2024-07-06 23:58:20 +02:00
Niels Dossche
0d4e0c013e
Fix GH-14639: Member access within null pointer in ext/spl/spl_observer.c
`spl_object_storage_attach_handle` creates an entry already, but only
fills it in at the end with `spl_object_storage_create_element` which
allocates memory. In this case the allocation fails and we're left with
a NULL slot. Doing the allocation first isn't an option because we want
to check whether the slot is occupied before allocating memory.
The simplest solution is to set the entry to NULL and check for a NULL
pointer upon destruction.

Closes GH-14849.
2024-07-06 23:57:46 +02:00
David Carlier
0b28914a26
Merge branch 'PHP-8.2' into PHP-8.3 2024-07-06 20:44:20 +01:00
David Carlier
237518763f
Fix GH-14774 time_sleep_until overflow. 2024-07-06 20:43:59 +01:00
Niels Dossche
9a337a85bf
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-14834: Error installing PHP when --with-pear is used
2024-07-06 13:52:34 +02:00
Niels Dossche
67259e451d
Fix GH-14834: Error installing PHP when --with-pear is used
libxml2 2.13 makes changes to how the parsing state is set, update our
code accordingly. In particular, it started reporting entities within
attributes, while it should only report entities inside text nodes.

Closes GH-14837.
2024-07-06 13:52:02 +02:00
Niels Dossche
a1bcaf05b0
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  NEWS for compatibility in XML
  Stop setting parse options directly
  Stop relying on lastError directly
  Stop relying on the sax2 flag directly
  Port XML_GetCurrentByteIndex to public APIs
2024-07-06 13:50:23 +02:00
Niels Dossche
a66afbbe09
NEWS for compatibility in XML
Closes GH-14836.
2024-07-06 13:49:12 +02:00
Niels Dossche
751c267850
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-14553: Bug in phpdbg8.3 (also 8.1 and 8.2) echo output - trimmed at NULL byte (?)
2024-07-04 18:44:17 +02:00
Niels Dossche
95889979f2
Fix GH-14553: Bug in phpdbg8.3 (also 8.1 and 8.2) echo output - trimmed at NULL byte (?)
This broke in 6318040df2 when phpdbg
stopped using its custom printing routines. By relying on standard
printing routines, the embedded NUL bytes are causing the strings to be
cut off, even when using %.*s. Solve this by going straight to the
output routine, which is what the printf routine would've done anyway.

Closes GH-14822.
2024-07-04 18:43:42 +02:00
Niels Dossche
7ee7492f30
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  NEWS for GH-14814
  ext/standard/tests: strings/wordwrap_memory_limit_32bit.phpt has two outputs
  ext/standard/tests: 32bit wordwrap tests aren't just for Windows
2024-07-04 15:56:43 +02:00
Niels Dossche
1006e1021e
NEWS for GH-14814
Closes GH-14814.
2024-07-04 15:56:14 +02:00
Niels Dossche
519c435fc6
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-14808: Unexpected null pointer in Zend/zend_string.h with empty output buffer
2024-07-04 15:50:32 +02:00
Niels Dossche
89c3e0346a
Fix GH-14808: Unexpected null pointer in Zend/zend_string.h with empty output buffer
The output buffer can be NULL when the number of bytes is zero.

Closes GH-14815.
2024-07-04 15:49:58 +02:00
Niels Dossche
ecf0bb0fd1
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  [ci skip] NEWS
  Backport libxml2 2.13.2 fixes (#14816)
2024-07-04 15:37:35 +02:00