1
0
mirror of https://github.com/php/php-src.git synced 2026-04-27 18:23:26 +02:00

6563 Commits

Author SHA1 Message Date
Weilin Du 701d8a66d3 ext/standard: Throw a ValueError when the parameter includes NUL bytes in putenv and getenv (#21817) 2026-04-21 13:37:59 +01:00
Weilin Du 3afd6d3e75 /ext/standard: Check for empty string in linkinfo() (#21793) 2026-04-20 15:57:07 +01:00
Ben Ramsey 7fd4d3aa93 license-update: update phpinfo() license statements
RFC: https://wiki.php.net/rfc/php_license_update
2026-04-11 21:20:54 -05:00
Gina Peter Banyard 9b48fe782d array_change_key_case(): Throw ValueError on invalid argument (#15883) 2026-04-10 11:23:28 +01:00
Arshid d34c09fd32 [skip ci] ext/standard: Fix typo (GH-21671) 2026-04-10 12:05:03 +02:00
Alexandre Daubois 168fef361e Throw ValueError when a wrong flag value is provided to the second argument of scandir() (#19373) 2026-04-10 11:42:17 +02:00
David Carlier 4843327a90 ext/standard: pathinfo() check flags argument validity.
close GH-17859
2026-04-06 20:53:19 +01:00
Weilin Du 25687441a3 ext/standard: add test triggering deprecation when reading $http_response_header via a dynamic fetch
And thus remove the TODO message in zend_compile.c.
2026-04-06 18:21:50 +01:00
Gina Peter Banyard eab1c01b48 ext/standard/tests/filters: add missing CTYPE extension requirement (#21581) 2026-04-02 16:56:12 +01:00
Gina Peter Banyard cd753007ce Audit INI functions and macros, and replace them with better alternatives (#21146)
Audit zend_ini_string(), INI_STR(), and related functions and macros, and all other INI_* macros.

The primary motivation is that these APIs should return a `const char*` because the `char*` is owned by a zend_string, and thus should never be released.

Moreover, the INI_STR() API doesn't follow our usual naming scheme as it returns a char* rather than a zend_string*.

In this PR new zend_ini_{bool|long|double|str|string}_literal() macros are introduced replacing the INI_{BOOL|INT|FLT|STR} macros which follow our more modern naming convention.
Moreover, the INI_BOOL() macro didn't produce correct values if the INI string is a word like "true" or "on".

The INI_ORIG_* APIs are removed because a Sourcegraph search shows 0 results, other than the one case used in ext/tidy that we fix using the typical API.

Add some additional checks for the value of an INI string to ensure it doesn't contain a nul byte when describing a path.
2026-03-30 14:48:12 +01:00
Jakub Zelenka 358d9c54a6 Fix bug #49874: ftell() and fseek() inconsistency when using stream filters (#19981)
Currently filter seeking does not work correctly for most streams. The
idea is to extend API to allow seeking for some streams. There are
couple of cases:

- filter is always seekable - e.g. string.rot13, string.toupper,
  string.tolower
- filter is seekable only when sought to start or when it re-run the
  data from the start (it means when there is some data buffered) -
  this is for pretty much all other filters that keep some state.
- user filters are seekable by default for BC reason but if new
  seek method is implemented, then it is called and based on the
  bool result the seeking either fails or succeed.
2026-03-30 10:27:34 +02:00
ndossche 74fad61607 Add test for array_diff() array maximum
Forgot to commit this in 614b22ab.
2026-03-21 22:58:49 +01:00
Ilija Tovilo 8c42cf473e Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix expected output for bug52820.phpt
2026-03-19 13:19:07 +01:00
Ilija Tovilo f7753608cc Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix expected output for bug52820.phpt
2026-03-19 13:19:01 +01:00
Ilija Tovilo b97dd3318d Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix expected output for bug52820.phpt
2026-03-19 13:18:54 +01:00
Ilija Tovilo 551809576b Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix expected output for bug52820.phpt
2026-03-19 13:18:36 +01:00
Ilija Tovilo b8b5fb074d Fix expected output for bug52820.phpt
Newer versions of curl seem to omit the "Closing connection ..." message. Make
the entire line optional.
2026-03-19 13:15:57 +01:00
Ilija Tovilo 0039af028c Propagate bind error for stream_socket_server()
When stream_socket_server() fails during bind(), we're currently only showing
"Unknown error" in the error message. Properly propagate this error for better
diagnostics.

Closes GH-21328
2026-03-16 08:53:38 +01:00
Ilija Tovilo 92ba1e4ea0 Prevent closing of innerstream of php://temp stream
Fixes GH-21221
Closes GH-21222
2026-03-13 20:34:04 +01:00
Weilin Du da1e89fd3d RFC: Add Form Feed in Trim Functions (#20788)
RFC: https://wiki.php.net/rfc/trim_form_feed

Resolves GH-20783.
2026-03-09 22:28:50 +01:00
Petr Sumbera ce1cadba29 Fix Solaris tests and add nightly CI job
Closes GH-20709
2026-03-04 10:12:03 +01:00
Nora Dossche 84b0a73685 Fix GH-13204: glob() fails if square bracket is in current directory (#19647)
The problem is not limited to square brackets, but to every meta
character. The solution is to override the glob functions for handling
paths with the VCWD ones in PHP. If that is not available, use the old
but limited workaround.
2026-03-03 22:29:07 +01:00
ndossche 4b0a4f47f3 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix GH-20906: Assertion failure when messing up output buffers
2026-02-27 18:15:26 +01:00
ndossche 38421684c1 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-20906: Assertion failure when messing up output buffers
2026-02-27 18:15:20 +01:00
ndossche 1709689256 Fix GH-20906: Assertion failure when messing up output buffers
Closes GH-20908.
2026-02-27 18:14:56 +01:00
Ilija Tovilo 073dcf66bb Merge branch 'PHP-8.5'
* PHP-8.5:
  Add RUN_RESOURCE_HEAVY_TESTS env var
2026-02-27 15:05:28 +01:00
Ilija Tovilo 07e29acbd4 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Add RUN_RESOURCE_HEAVY_TESTS env var
2026-02-27 15:05:21 +01:00
Ilija Tovilo 6f91209260 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Add RUN_RESOURCE_HEAVY_TESTS env var
2026-02-27 15:05:14 +01:00
Ilija Tovilo c6ad84fb9e Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Add RUN_RESOURCE_HEAVY_TESTS env var
2026-02-27 15:04:24 +01:00
Ilija Tovilo 3a57b4ced5 Add RUN_RESOURCE_HEAVY_TESTS env var
Disable resource-heavy tests by default (>1GB of memory usage), unless the
RUN_RESOURCE_HEAVY_TESTS env variable is set.

Fixes GH-20762
Closes GH-20935
2026-02-27 15:00:35 +01:00
Ilija Tovilo 3bf7d9a7d6 Merge branch 'PHP-8.5'
* PHP-8.5:
  Tweak stack limit values for gh20840.phpt
  Tweak stack limit values for gh20583.phpt
2026-02-24 02:11:56 +01:00
Ilija Tovilo 48e318f581 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Tweak stack limit values for gh20840.phpt
  Tweak stack limit values for gh20583.phpt
2026-02-24 02:11:44 +01:00
Ilija Tovilo f07809f495 Tweak stack limit values for gh20840.phpt
Graciously tested by Andy Postnikov (andypost).

See GH-21086
Closes GH-21275
2026-02-24 02:11:19 +01:00
Ilija Tovilo 9a6a841d77 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Tweak stack limit values for gh20583.phpt
2026-02-24 02:11:09 +01:00
Ilija Tovilo 3692a5fa57 Tweak stack limit values for gh20583.phpt
Graciously tested by Andy Postnikov (andypost).

See GH-21086
Closes GH-21274
2026-02-24 02:10:47 +01:00
Jorg Adam Sowa b58087daab test: improve tests for in_array (#21087)
By splitting the massive tests into more specific, smaller tests.
2026-02-23 12:36:38 +00:00
David CARLIER ce798afac3 Fix GH-21058: error_log() crash on null destination argument. (#21064)
we preserve the lower branches behavior by letting php_stream_open_wrapper_ex
handling the null path and propagating the exception.

close GH-21064
2026-01-29 19:49:45 +00:00
Calvin Buckley 4d5b651e90 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix regression with header removal removing whole prefixes (#21020)
2026-01-28 16:50:26 -04:00
Calvin Buckley cd32c597a7 Fix regression with header removal removing whole prefixes (#21020)
* Fix regression with header removing removing whole prefixes

The header removal code looked for the colon for key-value at the wrong
place, so it would overzealously remove headers. Tweak that condition,
and make the alternative condition only active if it's set (with the
remove prefix op case).

Fixes GH-21018.

* avoid reading past the actual length

* Rename variable to be more clear
2026-01-28 16:50:06 -04:00
Jorg Adam Sowa 6d95a2238d ext/standard: validate mode in array_filter() (#15647)
And add the missing ARRAY_FILTER_USE_VALUE for the default case.
2026-01-26 16:02:15 +00:00
Ilija Tovilo 337cb3712d Merge branch 'PHP-8.5'
* PHP-8.5:
  [skip ci] Reduce zend.max_allowed_stack_size in gh20840.phpt
2026-01-21 17:35:56 +01:00
Ilija Tovilo 6c57b4b49a Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  [skip ci] Reduce zend.max_allowed_stack_size in gh20840.phpt
2026-01-21 17:35:49 +01:00
Ilija Tovilo 4367315183 [skip ci] Reduce zend.max_allowed_stack_size in gh20840.phpt
This test still fails on i386 Windows with "Allowed memory size of %d bytes
exhausted" because the output buffer grows too big. My first intuition was to
add a chunk_size to ob_start, but this won't work if the output buffer is
flushed deep into the call stack, causing a premature or just a second stack
limit error. So, reduce the stack size in an attempt to produce less output.
2026-01-21 17:32:01 +01:00
Ilija Tovilo f4728ecc57 [skip ci] Move opcache.opt_debug_level tests to ext/opcache
These tests need to live in ext/opcache, or they will break the file cache job.
2026-01-21 16:53:57 +01:00
Tim Düsterhus a3576bddc5 zend_compile: Optimize array_map() with callable convert callback into foreach (#20934)
* zend_compile: Optimize `array_map()` with callable convert callback into foreach

For:

    <?php

    function plus1($x) {
    	return $x + 1;
    }

    $array = array_fill(0, 100, 1);

    $count = 0;
    for ($i = 0; $i < 100_000; $i++) {
    	$count += count(array_map(plus1(...), $array));
    }

    var_dump($count);

This is ~1.1× faster:

    Benchmark 1: /tmp/test/before -d opcache.enable_cli=1 /tmp/test/test6.php
      Time (mean ± σ):     172.2 ms ±   0.5 ms    [User: 167.8 ms, System: 4.2 ms]
      Range (min … max):   171.6 ms … 173.1 ms    17 runs

    Benchmark 2: /tmp/test/after -d opcache.enable_cli=1 /tmp/test/test6.php
      Time (mean ± σ):     155.1 ms ±   1.3 ms    [User: 150.6 ms, System: 4.2 ms]
      Range (min … max):   154.2 ms … 159.3 ms    18 runs

    Summary
      /tmp/test/after -d opcache.enable_cli=1 /tmp/test/test6.php ran
        1.11 ± 0.01 times faster than /tmp/test/before -d opcache.enable_cli=1 /tmp/test/test6.php

With JIT it becomes ~1.7× faster:

    Benchmark 1: /tmp/test/before -d opcache.enable_cli=1 -d opcache.jit=tracing /tmp/test/test6.php
      Time (mean ± σ):     166.9 ms ±   0.6 ms    [User: 162.7 ms, System: 4.1 ms]
      Range (min … max):   166.1 ms … 167.9 ms    17 runs

    Benchmark 2: /tmp/test/after -d opcache.enable_cli=1 -d opcache.jit=tracing /tmp/test/test6.php
      Time (mean ± σ):      94.5 ms ±   2.7 ms    [User: 90.4 ms, System: 3.9 ms]
      Range (min … max):    92.5 ms … 103.1 ms    31 runs

    Summary
      /tmp/test/after -d opcache.enable_cli=1 -d opcache.jit=tracing /tmp/test/test6.php ran
        1.77 ± 0.05 times faster than /tmp/test/before -d opcache.enable_cli=1 -d opcache.jit=tracing /tmp/test/test6.php

* zend_compile: Skip `assert(...)` callbacks for array_map() optimization

* zend_compile: Remove `zend_eval_const_expr()` in array_map optimization

* zend_vm_def: Check simple types without loading the arginfo in ZEND_TYPE_ASSERT

* zend_vm_def: Handle references for ZEND_TYPE_ASSERT

* zend_compile: Fix handling of constant arrays for `array_map()`

* zend_compile: Fix leak of unused result in array_map() optimization

* zend_compile: Support static methods for `array_map()` optimization

* UPGRADING
2026-01-19 10:18:24 +01:00
Ilija Tovilo a7fc4fda08 Merge branch 'PHP-8.5'
* PHP-8.5:
  Avoid huge output in gh20840.phpt
2026-01-16 13:04:27 +01:00
Ilija Tovilo 5fb8165e4e Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Avoid huge output in gh20840.phpt
2026-01-16 13:04:18 +01:00
Ilija Tovilo 462fcad419 Avoid huge output in gh20840.phpt
This can trigger the memory limit in run-tests.php, which buffers the tests
output. Instead, only output "nesting level too deep" and discard the rest.

Closes GH-20946
2026-01-16 13:03:53 +01:00
Niels Dossche 4e76b9a145 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix bug52820 test for new libcurl release
2026-01-12 18:48:03 +01:00
Niels Dossche acad49cace Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix bug52820 test for new libcurl release
2026-01-12 18:47:57 +01:00