Bug #78639 [Opn]: mysql_xdevapi\CollectionFind::limit returns bool with Zend OPcache enabled

From: Date: Mon, 07 Oct 2019 15:11:40 +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-223120@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:         nikic@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:

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?


Previous Comments:
------------------------------------------------------------------------
[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


Thread (4 messages)

« previous php.bugs (#223120) next »