Bug #78639 [Opn]: mysql_xdevapi\CollectionFind::limit returns bool with Zend OPcache enabled
| From: | cmb@php.net | Date: | Thu, 09 Sep 2021 10:44:18 +0000 |
| Subject: | Bug #78639 [Opn]: mysql_xdevapi\CollectionFind::limit returns bool with Zend OPcache enabled | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-236483@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=78639&edit=1
ID: 78639
Updated by: cmb@php.net
Reported by: shaun at shaunfreeman dot name
Summary: mysql_xdevapi\CollectionFind::limit returns bool
with Zend OPcache enabled
Status: Open
Type: Bug
Package: MySQL related
Operating System: Ubuntu 18.04
PHP Version: 7.3.10
Block user comment: N
Private report: N
New Comment:
Is this still an issue with any of the actively supported PHP
versions[1]?
[1] <https://www.php.net/supported-versions.php>
Previous Comments:
------------------------------------------------------------------------
[2019-10-08 07:10:30] shaun at shaunfreeman dot name
opcache.protect_memory=1 nothing seems to change, result is the same.
with opcache.optimization_level=0, that fixes the issue and the right result is returned, no errors.
------------------------------------------------------------------------
[2019-10-07 15:11:40] nikic@php.net
Two things to try:
* Run with opcache.protect_memory=1. Does this result in a segfault?
* Run with opcache.optimization_level=0. Does this fix the issue?
------------------------------------------------------------------------
[2019-10-06 19:26:07] shaun at shaunfreeman dot name
Description:
------------
I have come across a bug when OPcache is enabled. I am using Ubuntu 18.04 and PHP 7.3.10. When
OPcache is enabled then mysql_xdevapi\CollectionFind::limit and mysql_xdevapi\CollectionFind::offset
return bool instead of an mysql_xdevapi\CollectionFind instance.
When OPcache is not loaded then I get the expected result. I am running PHP-FPM on a unix socket
with Nginx
My configure command is
./configure --prefix=/usr/local/php7.3 \
--with-config-file-path=/usr/local/php7.3/etc \
--with-config-file-scan-dir=/usr/local/php7.3/etc/conf.d \
--disable-cgi \
--enable-fpm \
--enable-bcmath \
--with-curl \
--enable-exif \
--with-gd \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--enable-intl \
--enable-mbstring \
--enable-mysqlnd \
--with-mysqli \
--with-pdo-mysql \
--with-mysql-sock=/var/run/mysqld/mysqld.sock \
--with-openssl \
--with-tidy=/usr/local \
--enable-zip \
--with-libzip \
--with-zlib \
--with-zlib-dir
Test script:
---------------
$session = getSession("mysqlzx://dbuser:!OneTwo3@localhost:33060");
$schema = $session->getSchema('dbname');
$collection = $schema->getCollection('posts');
$result = $collection->find()
->offset(0)
->limit(2)
->execute();
print "<pre>";
print_r($result->fetchAll());
Expected result:
----------------
Array
(
[0] => Array
(
[_id] => 02eb5585a3d74645883b200caa70852f
[title] => Title 1
[author] => Shaun Freeman
[content] => Content 1
[dateCreated] => Array
(
[date] => 2019-10-06 17:30:15.466565
[timezone] => UTC
[timezone_type] => 3
)
)
[1] => Array
(
[_id] => 40089f7d6154426cb28300d05d1ace5c
[title] => Title 3
[author] => Shaun Freeman
[content] => Content 3
[dateCreated] => Array
(
[date] => 2019-10-06 17:30:59.344370
[timezone] => UTC
[timezone_type] => 3
)
)
)
Actual result:
--------------
Fatal error: Uncaught Error: Call to a member function limit() on bool in
/home/projects/public/expressive-xdevapi-demo/public/xdevapi.php:20 Stack trace: #0 {main} thrown in
/home/projects/public/expressive-xdevapi-demo/public/xdevapi.php on line 20
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=78639&edit=1