1
0
mirror of https://github.com/php/php-src.git synced 2026-04-22 15:38:49 +02:00
Commit Graph

408 Commits

Author SHA1 Message Date
Dmitry Stogov 87cf05e8be Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix type inference
2022-07-25 15:55:15 +03:00
Dmitry Stogov d50875c822 Fix type inference
Fixes oss-fuzz #49423 and #49474
2022-07-25 15:53:06 +03:00
Ilija Tovilo d4a9cc8856 Fix rc info of iterator_to_array (#9080)
This function can now return a copy of the provided array, resulting in
a value of RC != 1.
2022-07-21 15:05:34 +02:00
Go Kudo 4d8dd8d258 Implement Random Extension
https://wiki.php.net/rfc/rng_extension
https://wiki.php.net/rfc/random_extension_improvement
2022-07-19 10:27:38 +01:00
Dmitry Stogov 71814e9d99 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix type inference
2022-07-18 14:20:41 +03:00
Dmitry Stogov 82d3ad64df Fix type inference
Fixes oss-fuzz #48908
2022-07-18 14:20:06 +03:00
Dmitry Stogov 26d890e6ba Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix type inference for FETCH_DI_UNSET
2022-07-18 13:15:12 +03:00
Dmitry Stogov b734d45626 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix type inference for FETCH_DI_UNSET
2022-07-18 13:15:03 +03:00
Ilija Tovilo 63912b5ecd Fix RC func info of str_split (#9016)
Introduced in GH-8945

With RETURN_EMPTY_ARRAY this function can now return an interned array which
has refcount 2.
2022-07-15 11:23:55 +02:00
George Peter Banyard f905590764 Add support for Disjoint Normal Form (DNF) types (#8725)
RFC: https://wiki.php.net/rfc/dnf_types

This allows to combine union and intersection types together in the following form (A&B)|(X&Y)|T but not of the form (X|A)&(Y|B) or (X|A)&(Y|B)|T.

* Improve union type parsing

Co-authored-by: Sara Golemon <pollita@php.net>
2022-07-08 11:30:23 +01:00
Dmitry Stogov fa75bd0785 Fix incorrect constant propagation for VERIFY_RETURN_TYPE
This fixes oss-fuzz #48104
2022-06-20 11:30:07 +03:00
Dmitry Stogov 3d4a55fea1 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix memory leak
2022-06-20 11:00:41 +03:00
Dmitry Stogov ee17296e7b Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix memory leak
2022-06-20 11:00:32 +03:00
Máté Kocsis 49d3dde211 Declare true return types (#8759) 2022-06-18 22:06:50 +02:00
Dmitry Stogov 20a902749a Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix type inference
2022-06-14 12:00:26 +03:00
Dmitry Stogov 729be469ae Fix type inference
This dixes oss-fuzz #47921
2022-06-14 11:59:35 +03:00
Dmitry Stogov f56371bdd3 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix type inference
2022-06-14 10:21:24 +03:00
Dmitry Stogov 1b45efb6fb Fix type inference
This fixes oss-fuzz #47920
2022-06-14 10:20:45 +03:00
Pierrick Charron bbc0c4c5c8 Regen missing Zend/Optimizer/zend_func_infos.h 2022-06-13 09:49:41 -04:00
Ilija Tovilo 5a855ee8d6 Fix GH-8661: Nullsafe in coalesce triggers undefined variable warning
Closes GH-8690
2022-06-12 21:52:14 +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 3de1613b98 Regenerate optimizer function info 2022-06-01 16:09:57 +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
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
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
Dmitry Stogov 462d00f548 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix memory leak
2022-05-16 13:48:51 +03:00
Dmitry Stogov c430116a11 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix memory leak
2022-05-16 13:48:40 +03:00
Dmitry Stogov adc8155119 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix type inference
2022-05-16 12:42:14 +03:00
Dmitry Stogov aad5fbac85 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix type inference
2022-05-16 12:42:04 +03:00
Arnaud Le Blanc 298c1ab92e Merge branch 'PHP-8.1' 2022-05-13 12:48:51 +02:00
Arnaud Le Blanc 332bd03782 Do not optimize out ini_get() when the entry does not exist during compilation (#8507)
The entry may exist later if dl is enabled

Fixes GH-8466
2022-05-13 12:35:00 +02:00
Dmitry Stogov 89fa77516c Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix type inference
2022-05-11 12:40:16 +03:00
Dmitry Stogov 84c1e99ecf Fix type inference
This fizes oss-fuzz #47044
2022-05-11 12:39:26 +03:00
Dmitry Stogov 2495459e50 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix type inference
2022-05-11 12:10:00 +03:00
Dmitry Stogov f1fc58ed8d Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix type inference
2022-05-11 12:09:53 +03:00
Dmitry Stogov 27efd125ed Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix ISSET_ISEMPTY_VAR missoptimization
2022-04-25 13:31:40 +03:00
Dmitry Stogov 948ef10dd0 Fix ISSET_ISEMPTY_VAR missoptimization
This fixes oss-fuzz #46909
2022-04-25 13:31:01 +03:00
Dmitry Stogov 73514d6e4f Merge branch 'PHP-8.1'
* PHP-8.1:
  Reorder optimization passes to avoid miss-optimization
2022-04-25 13:12:03 +03:00
Dmitry Stogov 1aa5e9392d Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Reorder optimization passes to avoid miss-optimization
2022-04-25 13:09:31 +03:00
Dmitry Stogov 992c8061b4 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix type inference
2022-04-25 12:17:17 +03:00
Dmitry Stogov e14dc15e13 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix type inference
2022-04-25 12:17:07 +03:00
Dmitry Stogov 9e6eb9d5a5 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix type narrowing warning during type inference of ZEND_FETCH_DIM_W
2022-04-25 11:18:37 +03:00
Dmitry Stogov 2cff0e674d Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix type narrowing warning during type inference of ZEND_FETCH_DIM_W
2022-04-25 11:17:04 +03:00
Nikita Popov 1254aa4f3e Avoid setting ce for ref return_info
This is unlikely to matter in practice (due to short lifetime),
but necessary to satisfy the SSA integrity check.

Fixes oss-fuzz #46980.
2022-04-24 17:35:51 +02:00