Commit graph

552 commits

Author SHA1 Message Date
Dmitry Stogov
8c9b5996be Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fixed type inference
2023-12-01 17:09:09 +03:00
Dmitry Stogov
1e55c97601 Fixed type inference
Fixes oss-fuzz #64577, #64579, #64589
2023-12-01 17:08:16 +03:00
Dmitry Stogov
64851873da Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fixed GH-8251: Narrowing occurred during type inference of ZEND_FETCH_DIM_W
2023-11-28 23:33:45 +03:00
Dmitry Stogov
423a1e586e Fixed GH-8251: Narrowing occurred during type inference of ZEND_FETCH_DIM_W 2023-11-28 22:49:39 +03:00
Alex Dowad
31d43164e8 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Return value of mb_get_info can be NULL
2023-11-27 21:13:21 +02:00
Alex Dowad
d8ef868b92 Return value of mb_get_info can be NULL
This has been the case at least since PHP 5.4. Thanks to Girgias for
pointing it out.

It appears that there are several global variables internal to mbstring
which can be queried via mb_get_info() and which could be NULL, but
at the very least, we know that "mbstring.http_input" is one of them.
2023-11-27 20:53:37 +02:00
Dmitry Stogov
9717e9fd56 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fixed empty array inference
2023-11-08 22:04:09 +03:00
Dmitry Stogov
5a77870492 Fixed empty array inference 2023-11-08 22:03:42 +03:00
Ilija Tovilo
cb1e842929
Fix inference of COPY_TMP
Since GH-11592 COPY_TMP may receive and thus define references. Unfortunately,
the name COPY_TMP is no longer accurate.

Closes GH-12619
2023-11-07 12:02:45 +01:00
Dmitry Stogov
86f71e51d4 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Remove spaces
2023-11-03 10:58:32 +03:00
Dmitry Stogov
7e5fb564d6 Remove spaces 2023-11-03 10:58:20 +03:00
Dmitry Stogov
4ee72a8dda Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Backport fix for HASH/PACKED array inference through MAY_BE_ARRAY_EMPTY flag (#12591)
2023-11-03 10:55:33 +03:00
Dmitry Stogov
6bf4041398 Backport fix for HASH/PACKED array inference through MAY_BE_ARRAY_EMPTY flag (#12591)
* Fixed HASH/PACKED array inference through MAY_BE_ARRAY_EMPTY flag

This fixes GH-12527

* typo
2023-11-03 10:54:57 +03:00
Dmitry Stogov
22735b3ff5 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fixed GH-10008: Narrowing occurred during type inference of ZEND_ADD_ARRAY_ELEMENT
  ext/intl: change when the locale is invalid for the 8.1/8.2 serie.
2023-11-02 08:15:50 +03:00
Dmitry Stogov
177a6f5d8a Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fixed GH-10008: Narrowing occurred during type inference of ZEND_ADD_ARRAY_ELEMENT
2023-11-02 08:11:00 +03:00
Dmitry Stogov
798b9d097b Fixed GH-10008: Narrowing occurred during type inference of ZEND_ADD_ARRAY_ELEMENT 2023-11-02 08:09:29 +03:00
Dmitry Stogov
916fa73d80 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fixed inorrect QM_ASSIGN elimination
2023-11-01 09:55:37 +03:00
Dmitry Stogov
125dbb2c03 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fixed inorrect QM_ASSIGN elimination
2023-11-01 09:55:28 +03:00
Dmitry Stogov
19dfe05f16 Fixed inorrect QM_ASSIGN elimination
Fixes oss-fuzz #63771
2023-11-01 09:54:58 +03:00
Dmitry Stogov
76112a15ae Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Backport implementation of iterative Pearce's SCC finding algoritm (#12528)
2023-10-31 09:59:47 +03:00
Dmitry Stogov
00352429ca Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Backport implementation of iterative Pearce's SCC finding algoritm (#12528)
2023-10-31 09:59:31 +03:00
Dmitry Stogov
52bb39e661 Backport implementation of iterative Pearce's SCC finding algoritm (#12528)
Fixes GH-11795
2023-10-31 09:54:44 +03:00
Dmitry Stogov
586b2f8645 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fixed GH-12511: Use must be in next opline assertion with patched infection
2023-10-31 07:52:46 +03:00
Dmitry Stogov
14b36c8583 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fixed GH-12511: Use must be in next opline assertion with patched infection
2023-10-31 07:52:38 +03:00
Dmitry Stogov
b3b46a44c5 Fixed GH-12511: Use must be in next opline assertion with patched infection 2023-10-31 07:51:36 +03:00
Dmitry Stogov
e52d617934 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fixed GH-12509: JIT assertion when running php-parser tests
2023-10-26 23:59:12 +03:00
Dmitry Stogov
770c1b0361 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fixed GH-12509: JIT assertion when running php-parser tests
2023-10-26 23:59:03 +03:00
Dmitry Stogov
5f46d86955 Fixed GH-12509: JIT assertion when running php-parser tests 2023-10-26 23:58:29 +03:00
Dmitry Stogov
574b0573ac Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fixed incorrect type inference
2023-10-24 18:49:18 +03:00
Dmitry Stogov
7320f33f7f Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fixed incorrect type inference
2023-10-24 18:48:58 +03:00
Dmitry Stogov
aa45df4849 Fixed incorrect type inference 2023-10-24 18:48:29 +03:00
Dmitry Stogov
9bfdb4cf4b Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fixed GH-12262: Tracing JIT assertion crash when using phpstan
2023-10-03 13:25:36 +03:00
Dmitry Stogov
101bd1b199 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fixed GH-12262: Tracing JIT assertion crash when using phpstan
2023-10-03 13:25:22 +03:00
Dmitry Stogov
54452b4811 Fixed GH-12262: Tracing JIT assertion crash when using phpstan 2023-10-03 13:22:33 +03:00
Niels Dossche
04a2a42f2a Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Revert "Fix GH-10008: Narrowing occurred during type inference of ZEND_ADD_ARRAY_ELEMENT"
2023-09-30 01:27:29 +02:00
Niels Dossche
0f5b382528 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Revert "Fix GH-10008: Narrowing occurred during type inference of ZEND_ADD_ARRAY_ELEMENT"
2023-09-30 01:27:06 +02:00
Niels Dossche
643c4ba417 Revert "Fix GH-10008: Narrowing occurred during type inference of ZEND_ADD_ARRAY_ELEMENT"
Although it passes CI on 8.1, it causes CI failures in the JIT on 8.2 and
higher.
See 1726922500

This reverts commit e72fc12058.
2023-09-30 01:25:48 +02:00
Niels Dossche
fa2d556fcd Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-10008: Narrowing occurred during type inference of ZEND_ADD_ARRAY_ELEMENT
  Fix type error on XSLTProcessor::transformToDoc return value with SimpleXML
2023-09-30 00:11:31 +02:00
Niels Dossche
d7a7309b53 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-10008: Narrowing occurred during type inference of ZEND_ADD_ARRAY_ELEMENT
  Fix type error on XSLTProcessor::transformToDoc return value with SimpleXML
2023-09-30 00:10:35 +02:00
Niels Dossche
e72fc12058 Fix GH-10008: Narrowing occurred during type inference of ZEND_ADD_ARRAY_ELEMENT
This test triggers narrowing for two ops: first ZEND_ADD_ARRAY_ELEMENT,
and then ZEND_ASSIGN.

The type inference happens in the following order:
1) The ZEND_ADD_ARRAY_ELEMENT infers type 0x40e04080 (packed flag is set),
   arr_type=0 at this point because it hasn't been set by ZEND_INIT_ARRAY yet.
2) The ZEND_INIT_ARRAY infers type 0x40804080
3) The ZEND_ADD_ARRAY_ELEMENT infers type 0x40e04080, arr_type=0x40804080,
   which does not have the packed flag set while the existing result of
   ZEND_ADD_ARRAY_ELEMENT has the packed flag set.

This seems to occur because of the phi node introduced by the while
loop. If I remove the loop the problem goes away.

As Arnaud noted, this seems to be caused by a too wide type inference
for arr_type==0. We should keep the invariant that if x>=y then
key_type(x) >= key_type(y).
If we write the possible results down in a table we get:

```
arr_type           resulting key type
---------------    --------------------------------------------------------------------------
HASH_ONLY	-> MAY_BE_ARRAY_NUMERIC_HASH
PACKED_ONLY	-> MAY_BE_ARRAY_NUMERIC_HASH | MAY_BE_ARRAY_PACKED (== MAY_BE_ARRAY_KEY_LONG)
HASH || PACKED	-> MAY_BE_ARRAY_NUMERIC_HASH | MAY_BE_ARRAY_PACKED (== MAY_BE_ARRAY_KEY_LONG)
0		-> MAY_BE_ARRAY_NUMERIC_HASH | MAY_BE_ARRAY_PACKED (== MAY_BE_ARRAY_KEY_LONG)
```

As we can see, `HASH_ONLY > 0` but
`MAY_BE_ARRAY_NUMERIC_HASH < MAY_BE_ARRAY_NUMERIC_HASH | MAY_BE_ARRAY_PACKED`,
which violates the invariant.
Instead if we modify the zero case to have MAY_BE_ARRAY_NUMERIC_HASH instead,
we get the following table which satisfies the invariant.

```
arr_type           resulting key type
---------------    --------------------------------------------------------------------------
HASH_ONLY	-> MAY_BE_ARRAY_NUMERIC_HASH
PACKED_ONLY	-> MAY_BE_ARRAY_NUMERIC_HASH | MAY_BE_ARRAY_PACKED (== MAY_BE_ARRAY_KEY_LONG)
HASH || PACKED	-> MAY_BE_ARRAY_NUMERIC_HASH | MAY_BE_ARRAY_PACKED (== MAY_BE_ARRAY_KEY_LONG)
0		-> MAY_BE_ARRAY_NUMERIC_HASH
```

Broke in 1ffbb73.
Closes GH-10294.
2023-09-30 00:08:32 +02:00
Ilija Tovilo
c2bb9bc0df
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix zend_separate_if_call_and_write for FUNC_ARGs
2023-09-07 14:26:09 +02:00
Ilija Tovilo
fa9cef8b47
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix zend_separate_if_call_and_write for FUNC_ARGs
2023-09-07 14:25:43 +02:00
Ilija Tovilo
748adf18fc
Fix zend_separate_if_call_and_write for FUNC_ARGs
Fixes GH-12102
Closees GH-12140
2023-09-07 14:25:11 +02:00
Dmitry Stogov
79a8cf1b96 Merge branch 'PHP-8.2'
* PHP-8.2:
  Fixed incorrect QM_ASSIGN elimination
2023-07-31 14:51:14 +03:00
Dmitry Stogov
91dc3e15e9 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fixed incorrect QM_ASSIGN elimination
2023-07-31 14:51:06 +03:00
Dmitry Stogov
b5f8a7270a Fixed incorrect QM_ASSIGN elimination
Fixes OSS Fuzz #60895
2023-07-31 14:50:13 +03:00
Dmitry Stogov
869ecf5320 Merge branch 'PHP-8.2'
* PHP-8.2:
  Fixed incorrect QM_ASSIGN elimination
2023-07-24 15:45:28 +03:00
Dmitry Stogov
d6a795b935 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fixed incorrect QM_ASSIGN elimination
2023-07-24 15:43:21 +03:00
Dmitry Stogov
9fc0eab4b4 Fixed incorrect QM_ASSIGN elimination
Fixes OSS Fuzz #60735
2023-07-24 15:42:30 +03:00
Ilija Tovilo
0b0cec5b8a
Fix clang warning
has_range_constraint should can be a bool, remove unused visited field.

Closes GH-11729
2023-07-18 00:49:13 +02:00