Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: php/php-src
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: php-8.3.17
Choose a base ref
...
head repository: php/php-src
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: php-8.3.18
Choose a head ref
Loading
Showing with 2,930 additions and 408 deletions.
  1. +0 −5 .github/scripts/windows/build_task.bat
  2. +2 −0 .github/scripts/windows/test_task.bat
  3. +1 −1 .github/workflows/nightly.yml
  4. +23 −0 .github/workflows/windows-builds.yml
  5. +5 −0 .gitignore
  6. +101 −5 NEWS
  7. +17 −0 Zend/tests/gh_17718_001.phpt
  8. +17 −0 Zend/tests/gh_17718_002.phpt
  9. +24 −0 Zend/tests/gh_17728.phpt
  10. +26 −0 Zend/tests/ghsa-rwp7-7vc6-8477_001.phpt
  11. +24 −0 Zend/tests/ghsa-rwp7-7vc6-8477_002.phpt
  12. +22 −0 Zend/tests/ghsa-rwp7-7vc6-8477_003.phpt
  13. +42 −0 Zend/tests/match/049.phpt
  14. +71 −0 Zend/tests/stack_limit/stack_limit_015.phpt
  15. +1 −1 Zend/zend.h
  16. +4 −0 Zend/zend_compile.c
  17. +1 −1 Zend/zend_execute.c
  18. +11 −3 Zend/zend_object_handlers.c
  19. +8 −0 Zend/zend_opcode.c
  20. +14 −4 Zend/zend_operators.h
  21. +1 −1 configure.ac
  22. +3 −3 ext/bcmath/bcmath.c
  23. +2 −0 ext/bcmath/libbcmath/src/bcmath.h
  24. +7 −0 ext/bcmath/libbcmath/src/init.c
  25. +10 −0 ext/bcmath/tests/gh17398.phpt
  26. +6 −2 ext/curl/config.w32
  27. +3 −3 ext/curl/tests/curl_basic_022.phpt
  28. +7 −58 ext/dom/document.c
  29. +49 −0 ext/dom/tests/gh17847.phpt
  30. +60 −0 ext/dom/tests/ghsa-p3x9-6h7p-cgfc_001.phpt
  31. +60 −0 ext/dom/tests/ghsa-p3x9-6h7p-cgfc_002.phpt
  32. +60 −0 ext/dom/tests/ghsa-p3x9-6h7p-cgfc_003.phpt
  33. +3 −1 ext/ffi/ffi.g
  34. +3 −1 ext/ffi/ffi_parser.c
  35. +33 −0 ext/ffi/tests/ptr_declaration_list.phpt
  36. +5 −1 ext/gd/libgd/gd.c
  37. +6 −0 ext/gd/tests/bug22544-mb.phpt
  38. +6 −0 ext/gd/tests/bug22544.phpt
  39. +3 −1 ext/gd/tests/bug24155.phpt
  40. +6 −0 ext/gd/tests/bug27582_1.phpt
  41. +0 −4 ext/gd/tests/bug39366.phpt
  42. +3 −0 ext/gd/tests/bug39780_extern.phpt
  43. +3 −0 ext/gd/tests/bug43073.phpt
  44. +3 −0 ext/gd/tests/bug43475.phpt
  45. +3 −0 ext/gd/tests/bug43828.phpt
  46. +6 −0 ext/gd/tests/bug45799.phpt
  47. +3 −0 ext/gd/tests/bug47946.phpt
  48. +3 −0 ext/gd/tests/bug48732-mb.phpt
  49. +4 −0 ext/gd/tests/bug48732.phpt
  50. +3 −1 ext/gd/tests/bug50194.phpt
  51. +3 −0 ext/gd/tests/bug51498.phpt
  52. +6 −0 ext/gd/tests/bug52070.phpt
  53. +3 −0 ext/gd/tests/bug53504.phpt
  54. +3 −0 ext/gd/tests/bug64641.phpt
  55. +6 −0 ext/gd/tests/bug66005.phpt
  56. +6 −0 ext/gd/tests/bug72482_2.phpt
  57. +6 −0 ext/gd/tests/bug72604.phpt
  58. +6 −0 ext/gd/tests/bug72913.phpt
  59. +6 −0 ext/gd/tests/bug73213.phpt
  60. +6 −0 ext/gd/tests/bug73272.phpt
  61. +6 −0 ext/gd/tests/bug73549.phpt
  62. +3 −0 ext/gd/tests/bug73614.phpt
  63. +6 −0 ext/gd/tests/bug74031.phpt
  64. +3 −0 ext/gd/tests/bug75124.phpt
  65. +6 −0 ext/gd/tests/bug77943.phpt
  66. +3 −0 ext/gd/tests/bug79945.phpt
  67. +4 −0 ext/gd/tests/gh17373.phpt
  68. +28 −0 ext/gd/tests/gh17772.phpt
  69. +6 −0 ext/gd/tests/imagearc_basic.phpt
  70. +6 −0 ext/gd/tests/imagearc_variation1.phpt
  71. +6 −0 ext/gd/tests/imagearc_variation2.phpt
  72. +6 −0 ext/gd/tests/imagechar_basic.phpt
  73. +6 −0 ext/gd/tests/imagecharup_basic.phpt
  74. +3 −0 ext/gd/tests/imagecolorallocatealpha_basic.phpt
  75. +6 −0 ext/gd/tests/imagecolorset_basic.phpt
  76. +6 −0 ext/gd/tests/imageconvolution_basic.phpt
  77. +6 −0 ext/gd/tests/imagecopyresampled_basic.phpt
  78. +3 −0 ext/gd/tests/imagecreatefrombmp_basic.phpt
  79. +3 −0 ext/gd/tests/imagecreatefromstring_bmp.phpt
  80. +3 −0 ext/gd/tests/imagecreatefromtga_basic.phpt
  81. +3 −0 ext/gd/tests/imagecreatefromtga_variation.phpt
  82. +3 −0 ext/gd/tests/imagecreatetruecolor_basic.phpt
  83. +3 −0 ext/gd/tests/imagecrop_auto.phpt
  84. +3 −0 ext/gd/tests/imagedashedline_basic.phpt
  85. +6 −0 ext/gd/tests/imageellipse_basic.phpt
  86. +3 −0 ext/gd/tests/imagefilledarc_basic.phpt
  87. +3 −0 ext/gd/tests/imagefilledarc_variation1.phpt
  88. +3 −0 ext/gd/tests/imagefilledarc_variation2.phpt
  89. +6 −0 ext/gd/tests/imagefilledellipse_basic.phpt
  90. +3 −0 ext/gd/tests/imagefilledpolygon_basic.phpt
  91. +6 −0 ext/gd/tests/imagefilltoborder_basic.phpt
  92. +4 −1 ext/gd/tests/imagefilter.phpt
  93. +3 −0 ext/gd/tests/imagegammacorrect_basic.phpt
  94. +3 −0 ext/gd/tests/imagegammacorrect_variation1.phpt
  95. +6 −0 ext/gd/tests/imagegammacorrect_variation2.phpt
  96. +6 −0 ext/gd/tests/imageopenpolygon_basic.phpt
  97. +6 −0 ext/gd/tests/imagepolygon_aa.phpt
  98. +3 −0 ext/gd/tests/imagepolygon_basic.phpt
  99. +6 −0 ext/gd/tests/imagerectangle_basic.phpt
  100. +6 −0 ext/gd/tests/imageresolution_png.phpt
  101. +0 −6 ext/gd/tests/imagerotate_overflow.phpt
  102. +6 −0 ext/gd/tests/imagesetbrush_basic.phpt
  103. +3 −0 ext/gd/tests/imagesetthickness_basic.phpt
  104. +6 −0 ext/gd/tests/imagestring_basic.phpt
  105. +6 −0 ext/gd/tests/imagestringup_basic.phpt
  106. +3 −0 ext/gd/tests/imagetruecolortopalette_basic.phpt
  107. +3 −0 ext/gd/tests/libgd00086_extern.phpt
  108. +6 −0 ext/gd/tests/test_image_equals_file_palette.phpt
  109. +2 −2 ext/intl/tests/timezone_IDforWindowsID_basic2.phpt
  110. +1 −1 ext/ldap/ldap.c
  111. +24 −0 ext/ldap/tests/gh17704.phpt
  112. +43 −32 ext/libxml/libxml.c
  113. +2 −1 ext/mbstring/mbstring.c
  114. +11 −0 ext/mbstring/tests/gh17503.phpt
  115. +6 −1 ext/opcache/ZendAccelerator.c
  116. +15 −8 ext/opcache/jit/zend_jit_arm64.dasc
  117. +15 −6 ext/opcache/jit/zend_jit_trace.c
  118. +14 −8 ext/opcache/jit/zend_jit_x86.dasc
  119. +27 −0 ext/opcache/tests/jit/gh17577.phpt
  120. +38 −0 ext/opcache/tests/jit/gh17654.phpt
  121. +1 −1 ext/pdo_sqlite/sqlite_statement.c
  122. +14 −0 ext/pdo_sqlite/tests/gh17837.phpt
  123. +13 −2 ext/phar/phar_object.c
  124. +22 −0 ext/phar/tests/gh17808.phpt
  125. +6 −0 ext/phar/tests/zip/033.phpt
  126. +12 −5 ext/reflection/php_reflection.c
  127. +37 −0 ext/reflection/tests/gh15902/ReflectionClass-callable.phpt
  128. +38 −0 ext/reflection/tests/gh15902/ReflectionClass-class.phpt
  129. +20 −0 ext/reflection/tests/gh15902/ReflectionProperty-callable.phpt
  130. +20 −0 ext/reflection/tests/gh15902/ReflectionProperty-class.phpt
  131. +3 −1 ext/sqlite3/sqlite3.c
  132. +21 −0 ext/sqlite3/tests/setauthorizer_cycle_leak.phpt
  133. +12 −0 ext/standard/filestat.c
  134. +312 −129 ext/standard/http_fopen_wrapper.c
  135. +19 −0 ext/standard/tests/file/bug72666_variation1.phpt
  136. +35 −0 ext/standard/tests/file/bug72666_variation2.phpt
  137. +35 −0 ext/standard/tests/file/bug72666_variation3.phpt
  138. +26 −0 ext/standard/tests/file/bug72666_variation4.phpt
  139. +4 −4 ext/standard/tests/file/readfile_variation9.phpt
  140. +1 −1 ext/standard/tests/file/rename_variation-win32.phpt
  141. +2 −2 ext/standard/tests/file/unlink_variation8-win32.phpt
  142. +2 −2 ext/standard/tests/file/unlink_variation9-win32.phpt
  143. +1 −1 ext/standard/tests/filters/gh13264.phpt
  144. +13 −9 ext/standard/tests/http/bug47021.phpt
  145. +1 −3 ext/standard/tests/http/bug75535.phpt
  146. +58 −0 ext/standard/tests/http/ghsa-52jp-hrpf-2jff-001.phpt
  147. +55 −0 ext/standard/tests/http/ghsa-52jp-hrpf-2jff-002.phpt
  148. +65 −0 ext/standard/tests/http/ghsa-hgf5-96fm-v528-001.phpt
  149. +62 −0 ext/standard/tests/http/ghsa-hgf5-96fm-v528-002.phpt
  150. +64 −0 ext/standard/tests/http/ghsa-hgf5-96fm-v528-003.phpt
  151. +51 −0 ext/standard/tests/http/ghsa-pcmh-g36c-qc44-001.phpt
  152. +51 −0 ext/standard/tests/http/ghsa-pcmh-g36c-qc44-002.phpt
  153. +49 −0 ext/standard/tests/http/ghsa-v8xr-gpvj-cx9g-001.phpt
  154. +51 −0 ext/standard/tests/http/ghsa-v8xr-gpvj-cx9g-002.phpt
  155. +49 −0 ext/standard/tests/http/ghsa-v8xr-gpvj-cx9g-003.phpt
  156. +48 −0 ext/standard/tests/http/ghsa-v8xr-gpvj-cx9g-004.phpt
  157. +48 −0 ext/standard/tests/http/ghsa-v8xr-gpvj-cx9g-005.phpt
  158. +0 −30 ext/standard/tests/http/http_response_header_05.phpt
  159. +2 −0 ext/standard/tests/network/bug20134.phpt
  160. +35 −0 ext/standard/tests/streams/gh17650.phpt
  161. +1 −1 ext/standard/user_filters.c
  162. +42 −0 ext/xml/tests/toffset_bounds.phpt
  163. +8 −4 ext/xml/xml.c
  164. +32 −0 ext/zend_test/tests/gh17797.phpt
  165. +35 −0 ext/zend_test/tests/gh17899.phpt
  166. +20 −0 ext/zlib/tests/gh17745.phpt
  167. +20 −0 ext/zlib/tests/leak_invalid_encoding_with_dict.phpt
  168. +14 −8 ext/zlib/zlib.c
  169. +2 −2 ext/zlib/zlib.stub.php
  170. +3 −3 ext/zlib/zlib_arginfo.h
  171. +40 −9 ext/zlib/zlib_fopen_wrapper.c
  172. +7 −1 main/fopen_wrappers.c
  173. +4 −4 main/php_version.h
  174. +27 −4 main/streams/plain_wrapper.c
  175. +13 −11 main/streams/streams.c
  176. +7 −5 sapi/fpm/fpm/fpm_main.c
  177. +1 −1 sapi/fpm/tests/fcgi-env-pif-apache-pp-sn-strip-encoded-plus.phpt
  178. +1 −1 sapi/fpm/tests/fcgi-env-pif-apache-pp-sn-strip-encoded.phpt
  179. +3 −2 sapi/phpdbg/phpdbg_lexer.l
  180. +3 −0 sapi/phpdbg/phpdbg_prompt.c
  181. +24 −0 sapi/phpdbg/tests/register_function_leak.phpt
  182. +1 −0 win32/build/phpize.js.in
5 changes: 0 additions & 5 deletions .github/scripts/windows/build_task.bat
Original file line number Diff line number Diff line change
@@ -5,11 +5,6 @@ if /i "%GITHUB_ACTIONS%" neq "True" (
exit /b 3
)

del /f /q C:\Windows\System32\libcrypto-1_1-x64.dll >NUL 2>NUL
if %errorlevel% neq 0 exit /b 3
del /f /q C:\Windows\System32\libssl-1_1-x64.dll >NUL 2>NUL
if %errorlevel% neq 0 exit /b 3

call %~dp0find-target-branch.bat
set STABILITY=staging
set DEPS_DIR=%PHP_BUILD_CACHE_BASE_DIR%\deps-%BRANCH%-%PHP_SDK_VS%-%PHP_SDK_ARCH%
2 changes: 2 additions & 0 deletions .github/scripts/windows/test_task.bat
Original file line number Diff line number Diff line change
@@ -137,6 +137,8 @@ for %%i in (ldap oci8_12c pdo_oci) do (

set TEST_PHPDBG_EXECUTABLE=%PHP_BUILD_DIR%\phpdbg.exe

copy /-y %DEPS_DIR%\bin\*.dll %PHP_BUILD_DIR%\*

mkdir c:\tests_tmp

nmake test TESTS="%OPCACHE_OPTS% -g FAIL,BORK,LEAK,XLEAK --no-progress -q --offline --show-diff --show-slow 1000 --set-timeout 120 --temp-source c:\tests_tmp --temp-target c:\tests_tmp --bless %PARALLEL%"
2 changes: 1 addition & 1 deletion .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -520,7 +520,7 @@ jobs:
- name: Test Laravel
if: ${{ !cancelled() }}
run: |
git clone https://github.com/laravel/framework.git --branch=master --depth=1
git clone https://github.com/laravel/framework.git --depth=1
cd framework
git rev-parse HEAD
php /usr/bin/composer install --no-progress --ignore-platform-reqs
23 changes: 23 additions & 0 deletions .github/workflows/windows-builds.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Windows builds
run-name: Windows builds for ${{ inputs.tag || github.ref_name }}
on:
push:
tags:
- 'php-*'
workflow_dispatch:
inputs:
tag:
description: 'Tag version'
required: true

jobs:
publish:
runs-on: ubuntu-latest
name: Build
steps:
- name: Build
env:
GITHUB_TOKEN: ${{ secrets.WINDOWS_BUILDS_TOKEN }}
run: |
TAG="${{ inputs.tag || github.ref_name }}"
gh workflow run php.yml -R php/php-windows-builder -f php-version="${TAG#php-}"
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -291,6 +291,11 @@ tmp-php.ini
/junit.out.xml
/.ccache/

# ------------------------------------------------------------------------------
# Additional test build files
# ------------------------------------------------------------------------------
/ext/standard/tests/helpers/bad_cmd.exe

# ------------------------------------------------------------------------------
# Special cases to invert previous ignore patterns
# ------------------------------------------------------------------------------
106 changes: 101 additions & 5 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,6 +1,102 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? ????, PHP 8.3.17
13 Mar 2025, PHP 8.3.18

- BCMath:
. Fixed bug GH-17398 (bcmul memory leak). (SakiTakamachi)

- Core:
. Fixed bug GH-17623 (Broken stack overflow detection for variable
compilation). (ilutov)
. Fixed bug GH-17618 (UnhandledMatchError does not take
zend.exception_ignore_args=1 into account). (timwolla)
. Fix fallback paths in fast_long_{add,sub}_function. (nielsdos)
. Fixed bug GH-17718 (Calling static methods on an interface that has
`__callStatic` is allowed). (timwolla)
. Fixed bug GH-17797 (zend_test_compile_string crash on invalid
script path). (David Carlier)
. Fixed GHSA-rwp7-7vc6-8477 (Reference counting in php_request_shutdown
causes Use-After-Free). (CVE-2024-11235) (ilutov)

- DOM:
. Fixed bug GH-17847 (xinclude destroys live node). (nielsdos)

- FFI:
. Fix FFI Parsing of Pointer Declaration Lists. (davnotdev)

- FPM:
. Fixed bug GH-17643 (FPM with httpd ProxyPass encoded PATH_INFO env).
(Jakub Zelenka)

- GD:
. Fixed bug GH-17772 (imagepalettetotruecolor crash with memory_limit=2M).
(David Carlier)

- LDAP:
. Fixed bug GH-17704 (ldap_search fails when $attributes contains a
non-packed array with numerical keys). (nielsdos, 7u83)

- LibXML:
. Fixed GHSA-wg4p-4hqh-c3g9 (Reocurrence of #72714). (nielsdos)
. Fixed GHSA-p3x9-6h7p-cgfc (libxml streams use wrong `content-type` header
when requesting a redirected resource). (CVE-2025-1219) (timwolla)

- MBString:
. Fixed bug GH-17503 (Undefined float conversion in mb_convert_variables).
(cmb)

- Opcache:
. Fixed bug GH-17654 (Multiple classes using same trait causes function
JIT crash). (nielsdos)
. Fixed bug GH-17577 (JIT packed type guard crash). (nielsdos, Dmitry)
. Fixed bug GH-17899 (zend_test_compile_string with invalid path
when opcache is enabled). (David Carlier)
. Fixed bug GH-17868 (Cannot allocate memory with tracing JIT). (nielsdos)

- PDO_SQLite:
. Fixed GH-17837 ()::getColumnMeta() on unexecuted statement segfaults).
(cmb)
. Fix cycle leak in sqlite3 setAuthorizer(). (nielsdos)

- Phar:
. Fixed bug GH-17808: PharFileInfo refcount bug. (nielsdos)

- PHPDBG:
. Partially fixed bug GH-17387 (Trivial crash in phpdbg lexer). (nielsdos)
. Fix memory leak in phpdbg calling registered function. (nielsdos)

- Reflection:
. Fixed bug GH-15902 (Core dumped in ext/reflection/php_reflection.c).
(DanielEScherzer)

- Standard:
. Fixed bug #72666 (stat cache clearing inconsistent between file:// paths
and plain paths). (Jakub Zelenka)

- Streams:
. Fixed bug GH-17650 (realloc with size 0 in user_filters.c). (nielsdos)
. Fix memory leak on overflow in _php_stream_scandir(). (nielsdos)
. Fixed GHSA-hgf54-96fm-v528 (Stream HTTP wrapper header check might omit
basic auth header). (CVE-2025-1736) (Jakub Zelenka)
. Fixed GHSA-52jp-hrpf-2jff (Stream HTTP wrapper truncate redirect location
to 1024 bytes). (CVE-2025-1861) (Jakub Zelenka)
. Fixed GHSA-pcmh-g36c-qc44 (Streams HTTP wrapper does not fail for headers
without colon). (CVE-2025-1734) (Jakub Zelenka)
. Fixed GHSA-v8xr-gpvj-cx9g (Header parser of `http` stream wrapper does not
handle folded headers). (CVE-2025-1217) (Jakub Zelenka)

- Windows:
. Fixed phpize for Windows 11 (24H2). (bwoebi)
. Fixed GH-17855 (CURL_STATICLIB flag set even if linked with shared lib).
(cmb)

- Zlib:
. Fixed bug GH-17745 (zlib extension incorrectly handles object arguments).
(nielsdos)
. Fix memory leak when encoding check fails. (nielsdos)
. Fix zlib support for large files. (nielsdos)

13 Feb 2025, PHP 8.3.17

- Core:
. Fixed bug GH-16892 (ini_parse_quantity() fails to parse inputs starting
@@ -76,7 +172,7 @@ PHP NEWS
. Fixed bug GH-17139 (Fix zip_entry_name() crash on invalid entry).
(nielsdos)

02 Jan 2025, PHP 8.3.16RC1
02 Jan 2025, PHP 8.3.16

- Core:
. Fixed bug GH-17106 (ZEND_MATCH_ERROR misoptimization). (ilutov)
@@ -275,7 +371,7 @@ PHP NEWS
- Windows:
. Fixed bug GH-16849 (Error dialog causes process to hang). (cmb)

07 Nov 2024, PHP 8.3.14RC1
07 Nov 2024, PHP 8.3.14

- CLI:
. Fixed bug GH-16373 (Shebang is not skipped for router script in cli-server
@@ -1028,7 +1124,7 @@ PHP NEWS
- Treewide:
. Fix gcc-14 Wcalloc-transposed-args warnings. (Cristian Rodríguez)

28 Mar 2024, PHP 8.3.5RC1
28 Mar 2024, PHP 8.3.5

- Core:
. Fixed GH-13569 (GC buffer unnecessarily grows up to GC_MAX_BUF_SIZE when
@@ -1297,7 +1393,7 @@ PHP NEWS
. Fixed bug GH-12980 (tidynode.props.attribute is missing
"Boolean Attributes" and empty attributes). (nielsdos)

07 Dec 2023, PHP 8.3.1RC1
07 Dec 2023, PHP 8.3.1

- Core:
. Fixed bug GH-12758 / GH-12768 (Invalid opline in OOM handlers within
17 changes: 17 additions & 0 deletions Zend/tests/gh_17718_001.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
--TEST--
GH-17718: Disallow calling abstract `__callStatic()` trampoline on an interface
--FILE--
<?php

interface Foo {
public static function __callStatic($method, $args);
}

Foo::bar();

?>
--EXPECTF--
Fatal error: Uncaught Error: Cannot call abstract method Foo::bar() in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
17 changes: 17 additions & 0 deletions Zend/tests/gh_17718_002.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
--TEST--
GH-17718: Disallow calling abstract `__callStatic()` trampoline on an abstract class
--FILE--
<?php

abstract class Foo {
abstract public static function __callStatic($method, $args);
}

Foo::bar();

?>
--EXPECTF--
Fatal error: Uncaught Error: Cannot call abstract method Foo::bar() in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
24 changes: 24 additions & 0 deletions Zend/tests/gh_17728.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
--TEST--
GH-17728: Assertion failure when calling static method of trait with `__callStatic()` with throwing error handler
--FILE--
<?php

set_error_handler(function (int $errno, string $errstr, string $errfile, int $errline) {
throw new \ErrorException($errstr, 0, $errno, $errfile, $errline);
});

trait Foo {
public static function __callStatic($method, $args) {
var_dump($method);
}
}

try {
Foo::bar();
} catch (ErrorException $e) {
echo $e->getMessage(), PHP_EOL;
}

?>
--EXPECT--
Calling static trait method Foo::bar is deprecated, it should only be called on a class using the trait
26 changes: 26 additions & 0 deletions Zend/tests/ghsa-rwp7-7vc6-8477_001.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
--TEST--
GHSA-rwp7-7vc6-8477: Use-after-free for ??= due to incorrect live-range calculation
--FILE--
<?php

class Foo {
public function foo() {
return $this;
}

public function __set($name, $value) {
throw new Exception('Hello');
}
}

$foo = new Foo();

try {
$foo->foo()->baz ??= 1;
} catch (Exception $e) {
echo $e->getMessage();
}

?>
--EXPECT--
Hello
24 changes: 24 additions & 0 deletions Zend/tests/ghsa-rwp7-7vc6-8477_002.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
--TEST--
GHSA-rwp7-7vc6-8477: Use-after-free for ??= due to incorrect live-range calculation
--FILE--
<?php

class Foo {
public int $prop;

public function foo() {
return $this;
}
}

$foo = new Foo();

try {
$foo->foo()->prop ??= 'foo';
} catch (Error $e) {
echo $e->getMessage();
}

?>
--EXPECT--
Cannot assign string to property Foo::$prop of type int
22 changes: 22 additions & 0 deletions Zend/tests/ghsa-rwp7-7vc6-8477_003.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
--TEST--
GHSA-rwp7-7vc6-8477: Use-after-free for ??= due to incorrect live-range calculation
--FILE--
<?php

class Foo {
public int $prop;
}

function newFoo() {
return new Foo();
}

try {
newFoo()->prop ??= 'foo';
} catch (Error $e) {
echo $e->getMessage();
}

?>
--EXPECT--
Cannot assign string to property Foo::$prop of type int
42 changes: 42 additions & 0 deletions Zend/tests/match/049.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
--TEST--
Match expression error messages (zend.exception_ignore_args=1)
--INI--
zend.exception_ignore_args=1
--FILE--
<?php

class Beep {}

function test(mixed $var) {
try {
match($var) {};
} catch (UnhandledMatchError $e) {
print $e->getMessage() . PHP_EOL;
}
}

test(null);
test(1);
test(5.5);
test(5.0);
test("foo");
test(true);
test(false);
test([1, 2, 3]);
test(new Beep());
// Testing long strings.
test(str_repeat('e', 100));
test(str_repeat("e\n", 100));
?>
--EXPECT--
Unhandled match case of type null
Unhandled match case of type int
Unhandled match case of type float
Unhandled match case of type float
Unhandled match case of type string
Unhandled match case of type bool
Unhandled match case of type bool
Unhandled match case of type array
Unhandled match case of type Beep
Unhandled match case of type string
Unhandled match case of type string
Loading