History log of /PHP-8.0/ext/standard/array.c (Results 1 – 25 of 961)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# d9651a94 10-Oct-2022 Dmitry Stogov

Fix GH-9697: array_walk($ffiInstance, function () {}) crashes due to expecting mutable array


# 725cb4e8 29-Aug-2022 Christoph M. Becker

Revert "Fix GH-9296: `ksort` behaves incorrectly on arrays with mixed keys"

This reverts commit cd1aed8eddd2dccbb55fb1bc3d67b23a8455248c, as
discussed on internals (<https://externals.io

Revert "Fix GH-9296: `ksort` behaves incorrectly on arrays with mixed keys"

This reverts commit cd1aed8eddd2dccbb55fb1bc3d67b23a8455248c, as
discussed on internals (<https://externals.io/message/118483>).

show more ...


# cd1aed8e 11-Aug-2022 Denis Vaksman

Fix GH-9296: `ksort` behaves incorrectly on arrays with mixed keys

The comparator function used at ksort in SORT_REGULAR mode
need to be consistent with basic comparison rules. These rul

Fix GH-9296: `ksort` behaves incorrectly on arrays with mixed keys

The comparator function used at ksort in SORT_REGULAR mode
need to be consistent with basic comparison rules. These rules
were changed in PHP-8.0 for numeric strings, but comparator
used at ksort kept the old behaviour. It leads to inconsistent
situations, when after ksort the first key is GREATER than some
of the next ones by according to the basic comparison operators.

Closes GH-9293.

show more ...


# 18a0d46a 16-Nov-2021 Nikita Popov

Safely reassign array in usort()

Make sure to destroy the old value only after assigning the new
one. Otherwise we may try to double free, e.g. if GC runs during
this dtor.

Safely reassign array in usort()

Make sure to destroy the old value only after assigning the new
one. Otherwise we may try to double free, e.g. if GC runs during
this dtor.

This caused an assertion failure in phpro/grumphp and is likely
the cause for bug #81603 as well.

(cherry picked from commit 6f38acfaf906482a70dfb528ba0e427efbd8e2db)

(I applied this to the wrong base branch at first...)

show more ...


# 6f38acfa 16-Nov-2021 Nikita Popov

Safely reassign array in usort()

Make sure to destroy the old value only after assigning the new
one. Otherwise we may try to double free, e.g. if GC runs during
this dtor.

Safely reassign array in usort()

Make sure to destroy the old value only after assigning the new
one. Otherwise we may try to double free, e.g. if GC runs during
this dtor.

This caused an assertion failure in phpro/grumphp and is likely
the cause for bug #81603 as well.

show more ...


# f40c8fdf 15-Apr-2021 Nikita Popov

Fix return-by-ref from array_reduce callback

Fixes oss-fuzz #32990.


# c5670169 16-Dec-2020 Nikita Popov

Detect overlarge step for character range()

This was done for int and float ranges, but not char ranges.

Fixes oss-fuzz #28666.


Revision tags: php-8.0.0, php-7.3.25, php-7.4.13, php-8.0.0RC5, php-7.4.13RC1, php-8.0.0RC4, php-7.3.25RC1, php-7.4.12, php-8.0.0RC3, php-7.3.24, php-8.0.0RC2, php-7.4.12RC1, php-7.3.24RC1, php-7.2.34, php-8.0.0rc1, php-7.4.11, php-7.3.23
# 2ee7e298 21-Sep-2020 George Peter Banyard

Promote count() warning to TypeError

Closes GH-6180


Revision tags: php-8.0.0beta4, php-7.4.11RC1, php-7.3.23RC1
# c37a1cd6 10-Sep-2020 Máté Kocsis

Promote a few remaining errors in ext/standard

Closes GH-6110


# da0663a3 15-Sep-2020 Nikita Popov

Add GC_TRY_ADDREF macro

That adds a ref if not immutable. Also audit uses of GC_IMMUTABLE
to either use GC_TRY_ADDREF or GC_TRY_PROTECT_RECURSION.


# 73ab7b30 08-Sep-2020 Nikita Popov

Allow array_diff() and array_intersect() with single array argument

Both of these functions are well-defined when used with a single
array argument -- rejecting this case was an artifici

Allow array_diff() and array_intersect() with single array argument

Both of these functions are well-defined when used with a single
array argument -- rejecting this case was an artificial limitation.
This is not useful when called with explicit arguments, but removes
edge-cases when used with argument unpacking:

// OK even if $excludes is empty.
array_diff($array, ...$excludes);

// OK even if $arrays contains a single array only.
array_intersect(...$arrays);

This matches the behavior of functions like array_merge() and
array_push(), which also allow calls with no array or a single
array respectively.

Closes GH-6097.

show more ...


Revision tags: php-8.0.0beta3, php-7.4.10, php-7.3.22, php-8.0.0beta2, php-7.3.22RC1, php-7.4.10RC1
# 9975986b 16-Aug-2020 Máté Kocsis

Improve error messages mentioning parameters instead of arguments

Closes GH-5999


# 2e218180 04-Sep-2020 Nikita Popov

Release call trampolines in zpp fcc

When using zpp 'f' or Z_PARAM_FUNC, if the fcc points to a call
trampoline release it immediately and force zend_call_function
to refetch it. This

Release call trampolines in zpp fcc

When using zpp 'f' or Z_PARAM_FUNC, if the fcc points to a call
trampoline release it immediately and force zend_call_function
to refetch it. This may require additional callability checks
if __call is used, but avoids the need to carefully free fcc
values in all internal functions -- in some cases this is not
simple, as a type error might be triggered by a later argument
in the same zpp call.

This fixes oss-fuzz #25390.

Closes GH-6073.

show more ...


# e81becce 31-Aug-2020 Nikita Popov

Fix trampoline leak in array_map


# 1e9a5c67 10-Aug-2020 Tyson Andre

Rename standard array function parameters to $array

This is targeting 8.0.

`$arg` seems like a poor choice of a name,
especially if the function were to have arguments added.

Rename standard array function parameters to $array

This is targeting 8.0.

`$arg` seems like a poor choice of a name,
especially if the function were to have arguments added.

In many cases, the php.net documentation already has $array for these functions.
E.g. https://www.php.net/manual/en/function.array-intersect.php

I'd assume that since named arguments was added to 8.0 near the feature freeze,
PHP's maintainers had planned to make the names consistent
and gradually use the same name for docs and implementation.

show more ...


# da786a22 05-Aug-2020 Nikita Popov

Fixed bug #79930

We're inserting src_zval, so that's what we should addref.


Revision tags: php-8.0.0beta1, php-7.4.9, php-7.2.33, php-7.3.21, php-8.0.0alpha3, php-7.4.9RC1, php-7.3.21RC1
# 6f8d0ba0 20-Jul-2020 Nikita Popov

Fix bug #79868

This simply restores the code from PHP 7.4 which I incorrectly
"simplified" in master.


# 0c28b471 17-Jul-2020 Nikita Popov

Fixed bug #79839

Add reference type sources in array_walk.


Revision tags: php-7.4.8, php-7.2.32, php-8.0.0alpha2
# 302933da 07-Jul-2020 Nikita Popov

Remove no_separation flag


# dadb92ea 07-Jul-2020 Nikita Popov

Don't allow separation in array functions

The only case here that might be *somewhat* sensible is the userdata
argument of array_walk(), which could be used to keep persistent state

Don't allow separation in array functions

The only case here that might be *somewhat* sensible is the userdata
argument of array_walk(), which could be used to keep persistent state
between callback invokations -- with the WTF moment that the final
result after the walk finishes will be unchanged. Nowdays, this is
much better achieved using a closure with a use-by-reference.

show more ...


Revision tags: php-7.3.20
# 2b5de6f8 01-Jul-2020 Max Semenik

Remove proto comments from C files

Closes GH-5758


# bcd7352b 26-Jun-2020 Nikita Popov

Fix uninitialized reads in min/max

We need to use the unstable comparison function here, the fallback
order is not initialized in this context.


Revision tags: php-8.0.0alpha1, php-7.4.8RC1, php-7.3.20RC1, php-7.4.7, php-7.3.19, php-7.4.7RC1, php-7.3.19RC1, php-7.4.6, php-7.2.31, php-7.4.6RC1, php-7.3.18RC1, php-7.2.30, php-7.4.5, php-7.3.17, php-7.4.5RC1, php-7.3.17RC1, php-7.3.18, php-7.4.4, php-7.2.29, php-7.3.16
# e12b9df0 04-Mar-2020 Nikita Popov

Make sorting stable

Make user-exposed sorts stable, by storing the position of elements
in the original array, and using those positions as a fallback
comparison criterion. The base

Make sorting stable

Make user-exposed sorts stable, by storing the position of elements
in the original array, and using those positions as a fallback
comparison criterion. The base sort is still hybrid q/insert.

The use of true/false comparison functions is deprecated (but still
supported) and should be replaced by -1/0/1 comparison functions,
driven by the <=> operator.

RFC: https://wiki.php.net/rfc/stable_sorting

Closes GH-5236.

show more ...


# 15846ff1 17-Jun-2020 Nikita Popov

Add ZVAL_OBJ_COPY macro

For the common ZVAL_OBJ + GC_ADDREF pattern.
This mirrors the existing ZVAL_STR_COPY API.


# 83a77015 08-Jun-2020 twosee

Add helper APIs for maybe-interned string creation

Add ZVAL_CHAR/RETVAL_CHAR/RETURN_CHAR as a shortcut for using
ZVAL_INTERNED_STRING and ZSTR_CHAR.

Add zend_string_init_fast()

Add helper APIs for maybe-interned string creation

Add ZVAL_CHAR/RETVAL_CHAR/RETURN_CHAR as a shortcut for using
ZVAL_INTERNED_STRING and ZSTR_CHAR.

Add zend_string_init_fast() as a helper for the empty string /
one char interned string / zend_string_init() pattern.

Also add corresponding ZVAL_STRINGL_FAST etc macros.

Closes GH-5684.

show more ...


12345678910>>...39