1
0
mirror of https://github.com/php/php-src.git synced 2026-04-24 08:28:26 +02:00
Commit Graph

17734 Commits

Author SHA1 Message Date
Ilija Tovilo 5a855ee8d6 Fix GH-8661: Nullsafe in coalesce triggers undefined variable warning
Closes GH-8690
2022-06-12 21:52:14 +02:00
Ilija Tovilo 3f7ec69b61 Collapse more generated files in PRs (#8754)
* The generated VM files
* tokenizer_data.c
2022-06-12 10:56:35 +02:00
Jakub Zelenka a6387fa383 Merge branch 'PHP-8.1' 2022-06-09 19:57:08 +01:00
Jakub Zelenka 976cbba76e Merge branch 'PHP-8.0' into PHP-8.1 2022-06-09 19:55:46 +01:00
Jakub Zelenka b765d4cd41 Fix bug #50293 and #81713: file path checking in OpenSSL functions
It introduces a single function to check file paths passed to OpenSSL
functions. It expands the path, check null bytes and finally does
an open basedir check.
2022-06-09 19:49:59 +01:00
Ilija Tovilo c019421912 Fix regression from GH-8587 (#8615)
* Fix regression from GH-8587

Streams hold a reference to the stream wrapper. User stream wrappers
must not be released until the streams themselves are closed.

* Add test for directories
2022-06-09 13:49:41 +02:00
Bob Weinand 34208bfd81 Merge branch 'PHP-8.1' 2022-06-09 13:30:57 +02:00
Nicolas Grekas 96e3a9d316 Fix RC=1 references of declared properties when casting objects to arrays
Fixes GH-8655.
Closes GH-8737.
2022-06-09 13:28:12 +02:00
Max Kellermann c1a06704da Add ZEND_THREEWAY_COMPARE() macro to fix casting underflowed unsigned to signed (#8220)
Casting a huge unsigned value to signed is implementation-defined
behavior in C.  By introducing the ZEND_THREEWAY_COMPARE() macro, we
can sidestep this integer overflow/underflow/casting problem.
2022-06-08 13:24:18 +01:00
Joe Rowell 89688b115d Add function exposing HAVE_GCC_GLOBAL_REGS (#8359) 2022-06-08 12:32:30 +01:00
Ilija Tovilo 120b4f7ae6 Remove code duplication in zend_std_compare_objects (#8710) 2022-06-07 18:07:26 +02:00
George Peter Banyard b40ae80804 Convert iterable into an internal alias for Traversable|array (#7309)
This does a compile time transformation of ``iterable`` into ``Traversable|array`` which simplifies some of the LSP variance handling.

The arginfo generation script from stubs is updated to produce a union type when it encounters the type ``iterable``
Extension functions which do not regenerate the arginfo, or write them manually are still supported by mimicking the compile time transformation while registering the function.

Type Reflection is preserved for single ``iterable`` (and ``?iterable``) to produce a ReflectionNamedType with name ``iterable``, however usage of ``iterable`` in union types will be converted to ``array|Traversable``
2022-06-07 13:35:34 +01:00
Dmitry Stogov faf3410957 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix type inference
2022-06-06 11:14:33 +03:00
Dmitry Stogov b86c6245cc Fix type inference
This fixes oss-fuzz #47777
2022-06-06 11:13:53 +03:00
Máté Kocsis debd38f851 Add support for sensitive parameters in stubs 2022-06-04 18:15:05 +02:00
Tim Düsterhus 49951165f0 Add zend_mark_function_parameter_as_sensitive() 2022-06-04 18:15:05 +02:00
Levi Morrison 280fd680c8 Make vm_interrupt and timed_out atomic (#8327)
This is done by adding a new zend_atomic_bool type. The type
definition is only available for compiler alignment and size info; it
should be treated as opaque and only the zend_atomic_bool_* family of
functions should be used.

Note that directly using atomic_bool is complicated. All C++ compilers
stdlibs that I checked typedef atomic_bool to std::atomic<bool>, which
can't be used in an extern "C" section, and there's at least one usage
of this in core, and probably more outside of it.

So, instead use platform specific functions, preferring compiler
intrinsics.
2022-06-01 09:43:25 -06:00
Máté Kocsis 3de1613b98 Regenerate optimizer function info 2022-06-01 16:09:57 +02:00
Sara Golemon 6c0a1db4a8 Merge branch 'PHP-8.1'
* PHP-8.1:
  Verify internal types before abandoning call frame
2022-06-01 00:52:30 +00:00
Sara Golemon 01d84545e7 Verify internal types before abandoning call frame
An internal caller executing a builtin method with
a static return type will lose context if we drop
our frame before performing the validation.
2022-06-01 00:51:08 +00:00
George Peter Banyard d08451b2ca Replace php_stdint.h header with standard headers (#8613) 2022-05-29 11:20:56 +01:00
Ilija Tovilo d62d50b88e Add C API for getting backed enum case by value
Closes GH-8518
2022-05-28 12:08:10 +02:00
Ilija Tovilo df2414a223 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix Enum::from/tryFrom memory leak in JIT for internal enums
2022-05-28 10:53:27 +02:00
Ilija Tovilo 93fc88e808 Fix Enum::from/tryFrom memory leak in JIT for internal enums
when passing an int to a string enum. Previously, the int was coerced to
a string. The JIT skips parameter clean up when unnecessary. In this
particular case, passing int to from(int|string) normally doesn't cause
a coercion so no dtor for the $value zval is generated.

To circumvent this we avoid coersion by explicitly allowing ints and
converting them to strings ourselves. Then we can free it appropriately.

See GH-8518
Closes GH-8633
2022-05-28 10:51:17 +02:00
George Peter Banyard 8685a7f03c Remove custom alloca() (#8513)
* Use arena in DCE instead of multiple alloca()
  This requires passing the optimizer context

* Use our do_alloca() instead of alloca()

* Use emalloc in DEBUG builds instead of stack allocations for do_alloca()
  This helps detecting that we correctly free do_alloca()
2022-05-27 09:05:33 +01:00
Ben Ramsey 0f5d9302be Merge branch 'PHP-8.1' 2022-05-25 15:30:24 -05:00
Chen 040a37d3f1 Add IBT support for fiber
Indirect Branch Tracking (IBT) is part of Intel's Control-Flow
Enforcement Technology (CET). IBT is hardware based, forward edge
Control-Flow-Integrity mechanism where any indirect CALL/JMP must target
an ENDBR instruction or suffer #CP.

This commit adds IBT support for fiber:
1. Add endbr32/64 in assembly
2. Inform compiler jump_fcontext may return via indirect branch

Furthermore:
gcc support CET since v8.1 and set it to default since gcc 11. That is,
the ELF header of sapi/cli/php has a property named IBT. However, such
property is lost since PHP8.1 because the assembly introduced by Fiber.
This commit also fixes this.

Closes GH-8339

Signed-off-by: Chen, Hu <hu1.chen@intel.com>
Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>
2022-05-25 13:42:31 -05:00
Máté Kocsis 84cd2a9047 Add some stub related todo comments 2022-05-25 13:24:11 +02:00
Bob Weinand b4285e5546 Ensure vm_spec_handlers exists for all opcodes <= 255 so that user defined higher opcodes do not read outside buffer
This largely has no effect in practice, but ASAN will complain then.
2022-05-25 11:28:34 +02:00
Patrick Allaert 3b6ee1eb19 Bump for 8.1.8-dev 2022-05-25 00:54:00 +02:00
Sara Golemon e05897fe5e Bump for 8.0.21 2022-05-24 18:51:01 +00:00
Arnaud Le Blanc e883407083 Merge branch 'PHP-8.1'
* PHP-8.1:
  Disable zend_rc_debug during dtor of dl()'ed module (#8606)
2022-05-24 19:23:48 +02:00
Arnaud Le Blanc 6cda01a05c Disable zend_rc_debug during dtor of dl()'ed module (#8606)
Newly added dl() tests trigger an assertion in ZEND_RC_DEBUG builds. This change
disables zend_rc_debug to allows these tests to pass until this issue is
resolved.
2022-05-24 19:22:55 +02:00
Levi Morrison b63df3ce0e Stop copying zend_module_entry (#8551)
I did some historical digging and could not figure out why a copy is
made. Additionally, the copy was not using the `.size` member, so it
was probably wrong, but it's been that way for quite some time.
2022-05-24 09:13:38 -06:00
Dmitry Stogov f135ed9a8a Fix memory leak
This fixes oss-fuzz #47527
2022-05-23 13:33:20 +03:00
Máté Kocsis a3f8bb33cd Remove special case for the error message of static properties in readonly classes 2022-05-23 09:44:40 +02:00
Máté Kocsis 14da1cb909 Add support for class constants in stubs (#7434) 2022-05-22 22:27:23 +02:00
Michael Voříšek dfb68fe03f Remove XFAIL from sibling method call test 2022-05-22 21:51:42 +02:00
George Peter Banyard 2ecd46f48f Initialise zend_stat_t to fix MSAN build 2022-05-22 16:06:27 +01:00
Nikita Popov cc506a81e1 Used string with biased hash for double deduplication
Rather than using a separate hash table for doubles, use the same
biases hash approach we use for everything else. Either way works
fine, but there doesn't seem to be any strong reason to use a
different approach for doubles than we use for other cases.
2022-05-21 21:58:06 +02:00
Nikita Popov 83e0a5d2a7 Assert no unrelated literals where unsupported
In the interest of being defensive.

Also drop an unnecessary check for a value that cannot be null.
2022-05-21 21:17:09 +02:00
Ilija Tovilo a5a89cc222 Fix stream_wrapper_unregister() resource leak
Closes GH-8548
Closes GH-8587
2022-05-21 18:49:43 +02:00
Nikita Popov 82ab848daf Remove separate valid_T set
Rather than keeping track of a separate valid_T set (which must
always be in sync with map_T), use a dummy value in map_T to
denote unallocated temporaries.
2022-05-21 18:10:42 +02:00
Nikita Popov ae1132b01a Remove unused temporaries from taken map
If the result has no uses we need to allocate it when visiting the
defining instruction. However, we should still go through the
logic to remove the temporary from the taken map afterwards,
as the temporary can still be reused prior to the defining
instruction.
2022-05-21 18:01:37 +02:00
Nikita Popov 517c01b79b Don't classify literals during compaction
This seems to be a leftover from when we were storing cache slots
inside literals and had to prevent merging of literals with
incompatible cache slots. Nowadays the LITERAL_* classification
is not actually used for anything, we're only interested in the
number of related literals.
2022-05-21 17:36:46 +02:00
Nikita Popov 8a37f6b96f Allow compacting LITERAL_VALUE with related literals
Nowadays we include the content of all the related literals in the
cache key, so DECLARE_CLASS (where both literals cannot be derived
from each other) no longer needs this special case.
2022-05-21 17:24:11 +02:00
Arnaud Le Blanc 96838129ea Panic with abort() (#8590) 2022-05-21 15:07:00 +02:00
Derick Rethans 852e6b957b Merge branch 'PHP-8.1' 2022-05-20 10:52:58 +01:00
Derick Rethans 9a195054cc Merge branch 'PHP-8.0' into PHP-8.1 2022-05-20 10:52:54 +01:00
Derick Rethans c06e1abbaa Emit EXT_STMT for each 'elseif' clause 2022-05-20 10:51:58 +01:00