History log of /php-src/ext/standard/array.c (Results 26 – 50 of 1117)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# fe2dc2b4 03-Feb-2023 Tyson Andre

Avoid crash for reset/end/next/prev() on ffi classes (#9711)

(And any PECLs returning `zend_empty_array` in the handler->get_properties
overrides)

Closes GH-9697

This i

Avoid crash for reset/end/next/prev() on ffi classes (#9711)

(And any PECLs returning `zend_empty_array` in the handler->get_properties
overrides)

Closes GH-9697

This is similar to the fix used in d9651a941915eb5fb5ad557090b65256fd8509b6
for array_walk.

This should make it safer for php-src (and PECLs, long-term) to return
the empty immutable array in `handler->get_properties` to avoid wasting memory.
See https://github.com/php/php-src/issues/9697#issuecomment-1273613175

The only possible internal iterator position for the empty array is at the end
of the empty array (nInternalPointer=0).
The `zend_hash*del*` helpers will always set nInternalPointer to 0 when an
array becomes empty,
regardless of previous insertions/deletions/updates to the array.

show more ...


# 7936c808 23-Jan-2023 Máté Kocsis

Fix GH-8329 Print true/false instead of bool in error and debug messages (#8385)


# c8955c07 16-Jan-2023 Christoph M. Becker

Revert GH-10220

Cf. <https://github.com/php/php-src/pull/10220#issuecomment-1383739816>.

This reverts commit ecc880f491d66081298a16634629f149459706a9.
This reverts commit 588a07

Revert GH-10220

Cf. <https://github.com/php/php-src/pull/10220#issuecomment-1383739816>.

This reverts commit ecc880f491d66081298a16634629f149459706a9.
This reverts commit 588a07f7371ee2b5fac17de147926780e427fae6.
This reverts commit f377e15751d3aa48b69cd9bcc366ede7803d511f.
This reverts commit b4ba16fe189b109144aff669e11d81365160104b.
This reverts commit 694ec1deea36e366b28b6349a52be49824e1a1a8.
This reverts commit 6b34de8eba9f66882ae16e6073af28783670ac53.
This reverts commit aa1cd02a4367834026ea2205ea13a2f904455aa1.
This reverts commit 308fd311ea6fcf3094b448df7f2b264f08e4fe4f.
This reverts commit 16203b53e1822a37b6ba6f2ab198bb435d05fdad.
This reverts commit 738fb5ca5412f5e833a7fab82b11519e635a3357.
This reverts commit 9fdbefacd3c382d731aa175b7bdc002ec9cb2b30.
This reverts commit cd4a7c1d90562ebb5f89caf94d00d579631b9fbe.
This reverts commit 928685eba2b2f0ded90e7f78fd806ea164002f6e.
This reverts commit 01e5ffc85cd4357fd7b5b7ceefa29f2d10ca26b7.

show more ...


# 6ab50381 14-Jan-2023 Niels <7771979+nielsdos@users.noreply.github.com>

Make array_pad's $length warning less confusing (#10149)

Remove array_pad's arbitrary length restriction

The error message was wrong; it *is* possible to use a larger length.
Fu

Make array_pad's $length warning less confusing (#10149)

Remove array_pad's arbitrary length restriction

The error message was wrong; it *is* possible to use a larger length.
Furthermore, there is an arbitrary restriction on the new array's
length.

Fix both by checking the length against HT_MAX_SIZE.

show more ...


# 308fd311 04-Jan-2023 Max Kellermann

ext/{standard,json,random,...}: add missing includes


# d9651a94 10-Oct-2022 Dmitry Stogov

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


Revision tags: php-8.2.0RC1, php-8.1.10, php-8.0.23
# bc4c0126 24-Aug-2022 Máté Kocsis

Declare ext/standard constants in stubs - part 1 (#9404)

Revision tags: php-8.0.23RC1, php-8.1.10RC1, php-8.2.0beta3
# 1094a859 12-Aug-2022 Christoph M. Becker

Merge branch 'PHP-8.1'

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


# 7908aae3 12-Aug-2022 Christoph M. Becker

Merge branch 'PHP-8.0' into PHP-8.1

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


# 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 ...

# ad04345e 04-Aug-2022 Christoph M. Becker

Fix GH-9244: Segfault with array_multisort + array_shift

After restructuring non-packed arrays, we either need to pack them if
possible, or to rehash them.

Closes GH-9247.

# 55f8c142 04-Aug-2022 Christoph M. Becker

Avoid unnecessary comparison

The first element of the `arrays` serves as base for the comparison, so
there is no need to compare it to itself.

Closes GH-9246.

Revision tags: php-8.2.0beta2, php-8.1.9, php-8.0.22
# 5c693c77 26-Jul-2022 Tim Düsterhus

Remove `->last_unsafe` from php_random_status (#9132)

Whenever ->last_unsafe is set to `true` an exception has been thrown. Thus we
can replace the check for `->last_unsafe` with a check

Remove `->last_unsafe` from php_random_status (#9132)

Whenever ->last_unsafe is set to `true` an exception has been thrown. Thus we
can replace the check for `->last_unsafe` with a check for `EG(exception)`
which is a much more natural way to ommunicate an error up the chain.

show more ...

Revision tags: php-8.1.9RC1, php-8.2.0beta1, php-8.0.22RC1
# 4d8dd8d2 19-Jul-2022 Go Kudo

Implement Random Extension

https://wiki.php.net/rfc/rng_extension
https://wiki.php.net/rfc/random_extension_improvement

# 75a9a5f3 11-Jul-2022 Tim Düsterhus

Add `zend_array_to_list()` (#8976)

* Add zend_array_to_list()

* Use `zend_array_to_list()` in `PHP_FUNCTION(array_values)`

Revision tags: php-8.0.21, php-8.1.8, php-8.2.0alpha3, php-8.1.8RC1, php-8.2.0alpha2
# 1a3d836f 21-Jun-2022 Christoph M. Becker

Fix CS (missing space)

Revision tags: php-8.0.21RC1
# a1b05a3a 20-Jun-2022 Christoph M. Becker

Tweak $count range check of array_fill()

We fix the `UNEXPECTED(EXPECTED(…))`, which does not make sense, and
replace the magic number with the respective macro. We also add a
test

Tweak $count range check of array_fill()

We fix the `UNEXPECTED(EXPECTED(…))`, which does not make sense, and
replace the magic number with the respective macro. We also add a
test case to verify the expected behavior for an `array_fill()` edge
case.

Closes GH-8804.

show more ...

Revision tags: php-8.0.20, php-8.1.7, php-8.2.0alpha1, php-7.4.30, php-8.1.7RC1, php-8.0.20RC1, php-8.1.6, php-8.0.19, php-8.1.6RC1, php-8.0.19RC1, php-8.0.18, php-8.1.5, php-7.4.29, php-8.1.5RC1, php-8.0.18RC1
# e948d3c9 23-Mar-2022 George Peter Banyard

Use zend_string_to(upper|lower)() API directly

Revision tags: php-8.1.4, php-8.0.17, php-8.1.4RC1, php-8.0.17RC1, php-8.1.3, php-8.0.16, php-7.4.28, php-8.1.3RC1, php-8.0.16RC1, php-8.1.2, php-8.0.15, php-8.1.2RC1, php-8.0.15RC1
# 5d6bc250 22-Dec-2021 Dmitry Stogov

Reset Bucket->key of deleted HastTable elemets to NULL.

This allows elimination of some Z_ISUNDEF(Bucket->val) checks.

Revision tags: php-8.0.14, php-8.1.1, php-7.4.27, php-8.1.1RC1, php-8.0.14RC1, php-7.4.27RC1
# fbdded1f 28-Nov-2021 Tyson Andre

Use interned string for calling count() in Zend VM

Similar to f0dd79a7e415d8b1d4a3868a27975d6578c87961

Copied from GH-7695

Revision tags: php-8.1.0, php-8.0.13, php-7.4.26, php-7.3.33
# 8a28ab68 16-Nov-2021 Nikita Popov

Merge branch 'PHP-8.1'

* PHP-8.1:
Safely reassign array in usort()


# 2d14ec9d 16-Nov-2021 Nikita Popov

Merge branch 'PHP-8.0' into PHP-8.1

* PHP-8.0:
Safely reassign array in usort()


# 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 ...

Revision tags: php-8.1.0RC6
# 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 ...

Revision tags: php-7.4.26RC1, php-8.0.13RC1, php-8.1.0RC5, php-7.3.32, php-7.4.25, php-8.0.12, php-8.1.0RC4, php-8.0.12RC1, php-7.4.25RC1, php-8.1.0RC3, php-8.0.11, php-7.4.24, php-7.3.31, php-8.1.0RC2, php-7.4.24RC1, php-8.0.11RC1, php-8.1.0RC1
# a13730c5 01-Sep-2021 twosee

Simplify zend_forbid_dynamic_call() (#7443)

The special cases (parse_str/mb_parse_str with a single argument) have been removed completely, we can simplify it now.

12345678910>>...45