Skip to content
forked from php/php-src

sync #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 198 commits into from
Dec 6, 2021
Merged

sync #12

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
198 commits
Select commit Hold shift + click to select a range
d3f073e
Remove useless check
dstogov Nov 22, 2021
60fe575
Fix #75725: ./configure: detecting RAND_egd
dilyanpalauzov Nov 19, 2021
b29e85a
Merge branch 'PHP-7.4' into PHP-8.0
cmb69 Nov 22, 2021
db5ac35
Merge branch 'PHP-8.0' into PHP-8.1
cmb69 Nov 22, 2021
41d2785
Merge branch 'PHP-8.1'
cmb69 Nov 22, 2021
5eead6d
Update bundled boost asm to latest versions
trowski Nov 23, 2021
fdd9e0e
Merge branch 'PHP-8.1'
trowski Nov 23, 2021
ae5498c
Fixed typo
dstogov Nov 23, 2021
96da461
Fix for bug in file handling refactor.
jlbprof Nov 16, 2021
435a5ac
Add FPM test for php_admin_value doc_root usage
bukka Nov 20, 2021
7cbf4bd
Merge branch 'PHP-8.1'
nikic Nov 23, 2021
d312a0c
[ci skip] We use multiple CI providers, not only Travis
cmb69 Nov 23, 2021
067df26
Use memrchr() when available
dstogov Nov 24, 2021
108bd44
Add pdo_sqlite tests for empty filename and in-memory uri (#7662)
othercorey Nov 24, 2021
ef2fd0e
fix [-Wstrict-prototypes] buid warnings
remicollet Nov 24, 2021
bc9d604
Merge branch 'PHP-8.1'
remicollet Nov 24, 2021
be271f2
Fix bug #81652
nikic Nov 24, 2021
51ae5c5
Merge branch 'PHP-8.0' into PHP-8.1
nikic Nov 24, 2021
71b2f46
Merge branch 'PHP-8.1'
nikic Nov 24, 2021
7738d8d
Drop unused GD defines
cmb69 Nov 24, 2021
2439661
Use the standard _WIN32 instead of the custom MSWIN32 in libgd
cmb69 Nov 24, 2021
9237055
"Export" relevant GD macros
cmb69 Nov 24, 2021
a2c0ffb
Merge branch 'PHP-8.0' into PHP-8.1
cmb69 Nov 24, 2021
885f935
Merge branch 'PHP-8.1'
cmb69 Nov 24, 2021
4b4b9ed
Refactor GC data traversal loops
dstogov Nov 24, 2021
72f8dbb
Fixed bug #81634 (ZEND_ENABLE_STATIC_TSRMLS_CACHE produces extensions…
dstogov Nov 24, 2021
cddb65b
Merge branch 'PHP-8.1'
dstogov Nov 24, 2021
e713890
fix gdImagePngCtxEx call with system libgd
remicollet Nov 24, 2021
80d63e9
Merge branch 'PHP-8.0' into PHP-8.1
remicollet Nov 25, 2021
73d5dd7
Merge branch 'PHP-8.1'
remicollet Nov 25, 2021
d0a3cc1
Fix intl test on travis
nikic Nov 25, 2021
d573054
Enable encoding detection for Polish text
alexdowad Nov 25, 2021
f662103
add missing cond.
remicollet Nov 25, 2021
96a0ff7
Merge branch 'PHP-8.0' into PHP-8.1
remicollet Nov 25, 2021
7c0f2b4
Merge branch 'PHP-8.1'
remicollet Nov 25, 2021
4b9a4c4
Update include_userstream_002.phpt
dktapps Nov 24, 2021
b916567
Verify that used SSA variables are defined
nikic Nov 25, 2021
f302430
Fixed incorrect DCE for ADD_ARRAY_ELEMENT instruction
dstogov Nov 25, 2021
97f0c0b
Merge branch 'PHP-8.0' into PHP-8.1
dstogov Nov 25, 2021
40b258f
Merge branch 'PHP-8.1'
dstogov Nov 25, 2021
3c53a9f
Fixed incorrect refcountion inference for BW_NOT
dstogov Nov 25, 2021
ecc4d13
Merge branch 'PHP-8.0' into PHP-8.1
dstogov Nov 25, 2021
35786e3
Merge branch 'PHP-8.1'
dstogov Nov 25, 2021
f9518c3
Fixed incorrect narrowing to double
dstogov Nov 25, 2021
b1a1ed3
Merge branch 'PHP-8.0' into PHP-8.1
dstogov Nov 25, 2021
7dcf853
Merge branch 'PHP-8.1'
dstogov Nov 25, 2021
f566cba
fix [-Wstrict-prototypes] build warnings in ext/gd
remicollet Nov 25, 2021
1241ec8
fix [-Wstrict-prototypes] build warnings in ext/gd
remicollet Nov 25, 2021
54f1f8c
add missing conditions
remicollet Nov 25, 2021
baeba4b
Merge branch 'PHP-8.1'
remicollet Nov 25, 2021
2611e4b
Optimize the destructor of WeakMap for large WeakMaps
TysonAndre Nov 20, 2021
a40f3ef
[ci skip] PHP 8.1.0 ships today
cmb69 Nov 25, 2021
8c2e8b0
[ci skip] Merge branch 'PHP-8.1'
cmb69 Nov 25, 2021
179030d
Fix #81649: imap_(un)delete accept sequences, not single numbers
cmb69 Nov 24, 2021
df5e95b
Merge branch 'PHP-8.0' into PHP-8.1
cmb69 Nov 25, 2021
80f1866
Merge branch 'PHP-8.1'
cmb69 Nov 25, 2021
6008a75
Update to PCRE2 10.39
cmb69 Nov 23, 2021
1f18379
Merge branch 'PHP-8.1'
cmb69 Nov 25, 2021
49f44e7
JIT: Fixed use-after-free caused by shift by negative number
dstogov Nov 25, 2021
971354c
Merge branch 'PHP-8.0' into PHP-8.1
dstogov Nov 25, 2021
81007bd
Merge branch 'PHP-8.1'
dstogov Nov 25, 2021
4423044
Fixed test (added 8.1 deprecation)
dstogov Nov 25, 2021
8b86af4
Merge branch 'PHP-8.1'
dstogov Nov 25, 2021
c2d6d83
Disable enchant on azure i386
nikic Nov 26, 2021
5f67b9f
Merge branch 'PHP-7.4' into PHP-8.0
nikic Nov 26, 2021
f55f234
Merge branch 'PHP-8.0' into PHP-8.1
nikic Nov 26, 2021
b5833b6
Merge branch 'PHP-8.1'
nikic Nov 26, 2021
8be10fb
Remove redundant test
nikic Nov 26, 2021
35a01f8
Add dark mode for phpinfo() (#7626)
gharlan Nov 26, 2021
902d643
Deprecate implicit dynamic properties
nikic Oct 11, 2021
1a2c608
Add unit tests for mb_detect_encoding on Polish text
alexdowad Nov 25, 2021
ee3caef
Merge branch 'PHP-8.1'
alexdowad Nov 26, 2021
ac96db6
Preparing for 8.1.1
patrickallaert Nov 27, 2021
22756f5
Sorting and standardize NEWS entries
patrickallaert Nov 27, 2021
4e3192d
Fixed misplaced PgSQL NEWS entry
patrickallaert Nov 27, 2021
c459625
Removed placeholder from NEWS
patrickallaert Nov 27, 2021
7f7f915
Placing core changes before anything else
patrickallaert Nov 27, 2021
75546bd
Standardize: Fixed Bug -> Fixed bug
patrickallaert Nov 27, 2021
99d130a
Reordering non bug entries
patrickallaert Nov 27, 2021
81513e6
Add skip for FPM process idle flaky test
bukka Nov 27, 2021
a529d0d
Merge branch 'PHP-8.0' into PHP-8.1
bukka Nov 27, 2021
c4a1c0c
Merge branch 'PHP-8.1'
bukka Nov 27, 2021
7504cf1
Improve performance of WeakReference/WeakMap. Avoid hash collisions o…
TysonAndre Nov 28, 2021
f0dd79a
Optimize ArrayAccess method lookup
nikic Nov 28, 2021
c5d6f59
Use custom object instead of resource for soap server service
nikic Nov 28, 2021
fbdded1
Use interned string for calling count() in Zend VM
TysonAndre Nov 28, 2021
297117b
Disable type narrowing optimization when we contruct SSA for JIT
dstogov Nov 29, 2021
c6e895a
Merge branch 'PHP-8.0' into PHP-8.1
dstogov Nov 29, 2021
ee38e3a
Merge branch 'PHP-8.1'
dstogov Nov 29, 2021
31749aa
Fix #81659: stream_get_contents() may unnecessarily overallocate
cmb69 Nov 26, 2021
f3bd24a
Merge branch 'PHP-7.4' into PHP-8.0
cmb69 Nov 29, 2021
b082343
Merge branch 'PHP-8.0' into PHP-8.1
cmb69 Nov 29, 2021
e73cccd
Merge branch 'PHP-8.1'
cmb69 Nov 29, 2021
8f4cfe0
JIT: Fix named arguments handling
dstogov Nov 29, 2021
d955415
JIT: Fix named arguments handling
dstogov Nov 29, 2021
b914122
Merge branch 'PHP-8.0' into PHP-8.1
dstogov Nov 29, 2021
1b36555
Merge branch 'PHP-8.1'
dstogov Nov 29, 2021
712fc54
Fix #74604: Out of bounds in php_pcre_replace_impl
cmb69 Nov 29, 2021
816aa20
Merge branch 'PHP-7.4' into PHP-8.0
cmb69 Nov 29, 2021
60717fc
Merge branch 'PHP-8.0' into PHP-8.1
cmb69 Nov 29, 2021
c0d890e
Merge branch 'PHP-8.1'
cmb69 Nov 29, 2021
aff1155
JIT: Fix exception handling when next array element is already occupied
dstogov Nov 29, 2021
23c5a6f
Merge branch 'PHP-8.0' into PHP-8.1
dstogov Nov 29, 2021
8cdead1
Merge branch 'PHP-8.1'
dstogov Nov 29, 2021
86430e8
Fixed type inference (it's safe to ignore reference counting narrowing)
dstogov Nov 29, 2021
2d3ea98
Merge branch 'PHP-8.0' into PHP-8.1
dstogov Nov 29, 2021
e1baef1
Merge branch 'PHP-8.1'
dstogov Nov 29, 2021
3c3626a
Restore line, removed by mistake in b9141223899674a46ced28cb9fdd211bd…
dstogov Nov 30, 2021
0d6232d
Merge branch 'PHP-8.1'
dstogov Nov 30, 2021
6e1fe96
JIT: Fix uninitialized result of ASSIGN_DIM[_OP] after clobbering arr…
dstogov Nov 30, 2021
005d5f4
Merge branch 'PHP-8.0' into PHP-8.1
dstogov Nov 30, 2021
517738b
Merge branch 'PHP-8.1'
dstogov Nov 30, 2021
c103619
JIT: Fix incorrect reference counting inference
dstogov Nov 30, 2021
3564001
Merge branch 'PHP-8.0' into PHP-8.1
dstogov Nov 30, 2021
c2aea6e
Merge branch 'PHP-8.1'
dstogov Nov 30, 2021
df434f0
Fix crash after indirect modification of string by user error handler
dstogov Nov 30, 2021
afd8817
Merge branch 'PHP-8.0' into PHP-8.1
dstogov Nov 30, 2021
532f2ca
Merge branch 'PHP-8.1'
dstogov Nov 30, 2021
032de9e
Optimize SplObjectStorage native read/write/has/unset dimension handlers
TysonAndre Nov 26, 2021
283669f
pcntl add forkx for solaris based systems. (#7654)
devnexen Nov 30, 2021
e7b31f5
JIT: Fix incorrect code produced for BOOL_NOT and [double, undef] ope…
dstogov Nov 30, 2021
0738956
Merge branch 'PHP-8.0' into PHP-8.1
dstogov Nov 30, 2021
26449de
Merge branch 'PHP-8.1'
dstogov Nov 30, 2021
f533744
Prepare for 7.4.28
derickr Nov 30, 2021
977e132
Merge branch 'PHP-7.4' into PHP-8.0
derickr Nov 30, 2021
2fb7b6e
Merge branch 'PHP-8.0' into PHP-8.1
derickr Nov 30, 2021
36b2b3e
Merge branch 'PHP-8.1'
derickr Nov 30, 2021
b594a95
Fixed crash in ZEND_ASSIGN_DIM_OP because of array cloberring by user…
dstogov Nov 30, 2021
db806d7
Merge branch 'PHP-8.1'
dstogov Nov 30, 2021
c3766c0
Fix SCDF cleanup of unused basic block, kept only because of FREE of …
dstogov Dec 1, 2021
923bd51
Merge branch 'PHP-8.1'
dstogov Dec 1, 2021
9f6ab78
Use proper functions
dstogov Dec 1, 2021
10cfe9f
Merge branch 'PHP-8.0' into PHP-8.1
dstogov Dec 1, 2021
bdf6779
Merge branch 'PHP-8.1'
dstogov Dec 1, 2021
09547c6
Fix clobering of operand by error handler in assignment to string offset
dstogov Dec 1, 2021
9786eac
Merge branch 'PHP-8.0' into PHP-8.1
dstogov Dec 1, 2021
4595a57
Fix clobering of operand by error handler in assignment to string off…
dstogov Dec 1, 2021
e833e5c
Merge branch 'PHP-8.0' into PHP-8.1
dstogov Dec 1, 2021
c8dca00
Merge branch 'PHP-8.1'
dstogov Dec 1, 2021
2384112
Merge branch 'PHP-8.1'
dstogov Dec 1, 2021
999c6f2
Bump for 8.0.15
sgolemon Dec 2, 2021
ecea0cc
Merge branch 'PHP-8.0' into PHP-8.1
sgolemon Dec 2, 2021
217fd93
Merge branch 'PHP-8.1'
sgolemon Dec 2, 2021
df16da3
Fixed ext/bz2/tests/005.phpt test failure introduesed by 09547c64c28f…
dstogov Dec 2, 2021
4eaba3e
Merge branch 'PHP-8.0' into PHP-8.1
dstogov Dec 2, 2021
17fac12
Merge branch 'PHP-8.1'
dstogov Dec 2, 2021
37ac707
Add missing zend_string_release_ex(tmp, 0) and cleanup
dstogov Dec 2, 2021
b9ff359
Merge branch 'PHP-8.0' into PHP-8.1
dstogov Dec 2, 2021
da0d4bf
Merge branch 'PHP-8.1'
dstogov Dec 2, 2021
94286cd
Fix yet another indirect string modification by error handler problem
dstogov Dec 2, 2021
ddcfffa
Merge branch 'PHP-8.0' into PHP-8.1
dstogov Dec 2, 2021
d29e938
Merge branch 'PHP-8.1'
dstogov Dec 2, 2021
628670c
Prepare for 8.1.2
patrickallaert Dec 2, 2021
889f65b
Merge branch 'PHP-8.1'
dstogov Dec 2, 2021
2fde308
JIT: Fix ASSIGN_DIM_OP with undefined variable and index and user err…
dstogov Dec 2, 2021
b4680b0
Merge branch 'PHP-8.0' into PHP-8.1
dstogov Dec 2, 2021
88dc5cb
Merge branch 'PHP-8.1'
dstogov Dec 2, 2021
42a162e
Add test
dstogov Dec 2, 2021
cdc5adb
Merge branch 'PHP-8.1'
dstogov Dec 2, 2021
c4ee668
Tracing JIT: Fixed Zend/tests/str_offset_008.phpt failure
dstogov Dec 2, 2021
9a3ca27
Merge branch 'PHP-8.0' into PHP-8.1
dstogov Dec 2, 2021
d102f27
Merge branch 'PHP-8.1'
dstogov Dec 2, 2021
59dd4fd
Fix #81681: ReflectionEnum throwing exceptions
cmb69 Dec 2, 2021
2658925
Merge branch 'PHP-8.1'
cmb69 Dec 2, 2021
2515e78
JIT: Fix register clobbering
dstogov Dec 3, 2021
dd2c30a
Merge branch 'PHP-8.0' into PHP-8.1
dstogov Dec 3, 2021
f22e29a
Merge branch 'PHP-8.1'
dstogov Dec 3, 2021
1d054b3
Fix array object clobbering by user error handler
dstogov Dec 3, 2021
731ce6b
Merge branch 'PHP-8.0' into PHP-8.1
dstogov Dec 3, 2021
4a5c05a
ws
dstogov Dec 3, 2021
8d7d87c
Add test
dstogov Dec 3, 2021
e52f57c
Merge branch 'PHP-8.0' into PHP-8.1
dstogov Dec 3, 2021
1195ab8
Merge branch 'PHP-8.1'
dstogov Dec 3, 2021
c9901aa
Add missing "return"
dstogov Dec 3, 2021
7a6fb97
Merge branch 'PHP-8.0' into PHP-8.1
dstogov Dec 3, 2021
a9c2dcd
Merge branch 'PHP-8.1'
dstogov Dec 3, 2021
929d847
Fix #81693: mb_check_encoding(7bit) segfaults
cmb69 Dec 3, 2021
97f78b3
Merge branch 'PHP-8.1'
cmb69 Dec 3, 2021
307e476
Fixed bug #81216 (Nullsafe operator leaks dynamic property name)
dstogov Dec 4, 2021
dbde68f
Merge branch 'PHP-8.1'
dstogov Dec 4, 2021
8ba1267
Add templates and workflows for GitHub issues
nikic Nov 26, 2021
024d5f4
Cache method overrides of ArrayAccess in zend_class_entry
TysonAndre Dec 1, 2021
64f34ed
Adjust security bug url
nikic Dec 4, 2021
582a291
Use php/php-sdk-binary-tools.git for AppVeyor builds
cmb69 Dec 5, 2021
b9f9d4a
Merge branch 'PHP-8.0' into PHP-8.1
cmb69 Dec 5, 2021
7d95cec
Merge branch 'PHP-8.1'
cmb69 Dec 5, 2021
3be0ce6
Report wireless network interfaces on Windows too
Yurunsoft Dec 5, 2021
dab6226
Fix invalid opcode for ??= on $GLOBALS
iluuu1994 Dec 4, 2021
66af53c
Merge branch 'PHP-8.1'
iluuu1994 Dec 5, 2021
15e7e57
Fix #81658: MYSQL_OPT_LOAD_DATA_LOCAL_DIR not available in MariaDB
devnexen Dec 3, 2021
dea548b
Merge branch 'PHP-8.1'
cmb69 Dec 5, 2021
26e4244
Fix bug #81598: Use C.UTF-8 as LC_CTYPE locale by default
nikic Nov 9, 2021
e32642c
Merge branch 'PHP-8.1'
nikic Dec 5, 2021
1f38c00
fix #81656: GCC-11 silently ignores -R
m6w6 Nov 25, 2021
53ae2b1
Merge branch 'PHP-8.0' into PHP-8.1
nikic Dec 5, 2021
335b940
Merge branch 'PHP-8.1'
nikic Dec 5, 2021
b991ce9
Improve final/abstract methods in interfaces error messages
iluuu1994 Dec 5, 2021
051b396
Merge branch 'PHP-8.1'
iluuu1994 Dec 5, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
36 changes: 36 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Bug report
description: Create a bug report
labels: ["Bug", "Status: Needs Triage"]
body:
- type: textarea
attributes:
label: Description
description: "Please provide a minimal way to reproduce the problem and describe what the expected vs actual behavior is. Provide a [3v4l.org](https://3v4l.org/) link if possible."
value: |
The following code:

```php
<?php
```

Resulted in this output:
```
```

But I expected this output instead:
```
```
validations:
required: true
- type: input
attributes:
label: PHP Version
description: "The used PHP version. Make sure it is [supported](https://www.php.net/supported-versions.php)."
placeholder: "PHP 8.0.12"
validations:
required: true
- type: input
attributes:
label: Operating System
description: "The used operating system, if relevant."
placeholder: "Ubuntu 20.04"
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: Documentation issue
url: https://github.com/php/doc-en/issues
about: Please report documentation issues on the doc-en repository.
- name: Security issue
url: https://bugs.php.net/report.php?security_bug
about: Please report security issues in this private bug tracker.
10 changes: 10 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Feature request
description: Create a feature request
labels: ["Feature", "Status: Needs Triage"]
body:
- type: textarea
attributes:
label: Description
description: "Please describe the requested feature and why it should be included in PHP."
validations:
required: true
17 changes: 17 additions & 0 deletions .github/workflows/close-needs-feedback.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Close old issues that need feedback

on:
schedule:
- cron: "0 0 * * *"

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Close old issues that need feedback
uses: dwieeb/needs-reply@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue-label: "Status: Needs Feedback"
days-before-close: 14
close-message: "No feedback was provided. The issue is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so. Thank you."
15 changes: 15 additions & 0 deletions .github/workflows/remove-needs-feedback.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Remove needs feedback label

on:
issue_comment:
types:
- created

jobs:
build:
if: "contains(github.event.issue.labels.*.name, 'Status: Needs Feedback') && github.event.issue.user.login == github.event.sender.login"
runs-on: ubuntu-latest
steps:
- uses: actions-ecosystem/action-remove-labels@v1
with:
labels: "Status: Needs Feedback"
4 changes: 4 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ PHP NEWS
- OCI8:
. Added oci8.prefetch_lob_size directive to tune LOB query performance

- Standard:
. net_get_interfaces() also reports wireless network interfaces on Windows.
(Yurun)

- Zip:
. add ZipArchive::clearError() method
. add ZipArchive::getStreamName() method
Expand Down
8 changes: 6 additions & 2 deletions TSRM/TSRM.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,10 @@ TSRM_API const char *tsrm_api_name(void);
#define TSRMG_BULK_STATIC(id, type) ((type) (*((void ***) TSRMLS_CACHE))[TSRM_UNSHUFFLE_RSRC_ID(id)])
#define TSRMG_FAST_STATIC(offset, type, element) (TSRMG_FAST_BULK_STATIC(offset, type)->element)
#define TSRMG_FAST_BULK_STATIC(offset, type) ((type) (((char*) TSRMLS_CACHE)+(offset)))
#define TSRMLS_CACHE_EXTERN() extern TSRM_TLS void *TSRMLS_CACHE TSRM_TLS_MODEL_ATTR;
#define TSRMLS_CACHE_DEFINE() TSRM_TLS void *TSRMLS_CACHE TSRM_TLS_MODEL_ATTR = NULL;
#define TSRMLS_MAIN_CACHE_EXTERN() extern TSRM_TLS void *TSRMLS_CACHE TSRM_TLS_MODEL_ATTR;
#define TSRMLS_MAIN_CACHE_DEFINE() TSRM_TLS void *TSRMLS_CACHE TSRM_TLS_MODEL_ATTR = NULL;
#define TSRMLS_CACHE_EXTERN() extern TSRM_TLS void *TSRMLS_CACHE;
#define TSRMLS_CACHE_DEFINE() TSRM_TLS void *TSRMLS_CACHE = NULL;
#define TSRMLS_CACHE_UPDATE() TSRMLS_CACHE = tsrm_get_ls_cache()
#define TSRMLS_CACHE _tsrm_ls_cache

Expand All @@ -182,6 +184,8 @@ TSRM_API const char *tsrm_api_name(void);
#define tsrm_env_unlock()

#define TSRMG_STATIC(id, type, element)
#define TSRMLS_MAIN_CACHE_EXTERN()
#define TSRMLS_MAIN_CACHE_DEFINE()
#define TSRMLS_CACHE_EXTERN()
#define TSRMLS_CACHE_DEFINE()
#define TSRMLS_CACHE_UPDATE()
Expand Down
10 changes: 10 additions & 0 deletions UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@ PHP 8.2 UPGRADE NOTES
========================================

- Core:
. Creation of dynamic properties is deprecated, unless the class opts in by
using the #[AllowDynamicProperties] attribute. stdClass allows dynamic
properties. Usage of __get()/__set() is not affected by this change. A
dynamic properties deprecation warning can be addressed by:
- Declaring the property (preferred).
- Adding the #[AllowDynamicProperties] attribute to the class (which also
applies to all child classes).
- Using a WeakMap if you wish to associate additional data with an object
you do not own.

. Callables that are not accepted by the $callable() syntax (but are accepted
by call_user_func) are deprecated. In particular:

Expand Down
14 changes: 12 additions & 2 deletions Zend/Optimizer/dce.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ static inline bool may_have_side_effects(
case ZEND_ROPE_INIT:
case ZEND_ROPE_ADD:
case ZEND_INIT_ARRAY:
case ZEND_ADD_ARRAY_ELEMENT:
case ZEND_SPACESHIP:
case ZEND_STRLEN:
case ZEND_COUNT:
Expand All @@ -128,6 +127,12 @@ static inline bool may_have_side_effects(
case ZEND_ARRAY_KEY_EXISTS:
/* No side effects */
return 0;
case ZEND_ADD_ARRAY_ELEMENT:
/* TODO: We can't free two vars. Keep instruction alive. <?php [0, "$a" => "$b"]; */
if ((opline->op1_type & (IS_VAR|IS_TMP_VAR)) && (opline->op2_type & (IS_VAR|IS_TMP_VAR))) {
return 1;
}
return 0;
case ZEND_ROPE_END:
/* TODO: Rope dce optimization, see #76446 */
return 1;
Expand Down Expand Up @@ -514,6 +519,10 @@ static inline bool may_break_varargs(const zend_op_array *op_array, const zend_s
return 0;
}

static inline bool may_throw_dce_exception(const zend_op *opline) {
return opline->opcode == ZEND_ADD_ARRAY_ELEMENT && opline->op2_type == IS_UNUSED;
}

int dce_optimize_op_array(zend_op_array *op_array, zend_ssa *ssa, bool reorder_dtor_effects) {
int i;
zend_ssa_phi *phi;
Expand Down Expand Up @@ -580,7 +589,8 @@ int dce_optimize_op_array(zend_op_array *op_array, zend_ssa *ssa, bool reorder_d
add_operands_to_worklists(&ctx, &op_array->opcodes[op_data], &ssa->ops[op_data], ssa, 0);
}
} else if (may_have_side_effects(op_array, ssa, &op_array->opcodes[i], &ssa->ops[i], ctx.reorder_dtor_effects)
|| zend_may_throw(&op_array->opcodes[i], &ssa->ops[i], op_array, ssa)
|| (zend_may_throw(&op_array->opcodes[i], &ssa->ops[i], op_array, ssa)
&& !may_throw_dce_exception(&op_array->opcodes[i]))
|| (has_varargs && may_break_varargs(op_array, ssa, &ssa->ops[i]))) {
if (op_array->opcodes[i].opcode == ZEND_NEW
&& op_array->opcodes[i+1].opcode == ZEND_DO_FCALL
Expand Down
24 changes: 11 additions & 13 deletions Zend/Optimizer/dfa_pass.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,19 +345,17 @@ static bool opline_supports_assign_contraction(
return 1;
}

static bool variable_redefined_in_range(zend_ssa *ssa, int var, int start, int end)
static bool variable_defined_or_used_in_range(zend_ssa *ssa, int var, int start, int end)
{
while (start < end) {
if (ssa->ops[start].op1_def >= 0
&& ssa->vars[ssa->ops[start].op1_def].var == var) {
return 1;
}
if (ssa->ops[start].op2_def >= 0
&& ssa->vars[ssa->ops[start].op2_def].var == var) {
return 1;
}
if (ssa->ops[start].result_def >= 0
&& ssa->vars[ssa->ops[start].result_def].var == var) {
const zend_ssa_op *ssa_op = &ssa->ops[start];
if ((ssa_op->op1_def >= 0 && ssa->vars[ssa_op->op1_def].var == var) ||
(ssa_op->op2_def >= 0 && ssa->vars[ssa_op->op2_def].var == var) ||
(ssa_op->result_def >= 0 && ssa->vars[ssa_op->result_def].var == var) ||
(ssa_op->op1_use >= 0 && ssa->vars[ssa_op->op1_use].var == var) ||
(ssa_op->op2_use >= 0 && ssa->vars[ssa_op->op2_use].var == var) ||
(ssa_op->result_use >= 0 && ssa->vars[ssa_op->result_use].var == var)
) {
return 1;
}
start++;
Expand Down Expand Up @@ -1331,7 +1329,7 @@ void zend_dfa_optimize_op_array(zend_op_array *op_array, zend_optimizer_ctx *ctx
&& opline_supports_assign_contraction(
ssa, &op_array->opcodes[ssa->vars[src_var].definition],
src_var, opline->result.var)
&& !variable_redefined_in_range(ssa, EX_VAR_TO_NUM(opline->result.var),
&& !variable_defined_or_used_in_range(ssa, EX_VAR_TO_NUM(opline->result.var),
ssa->vars[src_var].definition+1, op_1)
) {

Expand Down Expand Up @@ -1490,7 +1488,7 @@ void zend_dfa_optimize_op_array(zend_op_array *op_array, zend_optimizer_ctx *ctx
&& opline_supports_assign_contraction(
ssa, &op_array->opcodes[ssa->vars[src_var].definition],
src_var, opline->op1.var)
&& !variable_redefined_in_range(ssa, EX_VAR_TO_NUM(opline->op1.var),
&& !variable_defined_or_used_in_range(ssa, EX_VAR_TO_NUM(opline->op1.var),
ssa->vars[src_var].definition+1, op_1)
) {

Expand Down
10 changes: 9 additions & 1 deletion Zend/Optimizer/sccp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1101,7 +1101,9 @@ static void sccp_visit_instr(scdf_ctx *scdf, zend_op *opline, zend_ssa_op *ssa_o

/* Don't try to propagate assignments to (potentially) typed properties. We would
* need to deal with errors and type conversions first. */
if (!var_info->ce || (var_info->ce->ce_flags & ZEND_ACC_HAS_TYPE_HINTS)) {
// TODO: Distinguish dynamic and declared property assignments here?
if (!var_info->ce || (var_info->ce->ce_flags & ZEND_ACC_HAS_TYPE_HINTS) ||
!(var_info->ce->ce_flags & ZEND_ACC_ALLOW_DYNAMIC_PROPERTIES)) {
SET_RESULT_BOT(result);
SET_RESULT_BOT(op1);
return;
Expand Down Expand Up @@ -2277,6 +2279,12 @@ static int try_remove_definition(sccp_ctx *ctx, int var_num, zend_ssa_var *var,
return 0;
}
break;
case ZEND_INIT_ARRAY:
case ZEND_ADD_ARRAY_ELEMENT:
if (opline->op2_type == IS_UNUSED) {
return 0;
}
/* break missing intentionally */
default:
if (zend_may_throw(opline, ssa_op, op_array, ssa)) {
return 0;
Expand Down
11 changes: 7 additions & 4 deletions Zend/Optimizer/scdf.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,29 +224,32 @@ static uint32_t cleanup_loop_var_free_block(scdf_ctx *scdf, zend_basic_block *bl
zend_ssa *ssa = scdf->ssa;
const zend_op_array *op_array = scdf->op_array;
const zend_cfg *cfg = &ssa->cfg;
int block_num = block - cfg->blocks;
uint32_t removed_ops = 0;

/* Removes phi nodes */
for (zend_ssa_phi *phi = ssa->blocks[block - cfg->blocks].phis; phi; phi = phi->next) {
for (zend_ssa_phi *phi = ssa->blocks[block_num].phis; phi; phi = phi->next) {
zend_ssa_remove_uses_of_var(ssa, phi->ssa_var);
zend_ssa_remove_phi(ssa, phi);
}

for (uint32_t i = block->start; i < block->start + block->len; i++) {
zend_op *opline = &op_array->opcodes[i];
zend_ssa_op *ssa_op = &scdf->ssa->ops[i];
if (is_live_loop_var_free(scdf, opline, ssa_op)) {
if (opline->opcode == ZEND_NOP
|| is_live_loop_var_free(scdf, opline, ssa_op)) {
continue;
}

/* While we have to preserve the loop var free, we can still remove other instructions
* in the block. */
zend_ssa_remove_defs_of_instr(ssa, ssa_op);
zend_ssa_remove_instr(ssa, opline, ssa_op);
removed_ops++;
}

/* This block has no predecessors anymore. */
block->predecessors_count = 0;
zend_ssa_remove_block_from_cfg(ssa, block_num);

return removed_ops;
}

Expand Down
17 changes: 17 additions & 0 deletions Zend/Optimizer/ssa_integrity.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ static inline bool is_var_type(zend_uchar type) {
return (type & (IS_CV|IS_VAR|IS_TMP_VAR)) != 0;
}

static inline bool is_defined(const zend_ssa *ssa, const zend_op_array *op_array, int var) {
const zend_ssa_var *ssa_var = &ssa->vars[var];
return ssa_var->definition >= 0 || ssa_var->definition_phi || var < op_array->last_var;
}

#define FAIL(...) do { \
if (status == SUCCESS) { \
fprintf(stderr, "\nIn function %s::%s (%s):\n", \
Expand Down Expand Up @@ -209,6 +214,10 @@ void ssa_verify_integrity(zend_op_array *op_array, zend_ssa *ssa, const char *ex
if (ssa_op->op1_use >= ssa->vars_count) {
FAIL("op1 use %d out of range\n", ssa_op->op1_use);
}
if (!is_defined(ssa, op_array, ssa_op->op1_use)) {
FAIL("op1 use of " VARFMT " in " INSTRFMT " is not defined\n",
VAR(ssa_op->op1_use), INSTR(i));
}
if (!is_in_use_chain(ssa, ssa_op->op1_use, i)) {
FAIL("op1 use of " VARFMT " in " INSTRFMT " not in use chain\n",
VAR(ssa_op->op1_use), INSTR(i));
Expand All @@ -222,6 +231,10 @@ void ssa_verify_integrity(zend_op_array *op_array, zend_ssa *ssa, const char *ex
if (ssa_op->op2_use >= ssa->vars_count) {
FAIL("op2 use %d out of range\n", ssa_op->op2_use);
}
if (!is_defined(ssa, op_array, ssa_op->op2_use)) {
FAIL("op2 use of " VARFMT " in " INSTRFMT " is not defined\n",
VAR(ssa_op->op2_use), INSTR(i));
}
if (!is_in_use_chain(ssa, ssa_op->op2_use, i)) {
FAIL("op2 use of " VARFMT " in " INSTRFMT " not in use chain\n",
VAR(ssa_op->op2_use), INSTR(i));
Expand All @@ -235,6 +248,10 @@ void ssa_verify_integrity(zend_op_array *op_array, zend_ssa *ssa, const char *ex
if (ssa_op->result_use >= ssa->vars_count) {
FAIL("result use %d out of range\n", ssa_op->result_use);
}
if (!is_defined(ssa, op_array, ssa_op->result_use)) {
FAIL("result use of " VARFMT " in " INSTRFMT " is not defined\n",
VAR(ssa_op->result_use), INSTR(i));
}
if (!is_in_use_chain(ssa, ssa_op->result_use, i)) {
FAIL("result use of " VARFMT " in " INSTRFMT " not in use chain\n",
VAR(ssa_op->result_use), INSTR(i));
Expand Down
Loading