History log of /php-src/ext/standard/string.c (Results 1 – 25 of 1286)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 75e3f3e0 05-Mar-2024 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Optimize strpbrk (#13558)


# dce6ed31 26-Feb-2024 Tim Düsterhus

random: Adjust `status` to `state` (#13521)

* random: Rename `status` local to `state`

* random: Rename `php_random_algo_with_state`'s `status` member to `state`


# 79133df1 25-Feb-2024 Tim Düsterhus

random: Pass algorithm and state together as `php_random_algo_with_state` (#13350)

* random: Remove `php_random_status`

Since 162e1dce9870168cb8c65c013f2b5a510b6536b1, the `php_rand

random: Pass algorithm and state together as `php_random_algo_with_state` (#13350)

* random: Remove `php_random_status`

Since 162e1dce9870168cb8c65c013f2b5a510b6536b1, the `php_random_status` struct
contains just a single `void*`, resulting in needless indirection when
accessing the engine state and thus decreasing readability because of the
additional non-meaningful `->state` references / the local helper variables.

There is also a small, but measurable performance benefit:

<?php
$e = new Random\Engine\Xoshiro256StarStar(0);
$r = new Random\Randomizer($e);

for ($i = 0; $i < 15; $i++)
var_dump(strlen($r->getBytes(100000000)));

goes from roughly 3.85s down to 3.60s.

The names of the `status` variables have not yet been touched to keep the diff
small. They will be renamed to the more appropriate `state` in a follow-up
cleanup commit.

* Introduce `php_random_algo_with_state`

show more ...


# 631bc816 06-Feb-2024 Ilija Tovilo

Implement stackless internal function calls

Co-authored-by: Dmitry Stogov <dmitry@zend.com>

Closes GH-12461


# 927adfb1 20-Dec-2023 Cristian Rodríguez

Use a single version of mempcpy(3) (#12257)

While __php_mempcpy is only used by ext/standard/crypt_sha*, the
mempcpy "pattern" is used everywhere.

This commit removes __php_memp

Use a single version of mempcpy(3) (#12257)

While __php_mempcpy is only used by ext/standard/crypt_sha*, the
mempcpy "pattern" is used everywhere.

This commit removes __php_mempcpy, adds zend_mempcpy and transforms
open-coded parts into function calls.

show more ...


# e7896638 11-Dec-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Remove always-false condition from substr_replace()

l < 0 is checked before and set to a different value.


# f1af7223 01-Dec-2023 Vinicius Dias

Fixing incorrect error message when passing null to join/implode's array parameter (#12683)

Closes GH-12682


# 9a973a37 04-Nov-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Optimize strcspn (#12594)


# d35faecb 01-Nov-2023 Ilija Tovilo

Split strtr zpp (#12583)


# d0b29d82 13-Oct-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Optimize strspn()

The current implementation uses a nested loop (for + goto), which has
complexity O(|s1| * |s2|). If we instead use a lookup table, the
complexity drops to O(|s1| +

Optimize strspn()

The current implementation uses a nested loop (for + goto), which has
complexity O(|s1| * |s2|). If we instead use a lookup table, the
complexity drops to O(|s1| + |s2|).
This is conceptually the same strategy that common C library
implementations such as glibc and musl use.
The variation with a bitvector instead of a table also gives a speed-up,
but the table variation was about 1.34x faster.

On microbenchmarks this easily gave a 5x speedup.

This can bring a 1.4-1.5% performance improvement in the Symfony
benchmark.

Closes GH-12431.

show more ...


# b31a5b27 01-Oct-2023 Ilija Tovilo

Fix str_decrement() on "1"

Closes GH-12339


# b1ce1d1f 24-Aug-2023 Kamil Tekiela

Fix param name in implode() error message


# f25474f7 11-Jun-2023 HypeMC

Add before_needle argument to strrchr()

Closes GH-11430


# d8696f92 17-Jul-2023 George Peter Banyard

[RFC] Path to Saner Increment/Decrement operators (#10358)

* Add behavioural tests for incdec operators

* Add support to ++/-- for objects castable to _IS_NUMBER

* Add str_

[RFC] Path to Saner Increment/Decrement operators (#10358)

* Add behavioural tests for incdec operators

* Add support to ++/-- for objects castable to _IS_NUMBER

* Add str_increment() function

* Add str_decrement() function

RFC: https://wiki.php.net/rfc/saner-inc-dec-operators

Co-authored-by: Ilija Tovilo <ilija.tovilo@me.com>
Co-authored-by: Arnaud Le Blanc <arnaud.lb@gmail.com>

show more ...


# 93e0f6b4 25-Mar-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix undefined behaviour in string uppercasing and lowercasing

At least on 32-bit, the address computations overflow in running the
test on CI with UBSAN enabled. Fix it by reordering the

Fix undefined behaviour in string uppercasing and lowercasing

At least on 32-bit, the address computations overflow in running the
test on CI with UBSAN enabled. Fix it by reordering the arithmetic.
Since a part of the expression is already used in the code above the
computation, this should not negatively affect performance.

Closes GH-10936.

show more ...


# 3821938e 07-Mar-2023 Michael Voříšek

Imply UTF8 validity in implode function (#10780)

Sets the UTF-8 valid flag if all parts are valid, or numeric (which are valid UTF-8 by definition).

* remove unuseful comments

Imply UTF8 validity in implode function (#10780)

Sets the UTF-8 valid flag if all parts are valid, or numeric (which are valid UTF-8 by definition).

* remove unuseful comments

* Imply UTF8 validity in implode function

* revert zend_string_dup change

show more ...


# adc5edd4 26-Feb-2023 George Peter Banyard

Fixed ValueError message in count_chars()

The value of the mode argument must be between 0 and 4 inclusive, not 1 and 4.


# 21339701 26-Feb-2023 George Peter Banyard

Fixed ValueError message in substr_compare()

It used some random argument name instead of


# c2d4bafc 03-Feb-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Copy UTF-8 flag for str_repeat


# 2b55dee4 23-Jan-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Make stripslashes() only dependent on SSE2 configuration. (#10408)

Alex Dowad noticed[1] that the SIMD stripslashes implementation actually
only depended on SSE2, and not on SSE4.2 instr

Make stripslashes() only dependent on SSE2 configuration. (#10408)

Alex Dowad noticed[1] that the SIMD stripslashes implementation actually
only depended on SSE2, and not on SSE4.2 instructions. Remove the
checking for SSE4.2 and only check for SSE2. This also greatly
simplifies the supporting code.

[1] https://github.com/php/php-src/pull/10313#issuecomment-1382825073

show more ...


# 256a34ed 28-Nov-2022 David Carlier

strtok warns in case the string to split was not set.

Close GH-10016.


# 4bbbe6d6 14-Jan-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix substr_replace with slots in repl_ht being UNDEF

The check that was supposed to check whether the array slot was UNDEF
was wrong and never triggered. This resulted in a replacement w

Fix substr_replace with slots in repl_ht being UNDEF

The check that was supposed to check whether the array slot was UNDEF
was wrong and never triggered. This resulted in a replacement with the
empty string or the wrong string instead of the correct one. The correct
check pattern can be observed higher up in the function's code.

Closes GH-10323

Signed-off-by: George Peter Banyard <girgias@php.net>

show more ...


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

Remove useless check, search_str is always true here (#10322)


# 4c9375e5 30-Dec-2022 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix GH-10187: Segfault in stripslashes() with arm64

Closes GH-10188

Co-authored-by: todeveni <toni.viemero@iki.fi>
Signed-off-by: George Peter Banyard <girgias@php.net>


# a4fd2609 13-Oct-2022 Máté Kocsis

Declare ext/standard constants in stubs - part 9 (#9717)


12345678910>>...52