Commit Graph

14806 Commits

Author SHA1 Message Date
Niels Dossche
3ff7d18070 [ci skip] NEWS for fa397e02 and 6f6fedcb 2023-08-05 22:12:04 +02:00
Kamil Tekiela
4db701c049
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix MySQL Statement has a empty query result when the response field has changed, also Segmentation fault
2023-08-04 22:31:18 +01:00
Yurun
ca5d48213a
Fix MySQL Statement has a empty query result when the response field has changed, also Segmentation fault
Closes GH-11551.
2023-08-04 22:25:01 +01:00
Niels Dossche
c59bfc8d98 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Revert the fix for GH-11498
2023-08-03 21:59:21 +02:00
Niels Dossche
f7be15dbad Revert the fix for GH-11498
People relied on manually waiting for children, but the fix for GH-11498
broke this. Fixing this in PHP is fundamentally incompatible with doing
the wait loop in userland. This reverts to the old behaviour.

Closes GH-11863.
2023-08-03 21:48:34 +02:00
Niels Dossche
75441d71d8 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-10964: Improve `man` page about the built-in server
  Fix GH-11438: mysqlnd fails to authenticate with sha256_password accounts using passwords longer than 19 characters
2023-08-03 20:32:30 +02:00
Alexandre Daubois
997a36750b Fix GH-10964: Improve man page about the built-in server
Closes GH-11857.
2023-08-03 20:29:13 +02:00
Niels Dossche
509906b2a5 Fix GH-11438: mysqlnd fails to authenticate with sha256_password accounts using passwords longer than 19 characters
https://dev.mysql.com/doc/dev/mysql-server/latest/page_caching_sha2_authentication_exchanges.html
tells us that the nonce used in this authentication method is 20 bytes
long. However, we might receive additional scramble data in
php_mysqlnd_greet_read not used in this method.
On my test setup, I received 21 bytes (20 bytes + '\0'). This resulted
in the xor computation to incorrectly include the NUL byte. Every
password of at least 20 characters therefore failed to authenticate
using this method.

Looking at mysql-server source code also seems to reveal that it always
uses a fixed number of scramble bytes [1].

[1] ea7087d885/sql/auth/sha2_password.cc (L1078-L1079)

Closes GH-11445.

Co-authored-by: Kamil Tekiela <tekiela246@gmail.com>
2023-08-03 20:28:11 +02:00
Sergey Panteleev
dddcf92049
[ci skip] Update NEWS 2023-08-03 15:13:01 +03:00
Derick Rethans
a8f4171655 Fixed bug GH-11854 (DateTime:createFromFormat stopped parsing datetime with extra space) 2023-08-03 09:52:34 +01:00
Ilija Tovilo
b80bebc278
Synchronize zend_jit_stop_counter_handlers()
Avoid stopping counters repeatedly from different threads/processes.

Fixes GH-11609
Closes GH-11806
2023-08-03 10:19:11 +02:00
Niels Dossche
139a69261f Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-11440: authentication to a sha256_password account fails over SSL
2023-08-02 20:33:24 +02:00
nielsdos
94127c53aa Fix GH-11440: authentication to a sha256_password account fails over SSL
This is similar to bug #78680, but that bug wasn't really fixed in all
places. This is the only remaining place.

Closes GH-11444.
2023-08-02 20:30:49 +02:00
Niels Dossche
82eda28616 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix json_encode result on DOMDocument
2023-08-01 17:31:55 +02:00
Niels Dossche
6e468bbd3b Fix json_encode result on DOMDocument
According to https://www.php.net/manual/en/class.domdocument:
  When using json_encode() on a DOMDocument object the result will be
  that of encoding an empty object.

But this was broken in 8.1. The output was `{"config": null}`.
That's because the config property is defined with a default value of
NULL, hence it was included. The other properties are not included
because they don't have a default property, and nothing is ever written
to their backing field. Hence, the JSON encoder excludes them.
Similarly, `(array) $doc` would yield the same `config` key in the
array.

Closes GH-11840.
2023-08-01 17:28:51 +02:00
Jakub Zelenka
98768cf430
Update NEWS for PHP 8.3.0beta2 2023-08-01 12:36:49 +01:00
Ben Ramsey
3d5f239474
Merge branch 'PHP-8.2' 2023-07-31 20:15:51 -05:00
Ben Ramsey
7ecb284926
Merge branch 'PHP-8.1' into PHP-8.2 2023-07-31 20:06:37 -05:00
Ben Ramsey
ebbccb3dc6
Merge branch 'PHP-8.0' into PHP-8.1 2023-07-31 20:01:03 -05:00
Niels Dossche
d8f2584ebb
NEWS
Signed-off-by: Ben Ramsey <ramsey@php.net>
2023-07-31 19:56:12 -05:00
Ilija Tovilo
e8edd35c49
Merge branch 'PHP-8.2'
* PHP-8.2:
  Check if restart is pending before trying to lock SHM
2023-07-31 20:01:23 +02:00
Ilija Tovilo
f2328302b6
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Check if restart is pending before trying to lock SHM
2023-07-31 20:00:49 +02:00
Mikhail Galanin
3e9792f4a2
Check if restart is pending before trying to lock SHM
This reduces lock contention when Opcache restart is scheduled
but not yet started.

Closes GH-11805
2023-07-31 20:00:31 +02:00
Ilija Tovilo
7364b7bc0b
Fix uaf of MBSTRG(all_encodings_list)
We need to remove the value from the GC buffer before freeing it. Otherwise
shutdown will uaf when running the gc. Do that by switching from
zend_hash_destroy to zend_array_destroy, which should also be faster for freeing
members due to inlining of i_zval_ptr_dtor.

Closes GH-11822
2023-07-31 13:31:50 +02:00
Niels Dossche
4bee5743e9 Fix GH-11792: LIBXML_NOXMLDECL is not implemented or broken
Fixes GH-11792.
Closes GH-11794.
2023-07-26 18:02:36 +02:00
Niels Dossche
86580c6624 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-11791: Wrong default value of DOMDocument::xmlStandalone
2023-07-26 17:23:45 +02:00
Niels Dossche
bf4e7bd3ed Fix GH-11791: Wrong default value of DOMDocument::xmlStandalone
At one point this was changed from a bool to an int in libxml2, with
negative values meaning it is unspecified. Because it is cast to a bool
this therefore returned true instead of the expected false.

Closes GH-11793.
2023-07-26 17:20:10 +02:00
Jorg Adam Sowa
549c657897
Fix GH-11761: Bcmath numbers with trailing zeros (#11798) 2023-07-26 13:48:50 +01:00
Ilija Tovilo
127ad70782
Fix open_basedir leak
Fixes oss-fuzz #60741
Closes GH-11780
2023-07-25 17:54:14 +02:00
Niels Dossche
e76b62bcb2 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix empty argument cases for DOMParentNode methods
  Fix DOMCharacterData::replaceWith() with itself
  Fix incorrect attribute existence check in DOMElement::setAttributeNodeNS()
  Fix DOMEntity field getter bugs
2023-07-24 19:01:22 +02:00
Niels Dossche
abb1d2e824 Fix empty argument cases for DOMParentNode methods
Closes GH-11768.
2023-07-24 18:58:39 +02:00
Niels Dossche
1cf2d216a2 Fix DOMCharacterData::replaceWith() with itself
Previously, when replacing the node with itself (or contained within
itself), the node disappeared.

Closes GH-11770.
2023-07-24 18:58:17 +02:00
Niels Dossche
168bc8146f Fix incorrect attribute existence check in DOMElement::setAttributeNodeNS()
Closes GH-11776.
2023-07-24 18:57:16 +02:00
Niels Dossche
d439ee18ed Fix DOMEntity field getter bugs
- publicId could crash PHP if none was provided
- notationName never worked

The fields of this classs were untested. This new test file changes that.

Closes GH-11779.
2023-07-24 18:55:51 +02:00
Niels Dossche
272dc9a09c Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-11716: cli server crashes on SIGINT when compiled with ZEND_RC_DEBUG=1
2023-07-21 15:31:20 +02:00
Niels Dossche
af77d3b8da Fix GH-11716: cli server crashes on SIGINT when compiled with ZEND_RC_DEBUG=1
Closes GH-11757.
2023-07-21 15:23:56 +02:00
Niels Dossche
31bd62865f Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Prevent int overflow on $decimals in number_format
2023-07-21 13:51:04 +02:00
Marc Bennewitz
429f20e981 Prevent int overflow on $decimals in number_format
Closes GH-11714.
Closes GH-11649.
2023-07-21 13:50:18 +02:00
Niels Dossche
404f1d3700 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-11715: opcache.interned_strings_buffer either has no effect or opcache_get_status() / phpinfo() is wrong
2023-07-21 13:09:44 +02:00
Niels Dossche
ee3f932390 Fix GH-11715: opcache.interned_strings_buffer either has no effect or opcache_get_status() / phpinfo() is wrong
There are a couple of oddities.

1) The interned strings buffer comprises the whole hashtable
   datastructure.
   Therefore, it seems that the interned strings buffer size is the size of
   only said table. However, in the current code it also includes the size
   of the zend_accel_shared_globals.

2) ZCSG(interned_strings).end is computed starting from the accelerator
   globals struct itself. I would expect it to start from the part where
   the interned strings table starts.

3) When computing the used size, it is done using
   ZCSG(interned_strings).end - ZCSG(interned_strings).start. However,
   this does not include the uin32_t slots array because
   ZCSG(interned_strings).start pointers after that array.

This patch corrrects these 3 points.

Closes GH-11717.
2023-07-21 13:04:53 +02:00
Ilija Tovilo
84cb42e0f1
Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix leaking definitions on FFI::cdef()->new()
2023-07-21 10:43:13 +02:00
Ilija Tovilo
88fab26365
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix leaking definitions on FFI::cdef()->new()
2023-07-21 10:42:42 +02:00
Ilija Tovilo
11d6bea98a
Fix leaking definitions on FFI::cdef()->new()
Previously, FFI_G(symbols) and FFI_G(tags) were never cleaned up when calling
new on an existing object. However, if cdef() is called without parameters these
globals are NULL and might be created when new() creates new definitions. These
would then be discarded without freeing them.

Closes GH-11751
2023-07-21 10:42:19 +02:00
Sergey Panteleev
ad666eb6df
[ci skip] Update NEWS for c3ccc36
Fix in Streams moved from 8.2.10 to 8.2.9
2023-07-19 13:35:18 +03:00
Ilija Tovilo
b0037eda26
Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix use-after-free when unregistering user stream wrapper from itself
2023-07-19 11:20:18 +02:00
Ilija Tovilo
c3ccc363c6
Fix use-after-free when unregistering user stream wrapper from itself
Fixes GH-11735
Closes GH-11737
2023-07-19 11:17:57 +02:00
Eric Mann
42e32a72b5
Update NEWS for php8.3.0beta1 2023-07-18 15:54:56 -07:00
Ben Ramsey
6e3c520f51
PHP-8.1 is now for PHP-8.1.23-dev 2023-07-18 16:30:49 -05:00
Ilija Tovilo
791ca5d1db
Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix hash_pbkdf2 options parameter
2023-07-18 19:24:03 +02:00
Ilija Tovilo
e8c9c73118
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix hash_pbkdf2 options parameter
2023-07-18 19:23:10 +02:00
Ilija Tovilo
7cae6eb8db
Fix hash_pbkdf2 options parameter
The value needs to be initialized to NULL as it is optional. Furthermore, the
parameter was completely missing in the stub signature.

Closes GH-11731
2023-07-18 19:21:13 +02:00
Ilija Tovilo
9bcdf219ec
Resolve open_basedir paths on ini update
Closes GH-10987
2023-07-18 14:43:40 +02:00
Sergey Panteleev
796a75f967
PHP-8.2 is now for PHP 8.2.10-dev 2023-07-18 14:02:43 +03:00
Niels Dossche
de60872cfd
Add new curl constants from curl until (including) 7.87 (#10459)
Fixes GH-10454
2023-07-17 20:42:39 +02:00
Niels Dossche
db5e8ae6cf Implement DOMElement::toggleAttribute()
ref: https://dom.spec.whatwg.org/#dom-element-toggleattribute

Closes GH-11696.
2023-07-17 20:06:49 +02:00
Niels Dossche
a73f38f407
Implement DOMElement::insertAdjacent{Element,Text} (#11700)
* Implement DOMElement::insertAdjacent{Element,Text}

ref: https://dom.spec.whatwg.org/#dom-element-insertadjacentelement
ref: https://dom.spec.whatwg.org/#dom-element-insertadjacenttext

Closes GH-11700.
2023-07-17 17:42:47 +02:00
Niels Dossche
2f318cfb06 Implement DOMNode::isEqualNode()
Since we still support obsoleted nodes in our implementation, this uses
the old spec to match the old nodes; and this uses the new spec for
nodes still defined in the living spec.
When unclear, the behaviour was cross-verified with Firefox.

References:
https://dom.spec.whatwg.org/#dom-node-isequalnode (for everything still in the living spec)
https://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/DOM3-Core.html#core-Node3-isEqualNode (for old nodes removed from the living spec)

Closes GH-11690.
2023-07-17 15:29:36 +02:00
Niels Dossche
d04f48b6ac Implement DOMNode::parentElement and DOMNameSpaceNode::parentElement
ref: https://dom.spec.whatwg.org/#parent-element

Closes GH-11679.
2023-07-17 13:15:31 +02:00
Niels Dossche
d38cc9b9b6 Implement DOMNode::isConnected and DOMNameSpaceNode::isConnected
ref: https://dom.spec.whatwg.org/#dom-node-isconnected

Closes GH-11677.
2023-07-17 13:14:13 +02:00
Niels Dossche
8b1d352ed8 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Prevent potential deadlock if accelerated globals cannot be allocated
2023-07-17 13:00:00 +02:00
Niels Dossche
b0bc057e86 Prevent potential deadlock if accelerated globals cannot be allocated
Not sure if this is possible to hit in practice, zend_accel_error_noreturn
doesn't return so the unlock isn't called. Other callsites that use both
zend_accel_error_noreturn and zend_shared_alloc_unlock first perform the
unlocking.

Closes GH-11718.
2023-07-17 12:49:15 +02:00
George Peter Banyard
ca8dab3b8a
Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix GH-11587 PDO::ATTR_STRINGIFY_FETCHES should return strings even in if PDO::ATTR_EMULATE_PREPARES is enabled
2023-07-17 07:10:16 +01:00
George Peter Banyard
5f716bf2df
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-11587 PDO::ATTR_STRINGIFY_FETCHES should return strings even in if PDO::ATTR_EMULATE_PREPARES is enabled
2023-07-17 07:09:34 +01:00
SakiTakamachi
e0aadc1c0d
Fix GH-11587 PDO::ATTR_STRINGIFY_FETCHES should return strings even in if PDO::ATTR_EMULATE_PREPARES is enabled
This also includes a fix for the MySQL ND driver to actually respect the user decided behaviour.

Closes GH-11622

Signed-off-by: George Peter Banyard <girgias@php.net>
2023-07-17 07:08:45 +01:00
Arnaud Le Blanc
e413419e33 [ci skip] UPGRADING / NEWS 2023-07-16 13:42:35 +02:00
Joshua Behrens
08b57772b0
Warn when fpm socket was not registered on the expected path
This might happen if the UDS length limit is exceeded.

Co-authored-by: Jakub Zelenka <bukka@php.net>

Closes GH-11066
2023-07-15 14:21:58 +01:00
Niels Dossche
72e2e25066 Implement DOMElement::id
ref: https://dom.spec.whatwg.org/#dom-element-id

Closes GH-11701.
2023-07-14 14:37:11 +02:00
Niels Dossche
6560c9bf8e Implement DOMParentNode::replaceChildren()
ref: https://dom.spec.whatwg.org/#dom-parentnode-replacechildren
2023-07-14 14:34:29 +02:00
Niels Dossche
b24b3510f9 Implement DOMElement::className
ref: https://dom.spec.whatwg.org/#dom-element-classname

Closes GH-11691.
2023-07-13 19:05:09 +02:00
Marc Bennewitz
591f3f619e
Prevent decimal int precision loss in number_format()
Closes GH-11584
2023-07-13 15:30:30 +01:00
Niels Dossche
d17069e191 Implement DOMNode::getRootNode()
ref: https://dom.spec.whatwg.org/#dom-node-getrootnode

Closes GH-11693.
2023-07-13 16:27:28 +02:00
Niels Dossche
10d7e8dc3a Implement DOMElement::getAttributeNames()
ref: https://dom.spec.whatwg.org/#dom-element-getattributenames
2023-07-13 16:18:10 +02:00
Cristian Rodríguez
5572975ba7
proc_open: Use posix_spawn(3) interface on systems where it is profitable
As the size of the PHP process increases, forking gets slower and memory
consumption increases, degrading the performance in varying degrees.

This patch makes proc_open use posix_spawn only on systems which is known to be
safe, faster than the HAVE_FORK path and have posix_spawn_file_actions_addchdir_np(3)
action.
Non scientific benchmark shows running php own's test suite on linux completes
dozens of seconds faster, the impact is probably higher on systems where
posix_spawn is a syscall.

Closes GH-7933
2023-07-13 13:29:42 +01:00
David CARLIER
a077c2dd6c Merge branch 'PHP-8.2' 2023-07-13 12:40:59 +01:00
David CARLIER
0309800b4d Merge branch 'PHP-8.1' into PHP-8.2 2023-07-13 12:40:47 +01:00
David Carlier
69b4360e88 zend_gdb disable gdb detection for FreeBSD < 11.
ref PR: https://github.com/php/php-src/pull/11599.

Close GH-11646
2023-07-13 12:39:58 +01:00
Niels Dossche
ea794e9cde Implement DOMNode::contains()
ref: https://dom.spec.whatwg.org/#dom-node-contains
2023-07-12 19:29:07 +02:00
George Peter Banyard
2aaa7997a2
Merge branch 'PHP-8.2'
* PHP-8.2:
  ext/intl: Fix memory leak in MessageFormatter::format()
2023-07-12 15:45:24 +01:00
George Peter Banyard
1e41b0f1a5
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  ext/intl: Fix memory leak in MessageFormatter::format()
2023-07-12 15:44:41 +01:00
George Peter Banyard
536dbd74fa
ext/intl: Fix memory leak in MessageFormatter::format()
Closes GH-11658
2023-07-12 15:43:45 +01:00
Ilija Tovilo
a833937725
Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix double-compilation of arrow-function
2023-07-12 11:01:38 +02:00
Ilija Tovilo
060df83a98
Fix double-compilation of arrow-function
We transform the arrow function by nesting the expression into a return
statement. If we compile the arrow function twice this would be done twice,
leading to a compile assertion.

Fix oss-fuzz #60411
Closes GH-11632
2023-07-12 11:01:23 +02:00
Niels Dossche
832a3d193f Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-10914: OPCache with Enum and Callback functions results in segmentation fault
2023-07-11 17:40:21 +02:00
Niels Dossche
bc42179133 Fix GH-10914: OPCache with Enum and Callback functions results in segmentation fault
See linked issue for analysis.

Closes GH-11675.
2023-07-11 17:38:09 +02:00
Tim Düsterhus
c2cc1dbc85
[ci skip] NEWS / UPGRADING for ldap_connect with 2 arguments deprecation
see 69a8b63ecf
2023-07-11 17:34:38 +02:00
Derick Rethans
a4bdaeabf6 Fix bug GH-11600: Can't parse time strings which include (narrow) non-breaking space characters 2023-07-11 16:29:04 +01:00
Niels Dossche
2957be202e Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  [ci skip] NEWS
2023-07-10 16:02:31 +02:00
Niels Dossche
3d9c557041 [ci skip] NEWS 2023-07-10 16:01:52 +02:00
Niels Dossche
57ff1c354e Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-11630: proc_nice_basic.phpt only works at certain nice levels
  Fix GH-11629: bug77020.phpt tries to send mail
  Fix GH-11625: DOMElement::replaceWith() doesn't replace node with DOMDocumentFragment but just deletes node or causes wrapping <></> depending on libxml2 version
2023-07-10 13:34:21 +02:00
Niels Dossche
15ff830373 Fix GH-11625: DOMElement::replaceWith() doesn't replace node with DOMDocumentFragment but just deletes node or causes wrapping <></> depending on libxml2 version
Depending on the libxml2 version, the behaviour is either to not
render the fragment correctly, or to wrap it inside <></>. Fix it by
unpacking fragments manually. This has the side effect that we need to
move the unlinking check in the replacement function to earlier because
the empty child list is now possible in non-error cases.
Also fixes a mistake in the linked list management.

Closes GH-11627.
2023-07-10 13:29:31 +02:00
Niels Dossche
3ee2ade917 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Add missing check on EVP_VerifyUpdate() in phar util
2023-07-09 22:55:01 +02:00
Niels Dossche
0d07b6d647 Add missing check on EVP_VerifyUpdate() in phar util
Closes GH-11640.
2023-07-09 22:54:27 +02:00
Marc Bennewitz
e85fb0902c
number_format() Support rounding negative places
Closes GH-11487
2023-07-09 14:05:32 +01:00
Niels Dossche
d0c824cb7e Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix crash when an invalid callback function is passed to CURLMOPT_PUSHFUNCTION
2023-07-08 21:39:17 +02:00
Niels Dossche
3ccd8d7866 Fix crash when an invalid callback function is passed to CURLMOPT_PUSHFUNCTION
Previously this caused a SIGABRT.

Closes GH-11639.
2023-07-08 21:32:10 +02:00
David Carlier
343b599747 zend call stack, follow-up on 75e9980.
user stack usable implementation for openbsd.

Close GH-11626
2023-07-08 15:32:57 +01:00
Jakub Zelenka
4a5d13e205
Fix GH-11242: Use dynamic buffer for large length in stream mem copy 2023-07-08 11:43:05 +01:00
Niels Dossche
bbe72f160d [ci skip] NEWS
The alphabet is hard...
2023-07-07 19:26:58 +02:00
Niels Dossche
4a28cc725a Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-9669: phpdbg -h options doesn't list the -z option
2023-07-07 19:17:35 +02:00
Adam Saponara
119b062169 Fix GH-9669: phpdbg -h options doesn't list the -z option
Adds `-z` flag in phpdbg output.

Closes GH-9713.
2023-07-07 19:16:32 +02:00