History log of /PHP-8.3/ext/spl/spl_heap.c (Results 1 – 25 of 157)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# a56ff4fe 10-Oct-2024 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix GH-16337: Use-after-free in SplHeap

We introduce a new flag to indicate when a heap or priority queue is
write-locked. In principle we could've used SPL_HEAP_CORRUPTED too, but
t

Fix GH-16337: Use-after-free in SplHeap

We introduce a new flag to indicate when a heap or priority queue is
write-locked. In principle we could've used SPL_HEAP_CORRUPTED too, but
that won't be descriptive to users (and it's a lie too).

Closes GH-16346.

show more ...


# 1fbb6665 17-Jul-2024 Arnaud Le Blanc

Use zend_std_build_properties() to access zend_object.properties

The zend_object.properties HashTable needs to be built just in time by calling
rebuild_object_properties() on the object

Use zend_std_build_properties() to access zend_object.properties

The zend_object.properties HashTable needs to be built just in time by calling
rebuild_object_properties() on the object before accessing it. Normally this is
done automatically in zend_std_get_properties(), but we do it manually in a few
places.

In this change I introduce an inline variant of zend_std_build_properties(), and
refactor these places to use it instead of calling rebuild_object_properties()
manually.

rebuild_object_properties() renamed as rebuild_object_properties_internal(), to
enforce usage of zend_std_get_properties() or zend_std_build_properties_ex().

Closes GH-14996

show more ...


# 80941042 09-Jun-2024 Gina Peter Banyard

ext/spl: Refactor debug handlers

Mainly to use zend_mangle_property_name() directly instead of spl_gen_private_prop_name()


# 54047c10 09-Jun-2024 Gina Peter Banyard

ext/spl: Remove some useless header includes and clarify usages


# a5cacba6 08-Jun-2024 Gina Peter Banyard

ext/spl: Remove spl_engine.h header (#14418)

And convert calls to spl_instantiate_arg_* to the new object_init_with_constructor() API


# 0de88dfb 28-Feb-2024 Gina Peter Banyard

ext/spl: mark all zend_object_handlers as static (#13547)


# 97267215 10-Jan-2024 David CARLIER

general signatures discrepencies fixes (#13122)


# 0956267c 23-Jul-2024 Levi Morrison

Fix warnings in session/spl

This fixes -Winline errors where the functions are not ever inlined.

Also fixes some signature mismatches which were fixed previously but
for whateve

Fix warnings in session/spl

This fixes -Winline errors where the functions are not ever inlined.

Also fixes some signature mismatches which were fixed previously but
for whatever reason were not ported to all maintained branches:

/usr/local/src/php/ext/session/session.c:1299:20:
warning:conflicting types for 'php_session_send_cookie' due to enum/integer mismatch;
have 'zend_result(void)' {aka 'ZEND_RESULT_CODE(void)'} [-Wenum-int-mismatch]
1299 | static zend_result php_session_send_cookie(void) /* {{{ */
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/local/src/php/ext/session/session.c:100:12:
note: previous declaration of 'php_session_send_cookie' with type 'int(void)'
100 | static int php_session_send_cookie(void);
| ^~~~~~~~~~~~~~~~~~~~~~~

show more ...


# ee000ea1 08-Aug-2023 Ilija Tovilo

Fix uouv on oom on object allocation

We may OOM during object initialization. In this case, free_obj needs to guard
against NULL values. There may be more cases where this is an issue, t

Fix uouv on oom on object allocation

We may OOM during object initialization. In this case, free_obj needs to guard
against NULL values. There may be more cases where this is an issue, these were
the ones I was able to discover via script.

Fixes GH-11734

show more ...


# d5ad7510 08-Jun-2023 George Peter Banyard

More usage of known zend_str instead of C string (#11381)


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

Micro-optimize double comparison (#11061)

When using ZEND_NORMALIZE_BOOL(a - b) where a and b are doubles, this
generates the following instruction sequence on x64:
subsd xmm0, xmm

Micro-optimize double comparison (#11061)

When using ZEND_NORMALIZE_BOOL(a - b) where a and b are doubles, this
generates the following instruction sequence on x64:
subsd xmm0, xmm1
pxor xmm1, xmm1
comisd xmm0, xmm1
...

whereas if we use ZEND_THREEWAY_COMPARE we get two instructions less:
ucomisd xmm0, xmm1

The only difference is that the threeway compare uses *u*comisd instead
of comisd. The difference is that it will cause a FP signal if a
signaling NAN is used, but as far as I'm aware this doesn't matter for
our use case.

Similarly, the amount of instructions on AArch64 is also quite a bit
lower for this code compared to the old code.

** Results **

Using the benchmark https://gist.github.com/nielsdos/b36517d81a1af74d96baa3576c2b70df
I used hyperfine: hyperfine --runs 25 --warmup 3 './sapi/cli/php sort_double.php'
No extensions such as opcache used during benchmarking.

BEFORE THIS PATCH
-----------------
Time (mean ± σ): 255.5 ms ± 2.2 ms [User: 251.0 ms, System: 2.5 ms]
Range (min … max): 251.5 ms … 260.7 ms 25 runs

AFTER THIS PATCH
----------------
Time (mean ± σ): 236.2 ms ± 2.8 ms [User: 228.9 ms, System: 5.0 ms]
Range (min … max): 231.5 ms … 242.7 ms 25 runs

show more ...


# 2b15061f 01-Mar-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Use zend_result in ext/spl where appropriate (#10734)

* Convert functions in spl_heap to return zend_result

* Convert functions in spl_iterators to return zend_result


# 90047253 26-Feb-2023 Marcos Marcolin <48370677+marcosmarcolin@users.noreply.github.com>

chore: standardize the visibility of functions. (#10708)

Co-authored-by: Marcos Marcolin <marcos@ixcsoft.com.br>


# d1fc0017 14-Sep-2022 Bob Weinand

Revert "Fix compilation on MacOS"

This reverts commit 800c6672e57a01d68dcaba36f8f7d65c6871aafc.

Reverted along with a01dd9fedaecd2e5b95bc5c2e8d6542116addeae.


Revision tags: php-8.2.0RC1, php-8.1.10, php-8.0.23
# 800c6672 24-Aug-2022 Bob Weinand

Fix compilation on MacOS

memrchr has an always available equivalent under the name of zend_memrchr.

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


Revision tags: php-8.0.23RC1, php-8.1.10RC1, php-8.2.0beta3
# b73f139c 02-Aug-2022 Máté Kocsis

Declare ext/spl constants in stubs (#9226)


Revision tags: php-8.2.0beta2, php-8.1.9, php-8.0.22, php-8.1.9RC1, php-8.2.0beta1, php-8.0.22RC1, php-8.0.21, php-8.1.8, php-8.2.0alpha3
# dfbb4252 04-Jul-2022 David Carlier

Use `safe_*erealloc*` flavor in few places to mitigate possible overflows.


# 3b92a966 25-Jun-2022 Ilija Tovilo

Convert return type of various object handlers from int to zend_result (#8755)


Revision tags: php-8.1.8RC1, php-8.2.0alpha2, php-8.0.21RC1, 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
# cfc38a60 13-Apr-2022 George Peter Banyard

SPL: minor refactoring (#8341)

Use more appropriate types and return macros


Revision tags: php-8.0.18, php-8.1.5, php-7.4.29, php-8.1.5RC1, php-8.0.18RC1, 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, php-8.0.14, php-8.1.1, php-7.4.27, php-8.1.1RC1, php-8.0.14RC1, php-7.4.27RC1, php-8.1.0, php-8.0.13, php-7.4.26, php-7.3.33, php-8.1.0RC6, 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
# 644710ee 24-Sep-2021 Nikita Popov

Remove unused flags from spl_heap_it

Which makes it equivalent to just zend_user_iterator, so drop the
wrapper entirely.


Revision tags: 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, php-7.4.23, php-8.0.10, php-7.3.30, php-8.1.0beta3, php-8.0.10RC1, php-7.4.23RC1, php-8.1.0beta2, php-8.0.9, php-7.4.22
# 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 ...


Revision tags: php-8.1.0beta1, php-7.4.22RC1, php-8.0.9RC1, php-8.1.0alpha3, php-7.4.21, php-7.3.29, php-8.0.8, php-8.1.0alpha2, php-7.4.21RC1, php-8.0.8RC1
# 9d2a466c 09-Jun-2021 Nikita Popov

Remove explicit assignments of zend_objects_destroy_object

This is the default handler, no need to set it explicitly. This
makes it easier to see which objects really have a custom dtor_

Remove explicit assignments of zend_objects_destroy_object

This is the default handler, no need to set it explicitly. This
makes it easier to see which objects really have a custom dtor_obj.

show more ...


Revision tags: php-8.1.0alpha1, php-8.0.7, php-7.4.20, php-8.0.7RC1, php-7.4.20RC1
# 01b3fc03 06-May-2021 KsaR

Update http->https in license (#6945)

1. Update: http://www.php.net/license/3_01.txt to https, as there is anyway server header "Location:" to https.
2. Update few license 3.0 to 3.01 as

Update http->https in license (#6945)

1. Update: http://www.php.net/license/3_01.txt to https, as there is anyway server header "Location:" to https.
2. Update few license 3.0 to 3.01 as 3.0 states "php 5.1.1, 4.1.1, and earlier".
3. In some license comments is "at through the world-wide-web" while most is without "at", so deleted.
4. fixed indentation in some files before |

show more ...


Revision tags: php-8.0.6, php-7.4.19, php-7.4.18, php-7.3.28, php-8.0.5, php-8.0.5RC1, php-7.4.18RC1
# 3a05cda3 12-Apr-2021 K <127853+kaja47@users.noreply.github.com>

SplPriorityQueue performance improvements (#6859)

This optimization is targeting cases when a SplPriorityQueue instance is used
exclusively with double or long priorities.

Durin

SplPriorityQueue performance improvements (#6859)

This optimization is targeting cases when a SplPriorityQueue instance is used
exclusively with double or long priorities.

During the first insertion into an empty queue, the comparator is changed to
the specialized one if the priority of inserted inserted key is long or double.
During insertion to non-empty queue, comparator is swapped back to the generic
one on type conflict.

As a result code like following, where the weight field is always double or
int, runs almost twice as fast.

foreach ($items as $item) {
$pqueue->insert($item, -$item->weight);
if ($pqueue->count() > $size) {
$pqueue->extract();
}
}

show more ...


# dc47b993 11-Apr-2021 K

SplHeap: replace zend_parse_parameters with ZEND_PARSE_PARAMETERS* macros

this change alone speeds up top-k computation significantly


1234567