Bug #78331 [NEW]: mysql_xdevapi\CollectionFind::fields() path fails when ends in number

From: Date: Wed, 24 Jul 2019 13:37:55 +0000
Subject: Bug #78331 [NEW]: mysql_xdevapi\CollectionFind::fields() path fails when ends in number
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-221927@lists.php.net to get a copy of this message
From: temuri416 at gmail dot com Operating system: Ubuntu16.04 PHP version: 7.2.20 Package: MySQL related Bug Type: Bug Bug description:mysql_xdevapi\CollectionFind::fields() path fails when ends in number Description: ------------ ->fields($expr) fails to fetch keys ["qwe", "asd"] when trying to reach them via "tree.100" path in the following document: $doc = [ 'pk' => 25, 'tree' => [ 100 => [ 'qwe' => [ 1 ], 'asd' => [ 'a' ] ], 200 => 'a', 'abc' => 999 ] ]; Test script: --------------- <?php $doc = [ 'pk' => 25, 'tree' => [ 100 => [ 'qwe' => [ 1 ], 'asd' => [ 'a' ] ], 200 => 'a', 'abc' => 999 ] ]; $session = mysql_xdevapi\getSession('mysqlx://root:password@localhost'); $schema = $session->getSchema('test'); $coll = $schema->getCollection(COLL); $coll->add($doc)->execute(); // Works correctly - fetches tree.100.qwe key. $expr = mysql_xdevapi\Expression('$.tree."100".qwe'); $result = $coll->find('$.pk=25')->fields($expr)->execute(); // Errors with: mysql_xdevapi\CollectionFind::fields(): Error while parsing, details: CDK Error: After seeing '$.tree."100" AS ', looking at '100': Expected identifier after AS (cdk:8) $expr = mysql_xdevapi\Expression('$.tree."100"'); $result = $coll->find('$.pk=25')->fields($expr)->execute(); // Errors with: mysql_xdevapi\CollectionFind::fields(): Error while parsing, details: CDK Error: After seeing '$.tree.', looking at '[100] ...': Expected member name or '*' after '.' in a document path (cdk:8) $expr = mysql_xdevapi\Expression('$.tree.[100]'); $result = $coll->find('$.pk=25')->fields($expr)->execute(); // Errors with: mysql_xdevapi\CollectionFind::fields(): Error while parsing, details: CDK Error: After seeing '$.tree', looking at '.100 A...': Invalid characters in projection specification, only AS <name> allowed after the projection expression (cdk:8) $expr = mysql_xdevapi\Expression('$.tree.100'); $result = $coll->find('$.pk=25')->fields($expr)->execute(); -- Edit bug report at https://bugs.php.net/bug.php?id=78331&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=78331&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=78331&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=78331&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=78331&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=78331&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=78331&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=78331&r=needscript Try newer version: https://bugs.php.net/fix.php?id=78331&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=78331&r=support Expected behavior: https://bugs.php.net/fix.php?id=78331&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=78331&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=78331&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=78331&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=78331&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=78331&r=dst IIS Stability: https://bugs.php.net/fix.php?id=78331&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=78331&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=78331&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=78331&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=78331&r=mysqlcfg

« previous php.bugs (#221927) next »