History log of /PHP-8.2/Zend/zend_generators.c (Results 1 – 25 of 295)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# cd255007 28-Aug-2024 Arnaud Le Blanc

Do not scan generator frames more than once (#15330)


# c767fec2 10-Aug-2024 Arnaud Le Blanc

Fix crash during GC of suspended generator delegate (#15275)


# 99e0d3fe 30-Jul-2024 Arnaud Le Blanc

Fix destruction of generator running in fibers during shutdown (#15158)

The destructor of generators is a no-op when the generator is running in a fiber,
because the fiber may resume the

Fix destruction of generator running in fibers during shutdown (#15158)

The destructor of generators is a no-op when the generator is running in a fiber,
because the fiber may resume the generator. Normally the destructor
is not called in this case, but this can happen during shutdown.

We detect that a generator is running in a fiber with the
ZEND_GENERATOR_IN_FIBER flag.

This change fixes two cases not handled by this mechanism:

- The ZEND_GENERATOR_IN_FIBER flag was not added when resuming a "yield from $nonGenerator"

- When a generator that is running in a fiber has multiple children (aka multiple generators yielding from it), all of them could be considered to also run in a fiber (only one actually is), and could leak if not destroyed before shutdown.

show more ...


# be7f3aa4 01-Jun-2024 Bob Weinand

Fix GH-14387: Crash when stack walking in destructor of yielded from values during Generator->throw()


# 97267215 10-Jan-2024 David CARLIER

general signatures discrepencies fixes (#13122)


# fc32d39b 08-Apr-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix GH-11028: Heap Buffer Overflow in zval_undefined_cv.

For analysis see https://github.com/php/php-src/issues/11028#issuecomment-1508460440

Closes GH-11083.


# d721dcc2 10-Feb-2023 Arnaud Le Blanc

Fix colletion of unfinished function call in fibers

Fixes GH-10496.

Co-authored-by: Bob Weinand <bobwei9@hotmail.com>


# 00be6e1a 30-Jan-2023 Bob Weinand

Look at executing generator for fiber destructor behaviour


# b9bca2da 30-Jan-2023 Bob Weinand

Fix resetting ZEND_GENERATOR_IN_FIBER flag

Signed-off-by: Bob Weinand <bobwei9@hotmail.com>


# 1173c2e6 27-Jan-2023 Arnaud Le Blanc

Prevent dtor of generator in suspended fiber (#10462)

Generators that suspended a fiber should not be dtor because they will be
executed during the fiber dtor.

Fiber dtor throws

Prevent dtor of generator in suspended fiber (#10462)

Generators that suspended a fiber should not be dtor because they will be
executed during the fiber dtor.

Fiber dtor throws an exception in the fiber's context in order to unwind and
execute finally blocks, which will also properly dtor the generator.

Fixes GH-9916

show more ...


# 4fb14939 13-Jan-2023 Arnaud Le Blanc

GC fiber unfinished executions (#9810)


# 5d1f3e04 04-Nov-2022 Arnaud Le Blanc

Fix generator memory leaks when interrupted during argument evaluation (#9756)


# 86e1fea3 14-Oct-2022 Arnaud Le Blanc

Restore extra_named_params when restoring frozen call stack


# 5a0b68be 14-Sep-2022 Bob Weinand

Revert "Store default object handlers alongside the class entry"

This reverts commit 9e6eab3c139b41dc976dd5305fd1a6e387e5e27f.

Reverted along a01dd9fedaecd2e5b95bc5c2e8d6542116addea

Revert "Store default object handlers alongside the class entry"

This reverts commit 9e6eab3c139b41dc976dd5305fd1a6e387e5e27f.

Reverted along a01dd9fedaecd2e5b95bc5c2e8d6542116addeae.

show more ...


# 9e6eab3c 22-Jul-2022 Bob Weinand

Store default object handlers alongside the class entry

Object handlers being separate from class entries is a legacy inherited from PHP 5. Today it has little benefit to keep them separate:

Store default object handlers alongside the class entry

Object handlers being separate from class entries is a legacy inherited from PHP 5. Today it has little benefit to keep them separate: in fact, accessing object handlers usually requires not-so-safe hacks.
While it is possible to swap handlers in a custom installed create_object handler, this mostly is tedious, as well as it requires allocating the object handlers struct at runtime, possibly caching it etc..

This allows extensions, which intend to observe other classes to install their own class handlers.
The life cycle of internal classes may now be simply observed by swapping the class handlers in post_startup stage.
The life cycle of userland classes may be observed by iterating over the new classes in zend_compile_file and zend_compile_string and then swapping their handlers.

In general, this would also be a first step in directly tying the object handlers to classes. Especially given that I am not aware of any case where the object handlers would be different between various instances of a given class.

Signed-off-by: Bob Weinand <bobwei9@hotmail.com>

show more ...


# 9cb512ec 04-Apr-2022 Bob Weinand

Ensure correct target opline for exceptions thrown during yield from

Also appends the exception during a yield from values dtor instead of prepending it

Fixing regression introduced

Ensure correct target opline for exceptions thrown during yield from

Also appends the exception during a yield from values dtor instead of prepending it

Fixing regression introduced in 13649451c201361b438ca0f762cfb33dfc3fca39.

show more ...


# 13649451 01-Apr-2022 Bob Weinand

Fix GH-8289: Exceptions thrown within a yielded from iterator are not rethrown into the generator

This also fixes the fact that exception traces were not including the generator frame when t

Fix GH-8289: Exceptions thrown within a yielded from iterator are not rethrown into the generator

This also fixes the fact that exception traces were not including the generator frame when thrown in a yielded from iterator.

show more ...


# 01702a85 28-Feb-2022 Dmitry Stogov

Fix use after free

Fixes oss-fuzz #44885


# 84a638a3 18-Feb-2022 Dmitry Stogov

Fix memory leak

Fixes oss-fuzz #44685


# 90b7bde6 03-Nov-2021 Dmitry Stogov

Use more compact representation for packed arrays.

- for packed arrays we store just an array of zvals without keys.
- the elements of packed array are accessible throuf as ht->arPacked[

Use more compact representation for packed arrays.

- for packed arrays we store just an array of zvals without keys.
- the elements of packed array are accessible throuf as ht->arPacked[i]
instead of ht->arData[i]
- in addition to general ZEND_HASH_FOREACH_* macros, we introduced similar
familied for packed (ZEND_HASH_PACKED_FORECH_*) and real hashes
(ZEND_HASH_MAP_FOREACH_*)
- introduced an additional family of macros to access elements of array
(packed or real hashes) ZEND_ARRAY_ELEMET_SIZE, ZEND_ARRAY_ELEMET_EX,
ZEND_ARRAY_ELEMET, ZEND_ARRAY_NEXT_ELEMENT, ZEND_ARRAY_PREV_ELEMENT
- zend_hash_minmax() prototype was changed to compare only values

Because of smaller data set, this patch may show performance improvement
on some apps and benchmarks that use packed arrays. (~1% on PHP-Parser)

TODO:
- sapi/phpdbg needs special support for packed arrays (WATCH_ON_BUCKET).
- zend_hash_sort_ex() may require converting packed arrays to hash.

show more ...


# 6d505d44 22-Jul-2021 Nikita Popov

Add RETURN/RETVAL_COPY_DEREF() macros

These were missing from the set...

I think quite a few of these usages don't actually need the DEREF,
but I've just kept things as is for n

Add RETURN/RETVAL_COPY_DEREF() macros

These were missing from the set...

I think quite a few of these usages don't actually need the DEREF,
but I've just kept things as is for now.

show more ...


# 814a9327 16-Jul-2021 Nikita Popov

Add ZEND_ACC_NOT_SERIALIZABLE flag

This prevents serialization and unserialization of a class and its
children in a way that does not depend on the zend_class_serialize_deny
and zend

Add ZEND_ACC_NOT_SERIALIZABLE flag

This prevents serialization and unserialization of a class and its
children in a way that does not depend on the zend_class_serialize_deny
and zend_class_unserialize_deny handlers that will be going away
in PHP 9 together with the Serializable interface.

In stubs, `@not-serializable` can be used to set this flag.

This patch only uses the new flag for a handful of Zend classes,
converting the remainder is left for later.

Closes GH-7249.
Fixes bug #81111.

show more ...


# 44110262 04-May-2021 Nikita Popov

Close generator already in dtor phase

In the added test case, the Closure ends up being freed before
the generator during GC.

This patch closes the generator (and thus releases

Close generator already in dtor phase

In the added test case, the Closure ends up being freed before
the generator during GC.

This patch closes the generator (and thus releases the held
closure / execute_data) already during dtor_obj, which will avoid
ordering issues in free_obj. dtor_obj is not always called, but
if it isn't, then we also won't run GC and will free_obj in
reverse construction order.

Fixes oss-fuzz #33947.

show more ...


# 462da6e0 31-Mar-2021 Josh Soref

Fix spelling and grammar mistakes

This PR corrects misspellings identified by the check-spelling action.

The misspellings have been reported at jsoref@b6ba3e2#commitcomment-48946465

Fix spelling and grammar mistakes

This PR corrects misspellings identified by the check-spelling action.

The misspellings have been reported at jsoref@b6ba3e2#commitcomment-48946465

The action reports that the changes in this PR would make it happy: jsoref@602417c

Closes GH-6822.

show more ...


# 1954e597 26-Jan-2021 Máté Kocsis

Add support for generating class entries from stubs

Closes GH-6289

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>


12345678910>>...12