Commit Graph

14439 Commits

Author SHA1 Message Date
Niels Dossche
9ff1ea6077 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-10234: Setting DOMAttr::textContent results in an empty attribute value
2023-05-29 14:12:19 +02:00
Niels Dossche
c473787abb Fix GH-10234: Setting DOMAttr::textContent results in an empty attribute value
We can't directly call xmlNodeSetContent, because it might encode the string
through xmlStringLenGetNodeList for types
XML_DOCUMENT_FRAG_NODE, XML_ELEMENT_NODE, XML_ATTRIBUTE_NODE.
In these cases we need to use a text node to avoid the encoding.
For the other cases, we *can* rely on xmlNodeSetContent because it is either
a no-op, or handles the content without encoding and clears the properties
field if needed.

The test was taken from the issue report, for the test:
Co-authored-by: ThomasWeinert <thomas@weinert.info>

Closes GH-10245.
2023-05-29 14:10:59 +02:00
David Carlier
350e449bd8 Merge branch 'PHP-8.1' into PHP-8.2 2023-05-27 16:37:48 +01:00
Daniil Gentili
1dfa277a96 Fix GCC 12 compilation on riscv64
Close GH-11321
2023-05-27 16:37:19 +01:00
nielsdos
af72727b8c Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-11288 and GH-11289 and GH-11290 and GH-9142: DOMExceptions and segfaults with replaceWith
2023-05-25 23:04:49 +02:00
nielsdos
cba335d61e Fix GH-11288 and GH-11289 and GH-11290 and GH-9142: DOMExceptions and segfaults with replaceWith
This replaces the implementation of before and after with one following
the spec very strictly, instead of trying to figure out the state we're
in by looking at the pointers. Also relaxes the condition on text node
copying to prevent working on a stale node pointer.

Closes GH-11299.
2023-05-25 23:04:19 +02:00
Ilija Tovilo
5b8e941095
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Access violation when ALLOC_FALLBACK fixed
2023-05-25 11:01:58 +02:00
KoudelkaB
8946b7b141
Access violation when ALLOC_FALLBACK fixed
Close GH-11312
2023-05-25 11:01:17 +02:00
Pierrick Charron
150825d176
[skip ci] Fix release date of PHP 8.2.7 2023-05-24 23:44:32 -04:00
nielsdos
bbcf9e7107 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix allocation loop in zend_shared_alloc_startup()
2023-05-24 20:09:56 +02:00
nielsdos
6267601f84 Fix allocation loop in zend_shared_alloc_startup()
The break is outside the if, so if it succeeds or not this will always
stop after the first loop iteration instead of trying more allocators if
the first one fails.

Closes GH-11306.
2023-05-24 20:09:14 +02:00
Ilija Tovilo
0ee43718c0
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix exception handling in array_multisort()
2023-05-24 13:56:21 +02:00
Ilija Tovilo
b2ec6c24f8
Fix exception handling in array_multisort()
Closes GH-11302
2023-05-24 13:55:25 +02:00
Ilija Tovilo
7c7698f754
Fix preg_replace_callback_array() pattern validation
Closes GH-11301
2023-05-24 13:42:16 +02:00
Ilija Tovilo
4676d9bc43
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix access on NULL pointer in array_merge_recursive()
2023-05-24 13:37:47 +02:00
Ilija Tovilo
f5c54fd88b
Fix access on NULL pointer in array_merge_recursive()
Closes GH-11303
2023-05-24 13:36:52 +02:00
Ben Ramsey
2f2fd06be0
PHP-8.1 is now for PHP 8.1.21-dev 2023-05-23 16:19:16 -05:00
Pierrick Charron
d5f68b50fc
PHP-8.2 is now for PHP 8.2.8-dev 2023-05-23 16:56:58 -04:00
nielsdos
caab608d57 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-11281: DateTimeZone::getName() does not include seconds in offset
2023-05-23 18:56:40 +02:00
Niels Dossche
f9117eb824 Fix GH-11281: DateTimeZone::getName() does not include seconds in offset
If the seconds portion is non-zero, include the seconds in the output.

Closes GH-11282.
2023-05-23 18:52:07 +02:00
nielsdos
f6563442db Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-11245 (In some specific cases SWITCH with one default statement will cause segfault)
2023-05-23 00:34:33 +02:00
Niels Dossche
5cad1a7176 Fix GH-11245 (In some specific cases SWITCH with one default statement will cause segfault)
The block optimizer pass allows the use of sources of the preceding
block if the block is a follower and not a target. This causes issues
when trying to remove FREE instructions: if the source is not in the
block of the FREE, then the FREE and source are still removed. Therefore
the other successor blocks, which must consume or FREE the temporary,
will still contain the FREE opline. This opline will now refer to a
temporary that doesn't exist anymore, which most of the time results in
a crash. For these kind of non-local scenarios, we'll let the SSA
based optimizations handle those cases.

Closes GH-11251.
2023-05-23 00:33:25 +02:00
Niels Dossche
ffae350d11 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-11099: Generating phar.php during cross-compile can't be done
2023-05-20 13:42:21 +02:00
Peter
93fa9613e1 Fix GH-11099: Generating phar.php during cross-compile can't be done
Closes GH-11243.
2023-05-20 13:35:18 +02:00
Niels Dossche
45897f592c Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-11274: POST/PATCH request via file_get_contents + stream_context_create switches to GET after a HTTP 308 redirect
2023-05-19 23:43:02 +02:00
Niels Dossche
1ede3137c9 Fix GH-11274: POST/PATCH request via file_get_contents + stream_context_create switches to GET after a HTTP 308 redirect
RFC 7231 states that status code 307 should keep the POST method upon
redirect. RFC 7538 does the same for code 308. Although it's not
mandated by the RFCs that PATCH is also kept (we can choose), it seems
like keeping PATCH will be the most consistent and understandable behaviour.

This patch also changes an existing test because it was testing for the
wrong behaviour.

Closes GH-11275.
2023-05-19 23:37:20 +02:00
Ilija Tovilo
aa553af911
Fix segfault in mb_strrpos/mb_strripos with ASCII encoding and negative offset
We're setting the encoding from PHP_FUNCTION(mb_strpos), but mbfl_strpos would
discard it, setting it to mbfl_encoding_pass, making zend_memnrstr fail due to a
null-pointer exception.

Fixes GH-11217
Closes GH-11220
2023-05-15 10:36:37 +02:00
Jakub Zelenka
1129046482
Merge branch 'PHP-8.1' into PHP-8.2 2023-05-14 12:28:52 +01:00
Jakub Zelenka
4294e8d448
FPM: Fix memory leak for invalid primary script file handle
Closes GH-11088
2023-05-14 12:27:38 +01:00
Jakub Zelenka
90553af15c
Merge branch 'PHP-8.1' into PHP-8.2 2023-05-13 18:53:35 +01:00
Jakub Zelenka
5e64ead64a
Fix bug #64539: FPM status - query_string not properly JSON encoded
Closes GH-11050
2023-05-13 18:43:30 +01:00
Jakub Zelenka
bda28eb649
Merge branch 'PHP-8.1' into PHP-8.2 2023-05-13 14:14:23 +01:00
Jakub Zelenka
102953735c
Fix GH-10461: Postpone FPM child freeing in event loop
This is to prevent after free accessing of the child event that might
happen when child is killed and the message is delivered at that same
time.

Also fixes GH-10889 and properly fixes GH-8517 that was not previously
fixed correctly.
2023-05-13 14:11:42 +01:00
nielsdos
d369a7764f Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-10834: exif_read_data() cannot read smaller stream wrapper chunk sizes
2023-05-12 23:40:54 +02:00
Niels Dossche
7b768485f3 Fix GH-10834: exif_read_data() cannot read smaller stream wrapper chunk sizes
php_stream_read() may return less than the requested amount of bytes by
design. This patch introduces a static function for exif which reads
from the stream in a loop until all the requested bytes are read.

For the test: Co-authored-by: dotpointer

Closes GH-10924.
2023-05-12 23:37:00 +02:00
Ilija Tovilo
e3499130f1
Fix delayed early binding class redeclaration error
If we bind the class to the runtime slot even if we're not the ones who have
performed early binding we'll miss the redeclaration error in the
ZEND_DECLARE_CLASS_DELAYED handler.

Closes GH-11226
2023-05-12 19:29:04 +02:00
Ilija Tovilo
ad747d93c3
[skip ci] Remove NEWS entry for reverted change in PHP 8.1 2023-05-11 11:53:18 +02:00
Bob Weinand
53558ffc71 Merge branch 'PHP-8.1' into PHP-8.2 2023-05-10 16:45:48 +02:00
Bob Weinand
975d28e278 Fix GH-11222: foreach by-ref may jump over keys during a rehash
Signed-off-by: Bob Weinand <bobwei9@hotmail.com>
2023-05-10 16:45:05 +02:00
Ilija Tovilo
6692477406
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix compilation error on old GCC versions
2023-05-10 11:56:07 +02:00
Amedeo Baragiola
175ff603c3
Fix compilation error on old GCC versions
In older versions of GCC (<=4.5) designated initializers would not accept member
names nested inside anonymous structures. Instead, we need to use a positional
member wrapped in {}.

Fixes GH-11063
Closes GH-11212
2023-05-10 11:55:13 +02:00
nielsdos
44491d17fb Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-8426: make test fail while soap extension build
2023-05-09 19:52:52 +02:00
nielsdos
6ba0b06819 Fix GH-8426: make test fail while soap extension build
If you build soap as a shared object, then these tests fail on
non-Windows, or when the PHP install hasn't been make install-ed yet,
but is executed from the development directory.

Closes GH-11211.
2023-05-09 19:48:45 +02:00
Niels Dossche
e6730565b6 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-11180: hash_file() appears to be restricted to 3 arguments
2023-05-07 17:37:25 +02:00
Niels Dossche
baa07f3de3 Fix GH-11180: hash_file() appears to be restricted to 3 arguments
Closes GH-11198.
2023-05-07 17:33:28 +02:00
Niels Dossche
dc1a70c244 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-11160: Few tests failed building with new libxml 2.11.0
2023-05-06 23:10:58 +02:00
Niels Dossche
7c0dfc5cf5 Fix GH-11160: Few tests failed building with new libxml 2.11.0
It's possible to categorise the failures into 2 categories:
  - Changed error message. In this case we either duplicate the test and
    modify the error message. Or if the change in error message is
    small, we use the EXPECTF matchers to make the test compatible with both
    old and new versions of libxml2.
  - Missing warnings. This is caused by a change in libxml2 where the
    parser started using SAX APIs internally [1]. In this case the
    error_type passed to php_libxml_internal_error_handler() changed from
    PHP_LIBXML_ERROR to PHP_LIBXML_CTX_WARNING because it internally
    started to use the SAX handlers instead of the generic handlers.
    However, for the SAX handlers the current input stack is empty, so
    nothing is actually printed. I fixed this by falling back to a
    regular warning without a filename & line number reference, which
    mimicks the old behaviour. Furthermore, this change now also shows
    an additional warning in a test which was previously hidden.

[1] 9a82b94a94

Closes GH-11162.
2023-05-06 23:10:07 +02:00
Niels Dossche
a0e71cb811 Fix maximum argument count of pcntl_forkx()
Closes GH-11199.
2023-05-06 20:56:27 +02:00
nielsdos
1fc18a84d9 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-10031: [Stream] STREAM_NOTIFY_PROGRESS over HTTP emitted irregularly for last chunk of data
2023-05-05 19:28:01 +02:00
Niels Dossche
b33fbbfe3d Fix GH-10031: [Stream] STREAM_NOTIFY_PROGRESS over HTTP emitted irregularly for last chunk of data
It's possible that the server already sent in more data than just the headers.
Since the stream only accepts progress increments after the headers are
processed, the already read data is never added to the process.
We account for this by adjusting the progress counter by the difference of
already read header data and the body.

For the test:
Co-authored-by: aetonsi <18366087+aetonsi@users.noreply.github.com>

Closes GH-10492.
2023-05-05 19:26:44 +02:00