[php-src] PR #21841: Zlib: Fix the bug when `zval_get_long` silently cast `$strategy` into long in `deflate_init`
| From: | LamentXU123 | Date: | Thu, 23 Apr 2026 11:26:26 +0000 |
| Subject: | [php-src] PR #21841: Zlib: Fix the bug when `zval_get_long` silently cast `$strategy` into long in `deflate_init` | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-35845@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/21841
Author: LamentXU123
When looking at https://github.com/php/php-tasks/issues/32,
it reminds me of a bug I know years ago in zlib where users can pass arrays to
deflate_init as a strategy. Reason here is we use zval_get_long which
silently cast user's input into long.
Now as per the php-task issue:
> Ideally, those usages should be reviewed and use the corresponding try function when available.
I would like to open this PR to use zval_try_get_long instead in this case. Not sure if
this worth a NEWS entry.