Commit graph

460 commits

Author SHA1 Message Date
Christoph M. Becker
4833362844
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix #81430: Attribute instantiation leaves dangling pointer
2022-01-10 12:42:18 +01:00
Benjamin Eberlei
2f6a06ccb0
Fix #81430: Attribute instantiation leaves dangling pointer
By switching attribute constructor stackframe to be called via
trampoline the stack allocation is not causing dangling pointers
in the zend_observer API anymore.

Co-Authored-By: Florian Sowade <f.sowade@suora.com>
Co-Authored-By: Christopher Becker <cmbecker69@gmx.de>
Co-Authored-By: Dmitry Stogov <dmitry@zend.com>

Closes GH-7885.
2022-01-10 12:40:15 +01:00
Christoph M. Becker
1d4482908b
Merge branch 'PHP-8.1'
* PHP-8.1:
  Revert "Fix zend_observer_fcall_end_all() accessing dangling pointers"
2021-12-27 21:11:24 +01:00
Christoph M. Becker
d58c48d45d
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Revert "Fix zend_observer_fcall_end_all() accessing dangling pointers"
2021-12-27 21:10:40 +01:00
Christoph M. Becker
ee610947ce
Revert "Fix zend_observer_fcall_end_all() accessing dangling pointers"
This reverts commit 76e2a8380e.  Cf.
<76e2a8380e (r62560239)>.
2021-12-27 21:08:51 +01:00
Christoph M. Becker
a72a011054
Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix zend_observer_fcall_end_all() accessing dangling pointers
2021-12-27 18:21:37 +01:00
Christoph M. Becker
d4c07df4df
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix zend_observer_fcall_end_all() accessing dangling pointers
2021-12-27 18:20:48 +01:00
Florian Sowade
76e2a8380e
Fix zend_observer_fcall_end_all() accessing dangling pointers
This may happen, when the execute_data was allocated on the stack.  We
ensure that the runtime cache pointer is not NULL before dereferencing
it.

This is a partial fix for bug 81430.

Closes GH-7665.
2021-12-27 18:19:13 +01:00
Tyson Andre
7504cf189b
Improve performance of WeakReference/WeakMap. Avoid hash collisions on pointers. (#7690)
Shift pointers by ZEND_MM_ALIGNMENT_LOG2
to avoid the noticeable performance degradation caused by hash table collisions.
in `EG(weakrefs)` and zend_weakmap->ht

On 64-bit platforms, pointers are usually aligned to at least 8 bytes,
so only one in 8 hash buckets were actually getting used.
(With the metadata needed to track allocations,
alignment might be at least 16 bytes in practice)

Address review comments, add optimization

Make it public for any extensions that need to work with EG(weakrefs)
for instrumentation, debugging, etc. (e.g. zend_test)

PHP 8.1 and previous releases would use the raw pointer value as a hash key instead.
2021-11-27 19:52:30 -05:00
Nikita Popov
d362caed2c Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix generation of property with class union type
  Replace SKIPIF with EXTENSIONS
2021-11-15 11:05:52 +01:00
Nikita Popov
68ca3879d7 Fix generation of property with class union type
The generated type was missing the UNION bit. Add a ZEND_TYPE_INIT_UNION
macro to hide the implementation details.
2021-11-15 11:04:48 +01:00
Nikita Popov
86379b6710 Warn if return type on internal __toString() is missing 2021-11-09 10:24:41 +01:00
Nikita Popov
85acad5688 Merge branch 'PHP-8.1'
* PHP-8.1:
  Add string return type to __toString() of internal classes
2021-11-09 10:21:16 +01:00
Nikita Popov
277caa1db0 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Add string return type to __toString() of internal classes
2021-11-09 10:20:36 +01:00
Nikita Popov
a551b08307 Add string return type to __toString() of internal classes
Same as with userland classes, automatically add a string return
type to __toString() methods in internal classes, so the signature
is compatible with Stringable.
2021-11-09 10:17:26 +01:00
Bob Weinand
76145424c6 Merge branch 'PHP-8.1' 2021-10-21 19:32:20 +02:00
Bob Weinand
32024dd0bb Merge branch 'PHP-8.0' into PHP-8.1 2021-10-21 19:32:03 +02:00
Bob Weinand
345f46ff29 Fix weakmap API test
Apparently under some targets the address can evaluate to an address with the most significant bit set. (displays as negative number)
2021-10-21 19:31:37 +02:00
Bob Weinand
d6bf375fe4 Merge branch 'PHP-8.1' 2021-10-21 13:44:03 +02:00
Bob Weinand
51a9c68ee5 Merge branch 'PHP-8.0' into PHP-8.1 2021-10-21 13:42:20 +02:00
Bob Weinand
471102edcd Add ZEND_API for weakmap functionality via zend_weakrefs_hash_add/del
Closes GH-7600.
2021-10-21 13:34:22 +02:00
Nikita Popov
e489e2d388 Add missing $flags param to getStream()
This is an alias of getStreamName() but was missing the optional
$flags parameter.
2021-10-11 16:01:57 +02:00
codinghuang
5bda4cd25a Support specifying start position in compile_string
Add additional zend_compile_position argument, which can be either
AT_SHEBANG, AT_OPEN_TAG or AFTER_OPEN_TAG. The previous behavior
corresponds to AFTER_OPEN_TAG.

Closes GH-7462.
2021-09-30 10:21:33 +02:00
Nikita Popov
59ae64825d Release observed function name table 2021-09-16 10:38:28 +02:00
Nikita Popov
d3684ff424 Add observer_ prefix to test name
This will cause it to be skipped in --preload mode.
2021-09-16 10:36:49 +02:00
Nikita Popov
fe984c7cb5 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Use wildcard for error message
2021-09-13 22:47:13 +02:00
Nikita Popov
5d702e33a2 Use wildcard for error message
This differs depending on build type.
2021-09-13 22:46:26 +02:00
Nikita Popov
ba03c5fb4c Try to fix test 2021-09-13 21:07:46 +02:00
Bob Weinand
a8f06346ad Merge remote-tracking branch 'origin/PHP-8.0' into PHP-8.1 2021-09-13 16:15:55 +02:00
Bob Weinand
12b0f1b7cc Fix #81435 Observer current_observed_frame may point to an old (overwritten) frame
Ensure current_observed_frame always points to an actually observed frame.
This solution has a caveat of being O(stack size), with the worst case occurring if there are a lot of frames between the current and previous observed frames.
An O(1) solution would require keeping track of the previous observed frame, which would require some additional frame attached metadata, which is best not attempted in an already released version.
2021-09-13 15:58:58 +02:00
Máté Kocsis
4483ecf5a9
Properly escape the default value of string properties and enum cases 2021-09-02 16:53:31 +02:00
Nikita Popov
32d48212ea Support generating internal enum decl from stubs 2021-08-31 14:19:37 +02:00
Go Kudo
eaac77f4e7
Fix nested namespaced typed property in gen_stub.php (#7418)
Property escape namespaced class name in property types.
2021-08-31 11:56:39 +02:00
Nikita Popov
1a370d3321 Skip some tests under --preload
A genuine problem here is that we sometime get different class
casing due interaction with the ZSTR CE cache. Ignore these for
now.
2021-07-30 17:26:39 +02:00
Nikita Popov
a374230c15 Add support for internal enums
This adds support for internal enums with the same basic approach
as userland enums. Enum values are stored as CONSTANT_AST and
objects created during constant updating at runtime. This means
that we need to use mutable_data for internal enums.

This just adds basic support and APIs, it does not include the
stubs integration from #7212.

Closes GH-7302.
2021-07-27 09:19:14 +02:00
Máté Kocsis
fc56de113c
Add support for generating readonly properties via stubs (#7297) 2021-07-22 11:09:10 +02:00
Joe Watkins
848b5458d1
more fiber notifications (#7293) 2021-07-21 17:18:15 +02:00
Máté Kocsis
b382883696
Indent stubs inside global namespace blocks (#7261) 2021-07-20 10:23:58 +02:00
Nikita Popov
1cba7764b4
Remove zend_atoi() (#7232)
It's the same as (int) zend_atol() -- it doesn't try to do anything
integer size specific. Canonicalize to one function in preparation
for renaming zend_atol() to something less misleading.

FFI test is adjusted to use a zend_test function. It just calls
zend_atol() internally, but could really be anything.

Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>
2021-07-13 09:22:31 +02:00
Patrick Allaert
ac18dd0dc7 Prefer EXPECT over EXPECTF 2021-06-29 17:13:02 +02:00
Patrick Allaert
aff365871a Fixed some spaces used instead of tabs 2021-06-29 11:30:26 +02:00
Martin Schröder
c5f9cdedd6
Flexible fiber bailout handling (#7163) 2021-06-18 11:01:10 -05:00
Aaron Piotrowski
859524c246
Remove fiber context embedding 2021-06-14 14:34:36 -05:00
Nikita Popov
fcccb4c593 Add missing zend_test dependency 2021-06-14 15:03:26 +02:00
Aaron Piotrowski
f5c209989a
Add test for leaking prior context with symmetric coroutines 2021-06-12 00:10:17 -05:00
Aaron Piotrowski
d0c43e108e
Reorganize zend_test and add custom fiber implementation tests (#7137) 2021-06-11 12:25:47 -05:00
Nikita Popov
7485978339
Migrate SKIPIF -> EXTENSIONS (#7138)
This is an automated migration of most SKIPIF extension_loaded checks.
2021-06-11 11:57:42 +02:00
Nikita Popov
4c37645acf Disable file_cache_only as well in optimizer pass test 2021-06-09 12:02:55 +02:00
Aaron Piotrowski
2184422adc
Merge fiber switching functions (#7106)
Co-authored-by: Martin Schröder <m.schroeder2007@gmail.com>
2021-06-08 08:23:56 -05:00
Nikita Popov
703fcf0f2f Disable file cache in optimizer_register_pass.phpt 2021-06-08 13:57:19 +02:00