mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Fix incorrect page_size check
The current check always evaluated to false because if `!page_size` is true, then `page_size & (page_size - 1)` equals `0 & (0 - 1)` which is always 0. The if condition is meant to check if page_size is zero or not a power of two, thus we must change the AND to an OR to fix this issue. Closes GH-10427 Signed-off-by: George Peter Banyard <girgias@php.net>
This commit is contained in:
parent
40da9961f2
commit
b7a158a19b
2 changed files with 4 additions and 1 deletions
3
NEWS
3
NEWS
|
@ -9,6 +9,9 @@ PHP NEWS
|
|||
- FFI:
|
||||
. Fixed incorrect bitshifting and masking in ffi bitfield. (nielsdos)
|
||||
|
||||
- Opcache:
|
||||
. Fix incorrect page_size check. (nielsdos)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug GH-10292 (Made the default value of the first param of srand() and
|
||||
mt_srand() unknown). (kocsismate)
|
||||
|
|
|
@ -3197,7 +3197,7 @@ static zend_result accel_post_startup(void)
|
|||
size_t page_size;
|
||||
|
||||
page_size = zend_get_page_size();
|
||||
if (!page_size && (page_size & (page_size - 1))) {
|
||||
if (!page_size || (page_size & (page_size - 1))) {
|
||||
zend_accel_error_noreturn(ACCEL_LOG_FATAL, "Failure to initialize shared memory structures - can't get page size.");
|
||||
abort();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue