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

141405 Commits

Author SHA1 Message Date
Remi Collet
2e70a8945a Merge branch 'PHP-8.4'
* PHP-8.4:
  NEWS
  NEWS
  Fix GH-18529: ldap no longer respects TLS_CACERT from ldaprc in ldap_start_tls() Regresion introduced in fix for GH-17776
2025-05-15 09:22:52 +02:00
Remi Collet
73321e22d2 NEWS 2025-05-15 09:22:41 +02:00
Remi Collet
8647624261 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  NEWS
  Fix GH-18529: ldap no longer respects TLS_CACERT from ldaprc in ldap_start_tls() Regresion introduced in fix for GH-17776
2025-05-15 09:22:09 +02:00
Remi Collet
8da9530652 NEWS 2025-05-15 09:21:58 +02:00
Remi Collet
2760a3ef97 Fix GH-18529: ldap no longer respects TLS_CACERT from ldaprc in ldap_start_tls() Regresion introduced in fix for GH-17776
- ensure TLS string options are properly inherited
  workaround to openldap issue https://bugs.openldap.org/show_bug.cgi?id=10337

- fix ldaps/start_tls tests using LDAPNOINIT in ldaps/tls tests
2025-05-15 09:19:57 +02:00
Richard Schneeman
89dc8d79a7 cli: Fix swapped output in php --ini (#18557)
In #18527, I accidentally swapped the values. This is before my modification:

```
zend_printf("Configuration File (php.ini) Path: %s\n", PHP_CONFIG_FILE_PATH);
zend_printf("Loaded Configuration File:         %s\n", php_ini_opened_path ? php_ini_opened_path : "(none)");
zend_printf("Scan for additional .ini files in: %s\n", php_ini_scanned_path  ? php_ini_scanned_path : "(none)");
```

- "Loaded Configuration File" should be `php_ini_opened_path`
- "Scan for additional .ini files in" shoudl be `php_ini_scanned_path`
2025-05-14 21:36:20 +02:00
Arnaud Le Blanc
1de16c7f15 Merge branch 'PHP-8.4'
* PHP-8.4:
  Snapshotted poly_func / poly_this may be spilled
2025-05-14 12:30:36 +02:00
Arnaud Le Blanc
18276a8b42 Snapshotted poly_func / poly_this may be spilled
Polymorphic calls pass this and the function to side traces via snapshotting.
However, we assume that this/func are in registers, when in fact they may be
spilled.

Here I update snapshotting of poly_func/poly_this to support spilling:

 - In zend_jit_snapshot_handler, keep track of the C stack offset
   of the spilled register, in a way similar to how stack variables.
 - In zend_jit_start, do not pre-load the registers if they were spilled.
 - In zend_jit_trace_exit / zend_jit_trace_deoptimization, load from the
   stack if the register was spilled.
 - Store a reference to poly_func/poly_this in zend_jit_ctx so we can use that
   directly in the side trace.

Closes GH-18408
2025-05-14 12:27:57 +02:00
David CARLIER
4122daa494 ext/date: various array optimisations. (#18382) 2025-05-12 19:03:59 +01:00
Niels Dossche
ba4567a987 Fix OSS-Fuzz #416302790 (#18537)
The parser accepted invalid code: consts are only valid at the top
level, but because GH-16952 changed the grammar it was incorrectly
allowed at all places that allowed attributed statements.
Fix this by introducing a variant of attributed_statement for the top
level.
2025-05-12 18:45:01 +02:00
Tim Düsterhus
5e65d8e126 standard: Remove php_std_date() C API (#18522)
This function is unused and trivially replaced by `php_format_date()` (which is
already used to format date headers in the CLI server and ext/session). Remove
it to slim down the codebase, allowing to remove an entire header (and a source
file once the deprecated `strptime()` userland function is removed).
2025-05-12 10:53:51 +02:00
Tim Düsterhus
5626e65af2 Merge branch 'PHP-8.4'
* PHP-8.4:
  standard: Take `zend.assertions` into account for dynamic calls to `assert()` (#18521)
2025-05-12 08:45:37 +02:00
Tim Düsterhus
40edd58d36 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  standard: Take `zend.assertions` into account for dynamic calls to `assert()` (#18521)
2025-05-12 08:45:26 +02:00
Tim Düsterhus
8d2682fc50 standard: Take zend.assertions into account for dynamic calls to assert() (#18521)
Fixes php/php-src#18509.
2025-05-12 08:44:46 +02:00
Richard Schneeman
331ac35f58 Fix visibility of whitespace in config output (#18527)
When a config var has whitespace (especially trailing whitespace) it is hard to see. This commit wraps the values (if they exist) in double quotes, so the difference is visually observable:

Before:

```
$ export PHP_INI_SCAN_DIR="/opt/homebrew/etc/php/8.4/conf.d         "
$ ./sapi/cli/php --ini
Configuration File (php.ini) Path: /usr/local/lib
Loaded Configuration File:         /opt/homebrew/etc/php/8.4/conf.d         
Scan for additional .ini files in: (none)
Additional .ini files parsed:      (none)
```

> Note 
> The above output has trailing whitespace that is not visible, you can see it if you copy it into an editor:

After:

```
$ ./sapi/cli/php --ini
Configuration File (php.ini) Path: "/usr/local/lib"
Loaded Configuration File:         "/opt/homebrew/etc/php/8.4/conf.d         "
Scan for additional .ini files in: (none)
Additional .ini files parsed:      (none)
```

Above the whitespace is now visible `/opt/homebrew/etc/php/8.4/conf.d         `.

Close #18390
2025-05-11 14:53:56 +01:00
Jorg Adam Sowa
e11a702c05 ext/hash: tests for md5 and sha1 compatibility (#18525)
Add test cases to check compatibility between the `hash("algo")` and `md5()`/`sha1()` functions.
2025-05-09 13:08:58 +01:00
Tim Düsterhus
73c4e9f0b2 Merge branch 'PHP-8.4'
* PHP-8.4:
  gen_stub: Fix `ce_flags` generation for compatibility mode (#18507)
2025-05-09 13:33:58 +02:00
Tim Düsterhus
84f82d0a1c gen_stub: Fix ce_flags generation for compatibility mode (#18507)
* gen_stub: Fix `ce_flags` generation for compatibility mode

Fixes php/php-src#18506

* gen_stub: Improve output for ce_flags compatibility
2025-05-09 13:33:09 +02:00
Daniel Scherzer
2b0cb760d4 gen_stub: move parseStubFile() into FileInfo
Reduce the number of global functions by moving it to static method
`FileInfo::parseStubFile()`. Additionally, make `FileInfo::handleStatements()`
private now that the only caller is part of the class.
2025-05-08 13:06:51 -07:00
Daniel Scherzer
05dbf0707a gen_stub: further reduce the number of public properties
The following properties are made private:
* `ArgInfo::$phpDocType`
* `ClassInfo::$flags`, `::$attributes`, `::$extends`, `::$implements`
* `FileInfo::$isUndocumentable`

The following are made protected:
* `VariableLike::$flags`
2025-05-08 13:06:51 -07:00
Daniel Scherzer
c89d7a7426 gen_stub: add and use FileInfo::getLegacyVersion()
Separate out the creation of a legacy version of a FileInfo object, which has
information for old versions of PHP discarded, from its subsequent use in
`processStubFile()`.

In the process, make `FileInfo::$legacyArginfoGeneration` private, and inline
the single use of `FileInfo::getAllClassInfos()`, removing that method.
2025-05-08 13:06:51 -07:00
Daniel Scherzer
bb555926c4 gen_stub: deduplicate and simplify DocCommentTag processing
For a lot of the structures, the parsing of doc comment tags is based on if a
specific tag is present, or the value that it has if it is. Add a new helper
method, `DocCommentTag::makeTagMap()`, that turns an array of tag instances
into a map from tag name to value (the last value, if there are multiple uses
of the same tag name). Then, for the simple cases where just a tag's presence
is all that is checked, or just the (last) value is used, check the map instead
of using a loop through all of the tags present.
2025-05-08 13:06:51 -07:00
Daniel Scherzer
d42bac2866 gen_stub: move parseDocComments() into DocCommentTag
Reduce the number of global functions by moving it to static method
`DocCommentTag::parseDocComments()`.
2025-05-08 13:06:51 -07:00
Daniel Scherzer
ce3990c1d3 gen_stub: move handlePreprocessorConditions() into FileInfo()
Reduce the number of global functions by moving it to static method
`FileInfo::handlePreprocessorConditions()`. Since it is only used by
`FileInfo::handleStatements()`, also make it private.
2025-05-08 13:06:51 -07:00
Daniel Scherzer
1c9b6b84df gen_stub: move handleStatements() into FileInfo
Reduce the number of global functions by moving it to instance method
`FileInfo::handleStatements()`.
2025-05-08 13:06:51 -07:00
Daniel Scherzer
ec3ecdc2c8 gen_stub: documentation updates
* Use `@param` instead of `@var` for parameters
* Fix type of `$attributeGroups` in `AttributeInfo::createFromGroups()`
* Remove extra documentation of `$allConstInfo` for
`ClassInfo::getClassSynopsisDocument()`, it is already documented under the
correct name `$allConstInfos`
* Remove unneeded `@throws`
2025-05-08 13:06:51 -07:00
Daniel Scherzer
722eba20ae gen_stub: drop unused parameters
The following parameters were either unused before this commit or became unused
as part of updating callers to stop passing unused parameters to other
functions updated in this commit:
* `FuncInfo::getMethodSynopsisDocument()` - `$funcMap`, `$aliasMap`
* `FuncInfo::getMethodSynopsisElement()` - `$funcMap`, `$aliasMap`
* `ConstInfo::getGlobalConstDeclaration()` - `$allConstInfos`
* `generateMethodSynopses()` - `$aliasMap`
* `replaceMethodSynopses()` - `$aliasMap`
2025-05-08 13:06:51 -07:00
Daniel Scherzer
4861391501 gen_stub: inline some single-use variables 2025-05-08 13:06:51 -07:00
Daniel Scherzer
39a6d6086e gen_stub: move funcInfoToCode() into FuncInfo
Reduce the number of global functions by moving it to instance method
`FuncInfo::toArgInfoCode()`.

In the process, make `FuncInfo::$numRequiredArgs` private.
2025-05-08 13:06:51 -07:00
Daniel Scherzer
b5361d75e0 gen_stub: add ReturnInfo::beginArgInfo()
The vast majority of the decisions about the use of `ZEND_BEGIN_ARG_INFO_EX` or
one of its variations are based on the return information of the function - is
the type builtin, is the return information tentative, does it include an
object mask, etc. Accordingly, move the logic into the `ReturnInfo` class.

The logic is actually moved into two methods, `ReturnInfo::beginArgInfo()`,
which needs to handle the case of tentative returns being used when PHP < 8.1
is supported, and `::beginArgInfoCompatible()`, which can assume that PHP 8.1+
is supported and thus make use of early returns and guard clauses. Further
improvements to the logic will be made in a subsequent commit.

In the process, make `ReturnInfo::$byRef` private.
2025-05-08 13:06:51 -07:00
Daniel Scherzer
24b7c7a365 gen_stub: add ArgInfo::toZendInfo()
Move the logic out of `funcInfoToCode()` and update it. In the process, make
`ArgInfo::getDefaultValueAsArginfoString()` private.
2025-05-08 13:06:51 -07:00
Daniel Scherzer
0d79039027 gen_stub: simplify ArgInfo::getDefaultValueAsMethodSynopsisString()
There is no need to add special handling for the default value of `null`, since
it is not loosely-equals to any of the strings 'UNKNOWN', 'false', 'true', or
'null' it will just be returned directly anyway.
2025-05-08 13:06:51 -07:00
Daniel Scherzer
45d313bbd7 gen_stub: simplify generateVersionDependentFlagCode()
* Return a string rather than an array, all callers just immediately used
`implode()` to join the elements in the array with nothing between them
* In the callers, inline some single-use variables with the template for the
version-dependent code
* Remove the callback to `array_filter` specifying that only items that are not
`empty()` be removed - this is the default behavior
2025-05-08 13:06:51 -07:00
Daniel Scherzer
bfa2b92ca6 gen_stub: add ExposedDocComment::getInitCode()
Deduplicates the setting up of the `zend_string_init_interned()` call, removes
the need for `ExposedDocComment::getLength()` and so that method is removed.
2025-05-08 13:06:51 -07:00
Daniel Scherzer
4527bafad0 gen_stub: break up closing tag in DOMCdataSection
Otherwise GitHub's syntax highlighting treats it as the end of the code and
stops highlighting
2025-05-08 13:06:51 -07:00
Jorg Adam Sowa
c6a9beebff ext/standard/md5: Minor refactorings (#18518)
- Use size_t type instead of int type
- Use false instead of 0
- Remove wrapping comments
2025-05-08 12:00:50 +01:00
Remi Collet
e3715cddf0 Merge branch 'PHP-8.4'
* PHP-8.4:
  bump zip extension version to 1.22.6
2025-05-07 14:24:22 +02:00
Remi Collet
71ffa9596a bump zip extension version to 1.22.6 2025-05-07 14:24:07 +02:00
Niels Dossche
168343d2e8 [RFC] Implement array_first() and array_last() (#18210) 2025-05-07 08:15:50 +02:00
Niels Dossche
50dc301f96 Merge branch 'PHP-8.4'
* PHP-8.4:
  Sync EXTENSIONS and extend maintenance time
2025-05-06 22:07:11 +02:00
Niels Dossche
11ad09e4bf Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Sync EXTENSIONS and extend maintenance time
2025-05-06 22:07:05 +02:00
Niels Dossche
e7a44a68e9 Sync EXTENSIONS and extend maintenance time 2025-05-06 22:06:31 +02:00
Jakub Zelenka
cb4bafa4c0 Init OpenSSL libctx and use it for pkey (#18282) 2025-05-06 20:14:55 +02:00
Ilija Tovilo
905bba637a Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix missing include in win32/globals.c
2025-05-06 15:52:38 +02:00
Ilija Tovilo
14ff4b75a2 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix missing include in win32/globals.c
2025-05-06 15:52:30 +02:00
Ilija Tovilo
69f0882d3b Fix missing include in win32/globals.c
This previously errored with:

win32\globals.c(66): error C2220: the following warning is treated as an error
win32\globals.c(66): warning C4013: 'php_win32_signal_ctrl_handler_request_shutdown' undefined; assuming extern returning int

This only errors on master because of 2473f57ba (thanks to Niels for
that info!).

Closes GH-18508
2025-05-06 15:51:37 +02:00
Niels Dossche
e0b73dc977 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-18494: PDO OCI segfault in statement GC
2025-05-05 19:30:47 +02:00
Niels Dossche
5825a6be83 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-18494: PDO OCI segfault in statement GC
2025-05-05 19:30:42 +02:00
Niels Dossche
dcf9d8f812 Fix GH-18494: PDO OCI segfault in statement GC
This is the same issue that was fixed in 2ae897fff7, but now for OCI.

Closes GH-18495.
2025-05-05 19:30:23 +02:00
Niels Dossche
3c84b01e02 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix leak+crash with sapi_windows_set_ctrl_handler()
2025-05-05 19:14:19 +02:00