phperror-handlinguserfrosting

php error-log on UserFrosting after loading main page


I'm trying to install UserFrosting and i get these errors after loading the main page

[01-Oct-2016 18:28:29 Asia/Jerusalem] PHP 6. Composer\Autoload\includeFile() C:\Server\userfrosting\vendor\composer\ClassLoader.php:301
[01-Oct-2016 18:28:29 Asia/Jerusalem] PHP 5. Composer\Autoload\ClassLoader->loadClass() C:\Server\userfrosting\initialize.php:25 
[01-Oct-2016 18:28:29 Asia/Jerusalem] PHP 4. spl_autoload_call() C:\Server\userfrosting\initialize.php:25 
[01-Oct-2016 18:28:29 Asia/Jerusalem] PHP 3. UserFrosting\UserFrosting->setupGuestEnvironment() C:\Server\userfrosting\initialize.php:193 
[01-Oct-2016 18:28:29 Asia/Jerusalem] PHP 2. require_once() C:\Server\index.php:10 
[01-Oct-2016 18:28:29 Asia/Jerusalem] PHP 1. {main}() C:\Server\index.php:0 
[01-Oct-2016 18:28:29 Asia/Jerusalem] PHP Stack trace: 
[01-Oct-2016 18:28:29 Asia/Jerusalem] PHP Strict standards: Declaration of UserFrosting\User::fresh() should be compatible with Illuminate\Database\Eloquent\Model::fresh(array $with = Array) in C:\Server\userfrosting\models\database\User.php on line 570 

and i can't find the problem thanks for helping


Solution

  • The error PHP Strict standards: Declaration of UserFrosting\User::fresh() should be compatible with Illuminate\Database\Eloquent\Model::fresh(array $with = Array) in C:\Server\userfrosting\models\database\User.php on line 570 means that the UserFrosting\User::fresh() method should accept the same types of arguments as Illuminate\Database\Eloquent\Model::fresh(array $with = Array).

    The issue can be reproduced with the following code:

    test.php

    <?php
    class A {
      public function test ($arg = 'default value') {
        echo $arg;
      }
    }
    
    class B extends A {
      public function test () {
        echo __METHOD__;
      }
    }
    
    $b = new B;
    $b->test();
    

    Running the script:

    $ php test.php
    PHP Warning:  Declaration of B::test() should be compatible with A::test($arg = 'default va...') in /home/ruslan/tmp/src/test.php on line 12
    

    To fix it we should just modify test method in the derived class according to the parent method:

    class B extends A {
      public function test ($arg = 'X value') {
        echo __METHOD__;
      }
    }
    

    Running the script:

    $ php test.php 
    B::test