[php-src] PR #16072: random: Do not use `ZVAL_DUP` in `Randomizer::shuffleArray()`
| From: | TimWolla | Date: | Thu, 26 Sep 2024 14:01:10 +0000 |
| Subject: | [php-src] PR #16072: random: Do not use `ZVAL_DUP` in `Randomizer::shuffleArray()` | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-28819@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/16072
Author: TimWolla
PHP Internals Book says:
> The ZVAL_DUP macro is similar to ZVAL_COPY, but will duplicate arrays, rather
> than just incrementing their refcount. If you are using this macro, you are
> almost certainly doing something very wrong.
Replace this by an explicit call to
zend_array_dup(), as done in
php_array_diff(). Besides being more explicit in what is happening, this likely also
results in better assembly.