Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
oil scaffold / admin fatal error
  • first project with fuelPHP I'm trying to scaffold some stuff...

    $ oil g admin monkey name:string
    Uncaught exception Fuel\Core\PhpErrorException: A non-numeric value encountered
    Callstack:
    #0 /home/mickro/devel/my-prj/admin/fuel/core/bootstrap.php(103): Fuel\Core\Errorhandler::error_handler(2, 'A non-numeric v...', '/home/mickro/de...', 1790)
    #1 /home/mickro/devel/my-prj/admin/fuel/packages/oil/classes/generate.php(1790): {closure}(2, 'A non-numeric v...', '/home/mickro/de...', 1790, Array)
    #2 /home/mickro/devel/my-prj/admin/fuel/packages/oil/classes/generate.php(1177): Oil\Generate::_find_migration_number()
    #3 /home/mickro/devel/my-prj/admin/fuel/packages/oil/classes/generate/scaffold.php(131): Oil\Generate::migration(Array, false)
    #4 /home/mickro/devel/my-prj/admin/fuel/packages/oil/classes/generate/admin.php(84): Oil\Generate_Scaffold::forge(Array, 'orm')
    #5 [internal function]: Oil\Generate_Admin::forge(Array, 'orm')
    #6 /home/mickro/devel/my-prj/admin/fuel/packages/oil/classes/command.php(77): call_user_func('Oil\\Generate_Ad...', Array, 'orm')
    #7 /home/mickro/devel/my-prj/admin/oil(68): Oil\Command::init(Array)
    #8 {main}


    I'm using php 7.1.1

    I also tried with php 5.4:


    $ php54 oil g admin monkey name:string

    Fatal error: Uncaught exception 'RuntimeException' with message 'PHP's json extension is required to use Monolog's NormalizerFormatter' in /home/mickro/devel/my-prj/admin/fuel/vendor/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php:34
    Stack trace:
    #0 /home/mickro/devel/my-prj/admin/fuel/vendor/monolog/monolog/src/Monolog/Formatter/LineFormatter.php(42): Monolog\Formatter\NormalizerFormatter->__construct('Y-m-d H:i:s')
    #1 /home/mickro/devel/my-prj/admin/fuel/core/classes/log.php(129): Monolog\Formatter\LineFormatter->__construct('%level_name% - ...', 'Y-m-d H:i:s')
    #2 /home/mickro/devel/my-prj/admin/fuel/core/classes/log.php(58): Fuel\Core\Log::initialize()
    #3 [internal function]: Fuel\Core\Log::_init()
    #4 /home/mickro/devel/my-prj/admin/fuel/core/classes/autoloader.php(377): call_user_func('Log::_init')
    #5 /home/mickro/devel/my-prj/admin/fuel/core/classes/autoloader.php(249): Fuel\Core\Autoloader::init_class( in /home/mickro/devel/my-prj/admin/fuel/vendor/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php on line 34

    Fatal error: Uncaught exception 'RuntimeException' with message 'PHP's json extension is required to use Monolog's NormalizerFormatter' in /home/mickro/devel/my-prj/admin/fuel/vendor/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php:34
    Stack trace:
    #0 /home/mickro/devel/my-prj/admin/fuel/vendor/monolog/monolog/src/Monolog/Formatter/LineFormatter.php(42): Monolog\Formatter\NormalizerFormatter->__construct(NULL)
    #1 /home/mickro/devel/my-prj/admin/fuel/vendor/monolog/monolog/src/Monolog/Handler/AbstractHandler.php(182): Monolog\Formatter\LineFormatter->__construct()
    #2 /home/mickro/devel/my-prj/admin/fuel/vendor/monolog/monolog/src/Monolog/Handler/AbstractHandler.php(112): Monolog\Handler\AbstractHandler->getDefaultFormatter()
    #3 /home/mickro/devel/my-prj/admin/fuel/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(35): Monolog\Handler\AbstractHandler->getFormatter()
    #4 /home/mickro/devel/jamesbong/Site-201 in /home/mickro/devel/my-prj/admin/fuel/vendor/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php on line 34
  • Harro VertonHarro Verton
    Accepted Answer
    I can't repoduce it here, so I assume it has something to do with your local system

    The 5.4 example is clear: you're missing the php json module, which Monolog seems to need, so you need to install it.

    For the 7.1.1 example: Fuel isn't tested with PHP 7.1 yet, this is one of the things that changed from 7.0 to 7.1, in  7.0, "A"+1 == 1, in 7.1, it will generate a "A non-numeric value encountered"  error.

    So the entire codebase will have to be validated against PHP 7.1.
  • hum looking at this note about php 5.4... seems it embedding json module.

    anyway I also tried php 7.0. And it made the job.



    $ php70 oil g admin monkey name:string
    Creating controller: /home/mickro/devel/my-prj/admin/fuel/app/classes/controller/base.php
    Creating controller: /home/mickro/devel/my-prj/admin/fuel/app/classes/controller/admin.php
    Creating views: /home/mickro/devel/my-prj/admin/fuel/app/views/admin/template.php
    Creating views: /home/mickro/devel/my-prj/admin/fuel/app/views/admin/dashboard.php
    Creating views: /home/mickro/devel/my-prj/admin/fuel/app/views/admin/login.php
    Creating migration: /home/mickro/devel/my-prj/admin/fuel/app/migrations/001_create_monkeys.php
    Creating model: /home/mickro/devel/my-prj/admin/fuel/app/classes/model/monkey.php
    Creating controller: /home/mickro/devel/my-prj/admin/fuel/app/classes/controller/admin/monkey.php
    Creating view: /home/mickro/devel/my-prj/admin/fuel/app/views/admin/monkey/index.php
    Creating view: /home/mickro/devel/my-prj/admin/fuel/app/views/admin/monkey/view.php
    Creating view: /home/mickro/devel/my-prj/admin/fuel/app/views/admin/monkey/create.php
    Creating view: /home/mickro/devel/my-prj/admin/fuel/app/views/admin/monkey/edit.php
    Creating view: /home/mickro/devel/my-prj/admin/fuel/app/views/admin/monkey/_form.php


    Thanks!
  • This is what Monolog checks for (and what throws the error): https://github.com/Seldaek/monolog/blob/master/src/Monolog/Formatter/NormalizerFormatter.php#L34

    The phpinfo() output should tell you whether or not the json.so module is loaded. If not, you need to add it to your php.ini again,
  • Your original issue should have been resolved now in 1.9/develop. https://github.com/fuel/core/issues/2051

    Could you verify that is the case?

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion