1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 08:12:21 +01:00
Commit Graph

141983 Commits

Author SHA1 Message Date
Peter Kokot
c2af281c0c Use <winsock2.h> instead of legacy <winsock.h> (#19037)
This also omits defining unused HAVE_WINSOCK_H macro when building
ext/sockets.
2025-07-07 09:40:03 +02:00
Peter Kokot
aa366b5113 Update re2c minimum versions in Windows checks and docs (#19039) 2025-07-07 07:54:29 +02:00
Tim Düsterhus
c1ed6088a6 uri: Do not overwrite defaultMemoryManager (#19042)
The `defaultMemoryManager` is only available via a non-public
header and is not supposed to be used by users of the library [1].
It also has a very generic name, further indicating that it is not
supposed to be used.

Instead pass the memory manager explicitly, which is how the library is
supposed to be used.

[1] https://github.com/uriparser/uriparser/issues/52#issuecomment-453853700
2025-07-06 20:48:14 +02:00
Gina Peter Banyard
22f2a1d47b ext/pcntl: Pack module globals struct
This saves 8 bytes
2025-07-06 18:24:38 +01:00
Gina Peter Banyard
3de6695ae8 ext/pcntl: Use uint8_t type for num_signals module global 2025-07-06 18:24:38 +01:00
Gina Peter Banyard
89e4de8d7b ext/pcntl: Use bool type for some module globals
This clarifies intention and uses less bytes in the struct
2025-07-06 18:24:38 +01:00
Gina Peter Banyard
36358bad84 ext/session: get rid of sname_len field
This is unnecessary now that the session name is a zend_string
2025-07-06 17:21:00 +01:00
Gina Peter Banyard
c3dac0f8b6 ext/session: Minor code cleanups 2025-07-06 17:21:00 +01:00
Gina Peter Banyard
db01dbc4ee ext/session: Initialize variable with default value
To make it easier for IDEs to understand what is going on
2025-07-06 17:21:00 +01:00
Gina Peter Banyard
766ccc2210 ext/session: Use zend_string for some session globals 2025-07-06 17:21:00 +01:00
Gina Peter Banyard
f5166b3bb6 ext/session: convert global session_name to zstr 2025-07-06 17:21:00 +01:00
Gina Peter Banyard
b83484df97 ext/session: Use is_numeric_str helper 2025-07-06 17:21:00 +01:00
Gina Peter Banyard
ac3807ee8d ext/session: Use ZEND_STRL() 2025-07-06 17:21:00 +01:00
Gina Peter Banyard
c529e2f85b ext/session: Use smart_str_append when possible 2025-07-06 17:21:00 +01:00
Gina Peter Banyard
eaee504c4d ext/session: Concert save_path to zstr 2025-07-06 17:21:00 +01:00
Gina Peter Banyard
9c68853023 ext/session: copy zstr instead of initializing a new one 2025-07-06 17:21:00 +01:00
Gina Peter Banyard
43fe9fd171 ext/session: convert some globals to zend_string
This prevents some strlen computations
2025-07-06 17:21:00 +01:00
Gina Peter Banyard
677a1f80c8 ext/standard/stream: Use FCC instead of zval for notification callback (#19024)
Also check that the callable exists while setting the option
2025-07-06 01:30:07 +01:00
Gina Peter Banyard
c33805791d sapi/fuzzer: Fetch function and call it directly instead of using a zval to hold the name (#19030) 2025-07-06 01:29:48 +01:00
Niels Dossche
5a2a150829 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix phar crash and file corruption with SplFileObject
2025-07-05 21:44:39 +02:00
Niels Dossche
2aeefb13be Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix phar crash and file corruption with SplFileObject
2025-07-05 21:44:34 +02:00
Niels Dossche
405be1c940 Fix phar crash and file corruption with SplFileObject
There are two bugfixes here.
The first was a crash that I discovered while working on GH-19035.
The check for when a file pointer was still occupied was wrong, leading
to a UAF. Strangely, zip got this right.

The second issue was that even after fixing the first one, the file
contents were garbage. This is because the file write offset for the
phar stream was wrong.

Closes GH-19038.
2025-07-05 21:44:12 +02:00
Niels Dossche
4d27420543 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix stream double free in phar
2025-07-05 21:32:29 +02:00
Niels Dossche
50a5a6f315 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix stream double free in phar
2025-07-05 21:31:50 +02:00
Niels Dossche
32344c4dc4 Fix stream double free in phar
The copy function does two things wrong:
- The error recovery logic is a hack that temporarily moves the fp
  pointer to cfp, even though it's not compressed. The respective error
  recovery it talks about is not present in the code, nor is it
  necessary. This is the direct cause of the double free in the original
  reproducer. Fixing this makes it crash in another location though.
- The link following logic is inconsistent and illogical. It cannot be a
  link at this point.

The root cause, after fixing the above issues, is that the file pointers
are not reset properly for the copy. The file pointer need to be the
original ones to perform the copy from the right source, but after that
they need to be set properly to NULL (because fp_type == PHAR_FP).

Closes GH-19035.

Co-authored-by: Yun Dou <dixyes@gmail.com>
2025-07-05 21:31:28 +02:00
Máté Kocsis
5a9f5a6514 Add the Uri\Rfc3986\Uri class to ext/uri without wither support (#18836)
Relates to #14461 and https://wiki.php.net/rfc/url_parsing_api

Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
Co-authored-by: Tim Düsterhus <tim@tideways-gmbh.com>
2025-07-05 10:00:20 +02:00
DanielEScherzer
4560f7037d EXTENSIONS: lexbor is since 2025 [skip ci] (#19031) 2025-07-04 15:10:16 -07:00
Niels Dossche
832dde9cb6 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix OSS-Fuzz #428983568 and #428760800
2025-07-04 23:58:41 +02:00
Niels Dossche
1af7d8e547 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix OSS-Fuzz #428983568 and #428760800
2025-07-04 23:58:33 +02:00
Niels Dossche
4aac98f145 Fix OSS-Fuzz #428983568 and #428760800
Both these issues have the same root cause, their reproducer is
extremely similar so I don't duplicate the test.

If the parser invokes the lexer, and the lexer fails, it could've
allocated a string which must be freed when the parser backs up.
The `%destructor` list is responsible for this but did not have an entry
for `fallback` yet. Solve the issue by adding such an entry.

Closes GH-19012.
2025-07-04 23:58:06 +02:00
DanielEScherzer
4e42ad5bf2 ext/standard/string.c: don't use STR_EMPTY_ALLOC() (#19033)
This was the only remaining use of a compatibility alias from 10 years ago;
replace with `ZSTR_EMPTY_ALLOC()`.
2025-07-04 14:41:24 -07:00
DanielEScherzer
3558293ce8 Remove broken zend_get_zendleng() declaration (#19032)
Does not actually exist anywhere
2025-07-04 14:40:54 -07:00
DanielEScherzer
d43fbc0c0e ReflectionParameter::allowsNull() - fix typo in description [skip ci] 2025-07-04 12:33:48 -07:00
DanielEScherzer
0cdb5d0aa1 release-process: update based on 8.5.0alpha1 announcement (#19028)
* Add reminder to replace outdated information in the announcements
* Add instruction for new RMs to subscribe to the lists they need to email
2025-07-04 11:30:31 -07:00
Remi Collet
75006cf21d avoid false failure for long path (#18992) 2025-07-04 08:33:07 +02:00
Máté Kocsis
8bb6b81c60 Update uriparser to commit 8c06d 2025-07-04 08:20:27 +02:00
Gina Peter Banyard
50ddf6a68f ext/spl: Refactor ArrayObject sort methods 2025-07-03 21:50:45 +01:00
Gina Peter Banyard
faef004250 ext/spl: Add tests for disabled sort functions 2025-07-03 21:50:45 +01:00
Niels Dossche
aa0e8bf568 Use ZVAL_NULL() directly for Z_CLIENT_USE_PROXY_P()
This is just a `?int` property, no need to do anything fancy.
2025-07-03 20:37:10 +02:00
Niels Dossche
8fdd434bb5 Don't deref soap private properties
They are private and can't be made references.
2025-07-03 20:37:10 +02:00
Niels Dossche
e6e0887005 soap: Avoid redundant copying of http body string 2025-07-03 20:28:38 +02:00
Niels Dossche
32f0d24e1f soap: Get decompression function directly from function table and call it
The code is already looking up the entry in the function table anyway,
so might as well use it directly.
This simplifies the code and avoids a redundant lookup.
2025-07-03 20:28:38 +02:00
Ben Ramsey
568370827e Merge branch 'PHP-8.4' 2025-07-03 10:36:08 -05:00
Ben Ramsey
2cb292de6b Merge branch 'PHP-8.3' into PHP-8.4 2025-07-03 10:35:50 -05:00
Ben Ramsey
304d223a2f Merge branch 'PHP-8.2' into PHP-8.3 2025-07-03 10:35:31 -05:00
Ben Ramsey
58977be208 Merge branch 'PHP-8.1' into PHP-8.2 2025-07-03 10:35:05 -05:00
Ilija Tovilo
b6660634b4 Disable JIT on Apple Silicon + ZTS
Apple Silicon has stricter rules about rwx mmap regions. They need to be created
using the MAP_JIT flag. However, the MAP_JIT seems to be incompatible with
MAP_SHARED. ZTS requires MAP_SHARED so that some threads may execute code from a
page while another writes/appends to it. We did not find another solution, other
than completely disabling JIT for Apple Silicon + ZTS.

See discussion in https://github.com/php/php-src/pull/13351.

Co-authored-by: Peter Kokot <peterkokot@gmail.com>
Fixes GH-13400
Closes GH-13396
2025-07-03 10:34:04 -05:00
Tim Düsterhus
f61ae0001c Zend: constify various parameters in zend_object_handlers and zend_lazy_objects (#19019) 2025-07-03 16:32:10 +02:00
Remi Collet
840dc1981f fix ldap.h detection without pkgconfig (#19005) 2025-07-03 15:24:35 +02:00
Saki Takamachi
7fcdf8369e Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-18873 - Free column->descid appropriately (#18957)
2025-07-03 21:25:22 +09:00