1
0
mirror of https://github.com/php/php-src.git synced 2026-03-25 08:42:29 +01:00
Commit Graph

131895 Commits

Author SHA1 Message Date
Jakub Zelenka
7de83e2736 Merge branch 'PHP-8.2' 2023-04-07 12:29:46 +01:00
Jakub Zelenka
0b4f2fc9e8 Merge branch 'PHP-8.1' into PHP-8.2 2023-04-07 12:29:23 +01:00
Jakub Zelenka
ebb3213f79 Add FPM FCGI env Apache handler UDS test 2023-04-07 12:28:42 +01:00
Niels Dossche
ede8adb2e2 Fix GH-11016: Heap buffer overflow in ZEND_ADD_ARRAY_UNPACK_SPEC_HANDLER (#11021)
Not enough space was reserved for the packed resulting array because of
some confusion in the meaning of nr of used slots vs nr of elements.

Co-authored-by: Ilija Tovilo <ilija.tovilo@me.com>
2023-04-06 21:55:11 +02:00
Niels Dossche
2ef1930ad3 Fix number of elements after packed hash filling (#11022)
After a hash filling routine the number of elements are set to the fill
index. However, if the fill index is larger than the number of elements,
the number of elements are no longer correct. This is observable at
least via count() and var_dump(). E.g. the attached test case would
incorrectly show int(17) instead of int(11).

Solve this by only increasing the number of elements by the actual
number that got added. Instead of adding a variable that increments per
iteration, I wanted to save some cycles in the iteration and simply
compute the number of added elements at the end.

I discovered this behaviour while fixing GH-11016, where this filling
routine is easily exposed to userland via a specialised VM path [1].
Since this seems to be more a general problem with the macros, and may
be triggered outside of the VM handlers, I fixed it in the macros
instead of modifying the VM to fixup the number of elements.

[1] b2c5acbb01/Zend/zend_vm_def.h (L6132-L6141)
2023-04-06 21:54:59 +02:00
Jakub Zelenka
f17cf2ed63 Merge branch 'PHP-8.2' 2023-04-06 16:01:13 +01:00
Jakub Zelenka
1ca1858f31 Merge branch 'PHP-8.1' into PHP-8.2 2023-04-06 16:00:48 +01:00
Jakub Zelenka
15802dfc62 Add FPM FastCGI env var test for Apache without path info fix 2023-04-06 15:59:34 +01:00
George Peter Banyard
7d93ef067f Convert char* + size_t parameters to zend_string* in phar_find_in_include_path() 2023-04-06 14:56:42 +01:00
George Peter Banyard
8e51cfe0ae Use zend_string_concat helper instead of strpprintf 2023-04-06 14:56:42 +01:00
George Peter Banyard
06896d1c45 Improve locality of stream variable 2023-04-06 14:56:42 +01:00
George Peter Banyard
96ffdd492c size variable is only used once, move closer to usage
Also change type to ssize_t as this is what the function returns
2023-04-06 14:56:42 +01:00
George Peter Banyard
3fb63f7fa2 Extract common code for phar IO intercept functions
Also convert filename to a zend_string*.

This in preparation for refactoring phar_find_in_include_path() to use a zend_string*
2023-04-06 14:56:42 +01:00
George Peter Banyard
1c276aacae Use zend_call_known_instance_method() instead of building FCI/FCC in serializer subroutine (#9955)
Co-authored-by: Tyson Andre <tyson.andre@uwaterloo.ca>
2023-04-06 14:49:29 +01:00
Ilija Tovilo
9a250cc9d6 Add separate static property through trait if parent already declares it
Fixes GH-10935
Closes GH-10937
2023-04-06 14:27:24 +02:00
Niels Dossche
ebf86d284e Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix GH-9397: exif read : warnings and errors : Potentially invalid endianess, Illegal IFD size and Undefined index
2023-04-05 21:41:41 +02:00
Niels Dossche
2d2cf3b6e0 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-9397: exif read : warnings and errors : Potentially invalid endianess, Illegal IFD size and Undefined index
2023-04-05 21:37:48 +02:00
Niels Dossche
b81ce297a1 Fix GH-9397: exif read : warnings and errors : Potentially invalid endianess, Illegal IFD size and Undefined index
Don't misinterpret DJI info maker note as DJI maker note.

The DJI and DJI info maker note both share the "DJI" make string.
This caused the current code to try to interpret the DJI info maker note
as a DJI maker note. However, the DJI info maker note requires custom
parsing. Therefore, the misinterpretation actually caused the current
code to believe that there was an unrecoverable error in the IFD for the
maker note by returning false in the maker note parser. This in turn
caused the inability to parse other EXIF metadata.

This patch adds the identification of the DJI info maker note so that it
cannot be misinterpreted. Since we don't implement custom parsing, it
achieves this by setting the tag list to a special marker value (in this
case the NULL pointer). When this marker value is detected, the function
will just skip parsing the maker note and return true. Therefore, the
other code will believe that the IFD is not corrupt.

This approach is similar to handing an unrecognised maker note type
(see the loop on top of exif_process_IFD_in_MAKERNOTE() which also
returns true and treats it as a string). The end result of this patch
is that the DJI info maker note is considered as unknown to the caller of
exif_process_IFD_in_MAKERNOTE(), and therefore that the other EXIF
metadata can be parsed successfully.

Also fix debug output typos in exif.

Closes GH-10470.
2023-04-05 21:35:19 +02:00
Ilija Tovilo
b2c5acbb01 [skip ci] Add NEWS entry for GH-10168 and GH-10582 2023-04-05 11:24:06 +02:00
Dmitry Stogov
c796ce5713 Re-add GC_DTOR and GC_DTOR_NO_REF 2023-04-04 22:51:26 +03:00
Dmitry Stogov
d5484bf115 Remove includes 2023-04-04 22:48:26 +03:00
Dmitry Stogov
706a9b2a39 Revert "Zend/zend_types.h: move zend_result to separate header (#10609)"
This reverts commit 3bce116069.
2023-04-04 22:48:26 +03:00
Dmitry Stogov
c9d728cbd6 Revert "Zend/zend_types.h: move zend_rc_debug to zend_rc_debug.h"
This reverts commit d6e95041e2.
2023-04-04 22:48:26 +03:00
Dmitry Stogov
59905d8fc5 Revert "Zend/zend_rc_debug: convert ZEND_RC_MOD_CHECK() to function"
This reverts commit e509a66a9c.
2023-04-04 22:48:26 +03:00
Dmitry Stogov
0e70693701 Revert "Zend/zend_types.h: move IS_* to zend_type_code.h"
This reverts commit 0270a1e54c.
2023-04-04 22:48:26 +03:00
Dmitry Stogov
4f724accf8 Revert "Zend/zend_type_code.h: convert to enum"
This reverts commit b98f18e7c3.
2023-04-04 22:48:26 +03:00
Dmitry Stogov
e2f0ce9e06 Revert "Zend/zend_types.h: move zend_refcounted to zend_refcounted.h"
This reverts commit eb34c28fed.
2023-04-04 22:48:23 +03:00
Dmitry Stogov
61b19ba3f0 Revert "Zend/zend_types.h: move zend_uchar.h to zend_char.h"
This reverts commit 42577c6b6b.
2023-04-04 22:47:45 +03:00
Dmitry Stogov
ac3abe4579 Revert "Zend/zend_types.h: move zend_string to zend_string.h"
This reverts commit 02690fe3c0.
2023-04-04 22:47:45 +03:00
Ilija Tovilo
3528ca8930 Add note for GH-10168 to UPGRADING.INTERNALS 2023-04-04 18:58:01 +02:00
Dmitry Stogov
e1c6fb76c0 JIT support for delayed destructor for zend_assign_to_typed_ref/prop 2023-04-04 18:55:47 +02:00
Ilija Tovilo
fdbea4f39e Add GC_DTOR/GC_DTOR_NO_REF macros 2023-04-04 18:55:47 +02:00
Dmitry Stogov
24acb4f134 Delay destructor for zend_std_write_property 2023-04-04 18:55:47 +02:00
Ilija Tovilo
b39107c774 Delay destructor for zend_assign_to_typed_ref 2023-04-04 18:55:47 +02:00
Ilija Tovilo
f43fa59171 Add various tests for GH-10168 2023-04-04 18:55:47 +02:00
Dmitry Stogov
915b2837f7 Delay freeing of overwritten values in assignments
Fixes GH-10168
2023-04-04 18:55:46 +02:00
Joan Miquel
9e8614233c Add ngx-php to opcache supported sapis (#11013)
This SAPI embed PHP in Nginx server.
https://github.com/rryqszq4/ngx-php

And in the Techempower benchmarks, it's the fastest PHP SAPI.
https://www.techempower.com/benchmarks/#section=data-r20
2023-04-04 16:58:59 +02:00
Tony Su
bf123da562 [Zend]: Fix unnecessary alignment in ZEND_CALL_FRAME_SLOT macro (#10988)
Alignment is not necessary while calculating slots reserved for
zend_execute_data and _zend_vm_stack.

ZEND_STATIC_ASSERT ensures the correct alignment while code
compilation. Credit is to Ilija Tovilo.

PR: https://github.com/php/php-src/pull/10988

Signed-off-by: Tony Su <tao.su@intel.com>
Reviewed-by  : Ilija Tovilo
Reviewed-by  : Dmitry Stogov
Reviewed-by  : Niels Dossche
2023-04-04 12:09:38 +02:00
Niels Dossche
44b1619370 Cleanup pubkey checks in ext/phar (#11009)
These checks are always true because we bail out early if pubkey is
NULL or empty.
But by having these checks, it makes the code more confusing because it
implies pubkey can be false, while it can in fact not.
2023-04-04 10:04:59 +02:00
Máté Kocsis
f42992f580 Remove name field from the zend_constant struct (#10954)
As global constant names are case-sensitive now, we don't have to store them separately above the constant table.
2023-04-03 22:13:47 +02:00
Máté Kocsis
0a169cbd5b Add forgotten upgrading note for the Readonly amendments RFC 2023-04-03 22:07:36 +02:00
Niels Dossche
fb5e77b636 Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix incorrect error handling in dom_zvals_to_fragment()
2023-04-03 21:32:23 +02:00
Niels Dossche
94a00e9ecd Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix incorrect error handling in dom_zvals_to_fragment()
2023-04-03 21:24:58 +02:00
Niels Dossche
0579beb842 Fix incorrect error handling in dom_zvals_to_fragment()
Discovered this pre-existing problem while testing GH-10682.
Note: this problem existed *before* that PR.

* Not all paths throw a hierarchy request error
* xmlFreeNode must be used instead of xmlFree for the fragment to also
  free its children.
* Free up nodes that couldn't be added when xmlAddChild fails.

I unified the error handling code that's exactly the same with a goto to
prevent at least some of such problems in the future.

Closes GH-10981.
2023-04-03 21:21:35 +02:00
Ilija Tovilo
ce47e59467 Merge branch 'PHP-8.2'
* PHP-8.2:
  [skip ci] Notify Slack on nightly failure
2023-04-03 17:22:27 +02:00
Ilija Tovilo
aeb32bb357 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  [skip ci] Notify Slack on nightly failure
2023-04-03 17:21:34 +02:00
Ilija Tovilo
3a21a87443 [skip ci] Notify Slack on nightly failure 2023-04-03 17:21:12 +02:00
Dmitry Stogov
9a8123142e Merge branch 'PHP-8.2'
* PHP-8.2:
  Tracing JIT: Fixed incorrect code generation fofr SEND-ing of result of ASSIGN to typed reference
2023-04-03 18:15:59 +03:00
Dmitry Stogov
962aac698e Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Tracing JIT: Fixed incorrect code generation fofr SEND-ing of result of ASSIGN to typed reference
2023-04-03 18:15:46 +03:00
Dmitry Stogov
8a749c79d0 Tracing JIT: Fixed incorrect code generation fofr SEND-ing of result of ASSIGN to typed reference 2023-04-03 18:15:41 +03:00