kreait / firebase-php

Unofficial Firebase Admin SDK for PHP
https://firebase-php.readthedocs.io/
MIT License
2.23k stars 427 forks source link

Firebase Rules - .indexOn is forced to be an object when a string or an array of strings is required #705

Closed bennyt2 closed 2 years ago

bennyt2 commented 2 years ago

Describe the issue you are experiencing

Firebase Rules requires that the ".indexOn" value be a string or an array of strings.

This line of code passes a JSON_FORCE_OBJECT option that forces the entire JSON to exist as an object. This causes the API call to fail if you have ".indexOn" values in a PHP array.

This is what Firebase expects.

{
    "rules": {
        "meet_1": {
            "value1": {
                ".indexOn": [
                    "cd"
                ]
            },
            "value2": {
                ".indexOn": [
                    "pb"
                ]
            },
            "value3": {
                ".indexOn": [
                    "he",
                    "hr",
                    "hh"
                ]
            }
        }
    }
}

This is what JSON_FORCE_OBJECT is doing. Firebase returns Error saving rules: Invalid indexOn expression. Must be either a string or an array of strings

{
    "rules": {
        "meet_1": {
            "value1": {
                ".indexOn": {
                    "0": "cd"
                }
            },
            "value2": {
                ".indexOn": {
                    "0": "pb"
                }
            },
            "value3": {
                ".indexOn": {
                    "0": "he",
                    "1": "hr",
                    "2": "hh"
                }
            }
        }
    }
}

I am not sure if the JSON_FORCE_OBJECT is necessary for other reasons?

Installed packages

abraham/twitteroauth 0.7.4 The most popular PHP library for use with the Twitter OAuth REST API. beberlei/doctrineextensions v1.2.6 A set of extensions to Doctrine 2 that add support for additional query functions available in MySQL and Oracle. behat/transliterator v1.3.0 String transliterator brick/math 0.8.15 Arbitrary-precision arithmetic library brightcove/api 2.1 Brightcove PHP API Wrapper composer/xdebug-handler 1.4.2 Restarts a process without Xdebug. dms/phpunit-arraysubset-asserts v0.2.0 This package provides ArraySubset and related asserts once deprecated in PHPUnit 8 doctrine/annotations 1.10.3 Docblock Annotations Parser doctrine/cache 1.10.1 PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongodb and oth... doctrine/collections 1.6.5 PHP Doctrine Collections library that adds additional functionality on top of PHP arrays. doctrine/common 2.13.3 PHP Doctrine Common project is a library that provides additional functionality that other Doctrine projects depend on such as better reflectio... doctrine/data-fixtures 1.4.3 Data Fixtures for all Doctrine Object Managers doctrine/dbal 2.10.2 Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management. doctrine/doctrine-bundle 2.1.0 Symfony DoctrineBundle doctrine/doctrine-fixtures-bundle 3.3.1 Symfony DoctrineFixturesBundle doctrine/doctrine-migrations-bundle 3.0.1 Symfony DoctrineMigrationsBundle doctrine/event-manager 1.1.0 The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects. doctrine/inflector 1.4.3 PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singular/plural forms of words. doctrine/instantiator 1.3.1 A small, lightweight utility to instantiate objects in PHP without invoking their constructors doctrine/lexer 1.2.1 PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers. doctrine/migrations 3.0.1 PHP Doctrine Migrations project offer additional functionality on top of the database abstraction layer (DBAL) for versioning your database sch... doctrine/orm v2.7.3 Object-Relational-Mapper for PHP doctrine/persistence 1.3.7 The Doctrine Persistence project is a set of shared interfaces and functionality that the different Doctrine object mappers share. doctrine/reflection 1.2.1 The Doctrine Reflection project is a simple library used by the various Doctrine projects which adds some additional functionality on top of th... doctrine/sql-formatter 1.1.0 a PHP SQL highlighting library egulias/email-validator 2.1.25 A library for validating emails against several RFCs elastic/transport v8.1.0 HTTP transport PHP library for Elastic products elasticsearch/elasticsearch v8.2.2 PHP Client for Elasticsearch emag-tech-labs/rabbitmq-bundle 2.1.1 Integrates php-amqplib with Symfony & RabbitMq. Formerly php-amqplib/rabbitmq-bundle, oldsound/rabbitmq-bundle. escapestudios/symfony2-coding-standard 3.11.0 CodeSniffer ruleset for the Symfony 2+ coding standard fig/http-message-util 1.1.5 Utility classes and constants for use with PSR-7 (psr/http-message) firebase/php-jwt v6.2.0 A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec. friendsofsymfony/jsrouting-bundle 2.6.0 A pretty nice way to expose your Symfony2 routing to client applications. fzaninotto/faker v1.9.1 Faker is a PHP library that generates fake data for you. gedmo/doctrine-extensions v2.4.41 Doctrine2 behavioral extensions google/apiclient v2.12.6 Client library for Google APIs google/apiclient-services v0.252.0 Client library for Google APIs google/auth v1.21.0 Google Auth Library for PHP google/cloud-core v1.46.0 Google Cloud PHP shared dependency, providing functionality useful to all components. google/cloud-firestore v1.14.0 Cloud Firestore client for PHP google/cloud-storage v1.27.1 Cloud Storage Client for PHP google/common-protos 2.1.0 Google API Common Protos for PHP google/crc32 v0.1.0 Various CRC32 implementations google/gax v1.12.2 Google API Core for PHP google/grpc-gcp v0.2.0 gRPC GCP library for channel management google/protobuf v3.21.1 proto library for PHP grpc/grpc 1.42.0 gRPC library for PHP guzzlehttp/guzzle 7.4.3 Guzzle is a PHP HTTP client library guzzlehttp/oauth-subscriber dev-master 8d6cab2 Guzzle OAuth 1.0 subscriber guzzlehttp/promises 1.5.1 Guzzle promises library guzzlehttp/psr7 2.3.0 PSR-7 message implementation that also provides common utility methods j7mbo/twitter-api-php 1.0.6 Simple PHP Wrapper for Twitter API v1.1 calls kamranahmedse/php-geocode dev-master 21d182d A wrapper around the Google Geocoding API to get different details such as latitude, longitude, country, city, district, postcode, town and str... kevinpapst/adminlte-bundle 3.2.3 Admin theme bundle for Symfony 4+ based on AdminLTE 2.4 with FOSUserBundle support knplabs/knp-snappy v1.2.1 PHP5 library allowing thumbnail, snapshot or PDF generation from a url or a html page. Wrapper for wkhtmltopdf/wkhtmltoimage. knplabs/knp-snappy-bundle v1.7.0 Easily create PDF and images in Symfony2 by converting Twig/HTML templates. kreait/clock 1.2 A PHP 7.0 compatible clock abstraction kreait/firebase-bundle 2.1.0 Symfony Bundle for the Firebase Admin SDK kreait/firebase-php 5.26.2 Firebase Admin SDK kreait/firebase-tokens 1.16.1 A library to work with Firebase tokens laminas/laminas-code 3.4.1 Extensions to the PHP Reflection API, static code scanning, and code generation laminas/laminas-eventmanager 3.2.1 Trigger and listen to events within a PHP application laminas/laminas-zendframework-bridge 1.0.4 Alias legacy ZF class names to Laminas Project equivalents. lcobucci/clock 2.0.0 Yet another clock abstraction lcobucci/jwt 4.1.5 A simple library to work with JSON Web Token and JSON Web Signature league/csv 9.5.0 Csv data manipulation made easy in PHP league/fractal 0.14.0 Handle the output of complex data structures ready for API output. microsoft/azure-storage-blob 1.5.3 This project provides a set of PHP client libraries that make it easy to access Microsoft Azure Storage Blob APIs. microsoft/azure-storage-common 1.5.2 This project provides a set of common code shared by Azure Storage Blob, Table, Queue and File PHP client libraries. monolog/monolog 2.7.0 Sends your logs to files, sockets, inboxes, databases and various web services mtdowling/jmespath.php 2.6.1 Declaratively specify how to extract elements from a JSON document myclabs/deep-copy 1.9.5 Create deep copies (clones) of your objects nelmio/alice 3.7.1 Expressive fixtures generator ninsuo/symfony-collection 2.1.33 A jQuery plugin that manages adding, deleting and moving elements from a Symfony collection ocramius/package-versions 1.9.0 Composer plugin that provides efficient querying for installed package versions (no runtime IO) ocramius/proxy-manager 2.8.0 A library providing utilities to generate, instantiate and generally operate with Object Proxies pdepend/pdepend 2.8.0 Official version of pdepend to be handled with Composer phar-io/manifest 1.0.3 Component for reading phar.io manifest information from a PHP Archive (PHAR) phar-io/version 2.0.1 Library for handling version information and constraints php-amqplib/php-amqplib v2.11.3 Formerly videlalvaro/php-amqplib. This library is a pure PHP implementation of the AMQP protocol. It's been tested against RabbitMQ. php-http/discovery 1.14.2 Finds installed HTTPlug implementations and PSR-7 message factories php-http/httplug 2.3.0 HTTPlug, the HTTP client abstraction for PHP php-http/promise 1.1.0 Promise used for asynchronous HTTP requests phpdocumentor/reflection-common 2.1.0 Common reflection classes used by phpdocumentor to reflect the code structure phpdocumentor/reflection-docblock 5.1.0 With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock. phpdocumentor/type-resolver 1.2.0 A PSR-5 based resolver of Class names, Types and Structural Element Names phploc/phploc 6.0.2 A tool for quickly measuring the size of a PHP project. phpmd/phpmd 2.8.2 PHPMD is a spin-off project of PHP Depend and aims to be a PHP equivalent of the well known Java tool PMD. phpseclib/phpseclib 2.0.37 PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc. phpspec/prophecy v1.10.3 Highly opinionated mocking framework for PHP 5.3+ phpunit/php-code-coverage 8.0.2 Library that provides collection, processing, and rendering functionality for PHP code coverage information. phpunit/php-file-iterator 3.0.2 FilterIterator implementation that filters files based on a list of suffixes. phpunit/php-invoker 3.0.1 Invoke callables with a timeout phpunit/php-text-template 2.0.1 Simple template engine. phpunit/php-timer 3.1.4 Utility class for timing phpunit/php-token-stream 4.0.2 Wrapper around PHP's tokenizer extension. phpunit/phpunit 9.1.5 The PHP Unit Testing framework. predis/predis v1.1.1 Flexible and feature-complete Redis client for PHP and HHVM psr/cache 1.0.1 Common interface for caching libraries psr/container 1.0.0 Common Container Interface (PHP FIG PSR-11) psr/event-dispatcher 1.0.0 Standard interfaces for event handling. psr/http-client 1.0.1 Common interface for HTTP clients psr/http-factory 1.0.1 Common interfaces for PSR-7 HTTP message factories psr/http-message 1.0.1 Common interface for HTTP messages psr/link 1.0.0 Common interfaces for HTTP links psr/log 1.1.4 Common interface for logging libraries psr/simple-cache 1.0.1 Common interfaces for simple caching ralouphie/getallheaders 3.0.3 A polyfill for getallheaders. ramsey/collection 1.0.1 A PHP 7.2+ library for representing and manipulating collections. ramsey/uuid 4.0.1 A PHP library for generating and working with universally unique identifiers (UUIDs). riverline/multipart-parser 2.0.9 One class library to parse multipart content with encoding and charset support. rize/uri-template 0.3.4 PHP URI Template (RFC 6570) supports both expansion & extraction rtheunissen/guzzle-log-middleware v1.0.0 Guzzle middleware to log requests and responses sebastian/code-unit 1.0.3 Collection of value objects that represent the PHP code units sebastian/code-unit-reverse-lookup 2.0.1 Looks up which function or method a line of code belongs to sebastian/comparator 4.0.2 Provides the functionality to compare PHP values for equality sebastian/diff 4.0.1 Diff implementation sebastian/environment 5.1.1 Provides functionality to handle HHVM/PHP environments sebastian/exporter 4.0.1 Provides the functionality to export PHP variables for visualization sebastian/finder-facade 2.0.0 FinderFacade is a convenience wrapper for Symfony's Finder component. sebastian/global-state 4.0.0 Snapshotting of global state sebastian/object-enumerator 4.0.1 Traverses array structures and object graphs to enumerate all referenced objects sebastian/object-reflector 2.0.1 Allows reflection of object attributes, including inherited and non-public ones sebastian/phpcpd 5.0.2 Copy/Paste Detector (CPD) for PHP code. sebastian/recursion-context 4.0.1 Provides functionality to recursively process PHP variables sebastian/resource-operations 3.0.1 Provides a list of PHP built-in functions that operate on resources sebastian/type 2.1.0 Collection of value objects that represent the types of the PHP type system sebastian/version 3.0.0 Library that helps with managing the version number of Git-hosted PHP projects sendgrid/php-http-client 3.1.0 HTTP REST client, simplified for PHP sendgrid/sendgrid 5.0.9 This library allows you to quickly and easily send emails through SendGrid using PHP. sensio/framework-extra-bundle v5.5.6 This bundle provides a way to configure your controllers with annotations snc/redis-bundle 3.2.3 A Redis bundle for Symfony squizlabs/php_codesniffer 3.5.5 PHPCodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards. stella-maris/clock 0.1.4 A pre-release of the proposed PSR-20 Clock-Interface stof/doctrine-extensions-bundle v1.4.0 Integration of the gedmo/doctrine-extensions with Symfony2 stripe/stripe-php v5.9.2 Stripe PHP Library symfony/amqp-messenger v5.1.2 Symfony AMQP extension Messenger Bridge symfony/asset v5.1.2 Symfony Asset Component symfony/browser-kit v5.1.2 Symfony BrowserKit Component symfony/cache v5.1.2 Symfony Cache component with PSR-6, PSR-16, and tags symfony/cache-contracts v2.1.2 Generic abstractions related to caching symfony/config v5.1.2 Symfony Config Component symfony/console v5.1.2 Symfony Console Component symfony/css-selector v5.1.2 Symfony CssSelector Component symfony/debug-bundle v5.1.2 Symfony DebugBundle symfony/dependency-injection v5.1.2 Symfony DependencyInjection Component symfony/deprecation-contracts v2.5.1 A generic function and convention to trigger deprecation notices symfony/doctrine-bridge v5.1.2 Symfony Doctrine Bridge symfony/doctrine-messenger v5.1.2 Symfony Doctrine Messenger Bridge symfony/dom-crawler v5.1.2 Symfony DomCrawler Component symfony/dotenv v5.1.2 Registers environment variables from a .env file symfony/error-handler v5.1.2 Symfony ErrorHandler Component symfony/event-dispatcher v5.1.2 Symfony EventDispatcher Component symfony/event-dispatcher-contracts v2.1.2 Generic abstractions related to dispatching event symfony/expression-language v5.1.2 Symfony ExpressionLanguage Component symfony/filesystem v5.1.2 Symfony Filesystem Component symfony/finder v5.1.2 Symfony Finder Component symfony/flex v1.14.5 Composer plugin for Symfony symfony/form v5.1.2 Symfony Form Component symfony/framework-bundle v5.1.2 Symfony FrameworkBundle symfony/http-foundation v5.1.2 Symfony HttpFoundation Component symfony/http-kernel v5.1.2 Symfony HttpKernel Component symfony/inflector v5.1.2 Symfony Inflector Component symfony/intl v5.1.2 A PHP replacement layer for the C intl extension that includes additional data from the ICU library. symfony/lock v5.1.2 Symfony Lock Component symfony/mailer v5.1.11 Helps sending emails symfony/messenger v5.1.2 Symfony Messenger Component symfony/mime v5.1.2 A library to manipulate MIME messages symfony/monolog-bridge v5.1.2 Symfony Monolog Bridge symfony/monolog-bundle v3.6.0 Symfony MonologBundle symfony/options-resolver v5.1.2 Symfony OptionsResolver Component symfony/phpunit-bridge v5.1.2 Symfony PHPUnit Bridge symfony/polyfill-ctype v1.17.1 Symfony polyfill for ctype functions symfony/polyfill-intl-grapheme v1.17.1 Symfony polyfill for intl's grapheme* functions symfony/polyfill-intl-icu v1.17.1 Symfony polyfill for intl's ICU-related data and classes symfony/polyfill-intl-idn v1.22.1 Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions symfony/polyfill-intl-normalizer v1.17.1 Symfony polyfill for intl's Normalizer class and related functions symfony/polyfill-mbstring v1.26.0 Symfony polyfill for the Mbstring extension symfony/polyfill-php72 v1.22.1 Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions symfony/polyfill-php73 v1.17.1 Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions symfony/polyfill-php80 v1.26.0 Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions symfony/polyfill-php81 v1.26.0 Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions symfony/process v5.1.2 Symfony Process Component symfony/property-access v5.1.2 Symfony PropertyAccess Component symfony/property-info v5.1.2 Symfony Property Info Component symfony/redis-messenger v5.1.2 Symfony Redis extension Messenger Bridge symfony/routing v5.1.2 Symfony Routing Component symfony/security-bundle v5.1.2 Symfony SecurityBundle symfony/security-core v5.1.2 Symfony Security Component - Core Library symfony/security-csrf v5.1.2 Symfony Security Component - CSRF Library symfony/security-guard v5.1.2 Symfony Security Component - Guard symfony/security-http v5.1.2 Symfony Security Component - HTTP Integration symfony/sendgrid-mailer v5.1.11 Symfony Sendgrid Mailer Bridge symfony/serializer v5.1.2 Symfony Serializer Component symfony/service-contracts v2.1.2 Generic abstractions related to writing services symfony/stopwatch v5.1.2 Symfony Stopwatch Component symfony/string v5.1.2 Symfony String component symfony/templating v5.1.2 Symfony Templating Component symfony/translation v5.1.2 Symfony Translation Component symfony/translation-contracts v2.1.2 Generic abstractions related to translation symfony/twig-bridge v5.1.2 Symfony Twig Bridge symfony/twig-bundle v5.1.2 Symfony TwigBundle symfony/validator v5.1.2 Symfony Validator Component symfony/var-dumper v5.1.2 Symfony mechanism for exploring and dumping PHP variables symfony/var-exporter v5.1.2 A blend of var_export() + serialize() to turn any serializable data structure to plain PHP code symfony/web-link v5.1.2 Symfony WebLink Component symfony/web-profiler-bundle v5.1.2 Symfony WebProfilerBundle symfony/workflow v5.1.2 Symfony Workflow Component symfony/yaml v5.1.2 Symfony Yaml Component theseer/fdomdocument 1.6.6 The classes contained within this repository extend the standard DOM to use exceptions at all occasions of errors instead of PHP warnings or no... theseer/tokenizer 1.1.3 A small library for converting tokenized PHP source code into XML and potentially other formats twig/twig v2.12.5 Twig, the flexible, fast, and secure template language for PHP twilio/sdk 6.15.1 A PHP wrapper for Twilio's API webimpress/safe-writer 2.0.1 Tool to write files safely, to avoid race conditions webmozart/assert 1.9.0 Assertions to validate method input/output with nice error messages. willdurand/jsonp-callback-validator v1.1.0 JSONP callback validator.

PHP version and extensions

composer 2.3.7 Composer package composer-plugin-api 2.3.0 The Composer Plugin API composer-runtime-api 2.2.2 The Composer Runtime API ext-apc 5.1.19 The apc PHP extension ext-apcu 5.1.20 The apcu PHP extension ext-bcmath 7.4.23 The bcmath PHP extension ext-calendar 7.4.23 The calendar PHP extension ext-ctype 7.4.23 The ctype PHP extension ext-curl 7.4.23 The curl PHP extension ext-date 7.4.23 The date PHP extension ext-dom 20031129 The dom PHP extension ext-exif 7.4.23 The exif PHP extension ext-ffi 7.4.23 The FFI PHP extension ext-fileinfo 7.4.23 The fileinfo PHP extension ext-filter 7.4.23 The filter PHP extension ext-ftp 7.4.23 The ftp PHP extension ext-gd 7.4.23 The gd PHP extension ext-gettext 7.4.23 The gettext PHP extension ext-grpc 1.39.0 The grpc PHP extension ext-hash 7.4.23 The hash PHP extension ext-iconv 7.4.23 The iconv PHP extension ext-imap 7.4.23 The imap PHP extension ext-json 7.4.23 The json PHP extension ext-libxml 7.4.23 The libxml PHP extension ext-mbstring 7.4.23 The mbstring PHP extension ext-mysqli 7.4.23 The mysqli PHP extension ext-mysqlnd 0 The mysqlnd PHP extension (actual version: mysqlnd 7.4.23) ext-openssl 7.4.23 The openssl PHP extension ext-pcntl 7.4.23 The pcntl PHP extension ext-pcre 7.4.23 The pcre PHP extension ext-pdo 7.4.23 The PDO PHP extension ext-pdo_mysql 7.4.23 The pdo_mysql PHP extension ext-phar 7.4.23 The Phar PHP extension ext-posix 7.4.23 The posix PHP extension ext-protobuf 3.17.3 The protobuf PHP extension ext-readline 7.4.23 The readline PHP extension ext-reflection 7.4.23 The Reflection PHP extension ext-session 7.4.23 The session PHP extension ext-shmop 7.4.23 The shmop PHP extension ext-simplexml 7.4.23 The SimpleXML PHP extension ext-sockets 7.4.23 The sockets PHP extension ext-sodium 7.4.23 The sodium PHP extension ext-spl 7.4.23 The SPL PHP extension ext-sysvmsg 7.4.23 The sysvmsg PHP extension ext-sysvsem 7.4.23 The sysvsem PHP extension ext-sysvshm 7.4.23 The sysvshm PHP extension ext-tokenizer 7.4.23 The tokenizer PHP extension ext-xdiff 2.1.0 The xdiff PHP extension ext-xml 7.4.23 The xml PHP extension ext-xmlreader 7.4.23 The xmlreader PHP extension ext-xmlwriter 7.4.23 The xmlwriter PHP extension ext-xsl 7.4.23 The xsl PHP extension ext-zend-opcache 7.4.23 The Zend OPcache PHP extension ext-zip 1.15.6 The zip PHP extension ext-zlib 7.4.23 The zlib PHP extension lib-curl 7.68.0 The curl library lib-curl-libssh 0.9.3 curl libssh version lib-curl-openssl 1.1.1.6 curl OpenSSL version (1.1.1.6) lib-curl-zlib 1.2.11 curl zlib version lib-date-timelib 2018.04 date timelib version lib-date-zoneinfo 0 zoneinfo ("Olson") database for date lib-fileinfo-libmagic 537 fileinfo libmagic version lib-gd 2.3.0 The gd library lib-iconv 2.31 The iconv library lib-libsodium 1.0.18 The libsodium library lib-libxml 2.9.12 libxml library version lib-libxslt 1.1.34 The libxslt library lib-libxslt-libxml 2.9.10 libxml version libxslt is compiled against lib-mbstring-libmbfl 1.3.2 mbstring libmbfl version lib-mbstring-oniguruma 6.9.4 mbstring oniguruma version lib-openssl 1.1.1.6 OpenSSL 1.1.1f 31 Mar 2020 lib-pcre 10.36 The pcre library lib-pcre-unicode 13.0.0 PCRE Unicode version support lib-zip-libzip 1.7.3 The zip-libzip library lib-zlib 1.2.11 The zlib library php 7.4.23 The PHP interpreter php-64bit 7.4.23 The PHP interpreter, 64bit php-ipv6 7.4.23 The PHP interpreter, with IPv6 support

On which operating system(s) does the issue occur?

Steps to reproduce the issue.

use Kreait\Firebase;

$factory = (new Firebase\Factory())
    ->withServiceAccount('/path/to/firebase_credentials.com')
    ->withDatabaseUri('https://my-project.firebaseio.com')
;

$db = $factory->createDatabase();

$baseRuleArr = [
    "rules" => [
        "meet_1" => [
            "value1" => [
                ".indexOn" => [
                    "cd",
                ]
            ],
            "value2" => [
                ".indexOn" => [
                    "pb",
                ]
            ],
            "value3" => [
                ".indexOn" => [
                    "he",
                    "hr",
                    "hh",
                ]
            ]
        ]
    ]
];

$db->updateRules(RuleSet::fromArray($baseRuleArr));

Error message/Stack trace

In DatabaseApiExceptionConverter.php line 64:

5:29: Invalid indexOn expression. Must be either a string or an array of strings

In RequestException.php line 113:

Client error: PUT https://[FIREBASE_URL]/.settings/rules resulted in a 400 Bad Request response:

Additional information

No response

jeromegamez commented 2 years ago

Thank you for the detailed description (and also for becoming a sponsor, it's very much appreciated ❤️). Do you have the possibility to upgrade to the 4.0 release of the bundle? I see you're on version 2.1 of the bundle which is limited to using the 5.x release of the SDK.

If not, I'll backport the fix to the 5.x branch once it's done 🤞 (exclusive Sponsor Perk 😇)

jeromegamez commented 2 years ago

The fix is now deployed as 5.26.3 and 6.4.1 🥳

If you don't update the bundle, a composer update -W should pull in the new release 🤞

Thanks again for your support (and for reporting the issue)!

bennyt2 commented 2 years ago

Thank you so much for the quick fix and for backporting it. And you are most welcome! Thank you for creating (and maintaining!) and excellent open source product.