Code Monkey home page Code Monkey logo

collection's Issues

Undefined offset/index running find() on empty collection

Test case

Bag::from([])->find(function ($v, $k) { return false; });

Result

PHP Notice:  Undefined offset: -1 in vendor/bolt/collection/src/Bag.php on line 466
PHP Stack trace:
PHP   1. {main}() Foo.php:0
PHP   2. Bolt\Collection\Bag->find() Foo.php:5
PHP   3. Bolt\Collection\Bag->findKey() vendor/bolt/collection/src/Bag.php:381
PHP   4. Bolt\Collection\Bag->iterateFromIndex() vendor/bolt/collection/src/Bag.php:415
PHP Notice:  Undefined index:  in vendor/bolt/collection/src/Bag.php on line 467
PHP Stack trace:
PHP   1. {main}() Foo.php:0
PHP   2. Bolt\Collection\Bag->find() Foo.php:5
PHP   3. Bolt\Collection\Bag->findKey() vendor/bolt/collection/src/Bag.php:381
PHP   4. Bolt\Collection\Bag->iterateFromIndex() vendor/bolt/collection/src/Bag.php:415

Call to undefined function Bolt\Collection\is_iterable()

I try to install bolt CMS, but it raises error:

$ composer create-project bolt/composer-install:^3.4 testapp --prefer-dist

 Do you want to use Bolt's standard folder structure? (yes/no) [yes]:
 > yes

 Would you like to enable the default site Bundle? (yes/no) [yes]:
 > yes

PHP Fatal error:  Uncaught Error: Call to undefined function Bolt\Collection\is_iterable() in /home/test/testapp/vendor/bolt/collection/src/Arr.php:67
Stack trace:
#0 /home/test/testapp/vendor/bolt/collection/src/Bag.php(127): Bolt\Collection\Arr::fromRecursive(Array)
#1 /home/test/testapp/vendor/bolt/bolt/src/Composer/Script/BundleConfigurator.php(97): Bolt\Collection\Bag->toArrayRecursive()
#2 /home/test/testapp/vendor/bolt/bolt/src/Composer/Script/BundleConfigurator.php(71): Bolt\Composer\Script\BundleConfigurator->save(Object(Bolt\Collection\MutableBag))
#3 /home/test/testapp/vendor/bolt/bolt/src/Composer/ScriptHandler.php(80): Bolt\Composer\Script\BundleConfigurator->run()
#4 phar:///usr/local/Cellar/composer/1.5.2/libexec/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php(282): Bolt\Composer\ScriptHandler::configureProject(Object(Composer\Script\Event))
#5 phar:///usr/local/Cellar/composer/1.5.2/libexec/composer.phar/src/Composer/EventDispatcher/Even in /home/test/testapp/vendor/bolt/collection/src/Arr.php on line 67

$ php --version
PHP 7.0.25 (cli) (built: Oct 27 2017 12:55:48) ( NTS )

composer --version
Composer version 1.5.2 2017-09-11 16:59:25

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.