f3-factory / fatfree-core

Fat-Free Framework core library
GNU General Public License v3.0
207 stars 88 forks source link

Error log not being written due to Uncaught Error #272

Closed richardHangHimself closed 5 years ago

richardHangHimself commented 5 years ago

Recently upgraded to php 7.x and F3 3.6.5. I ran into it, cannot figure it our, if that's a problem with loading by composer or something else. It is intentionally causing error to be caught by logger instance and produced to a log file. But it is not working after that upgrade.

"PHP message: syntax error, unexpected '$this' (T_VARIABLE) [/var/www/html/mtl/application/Mnt.php:352]PHP message: [vendor/bcosca/fatfree-core/base.php:1634] class_exists('Mnt')PHP message: [index.php:41] Base->run()PHP message: PHP Fatal error:  Uncaught Error: Wrong parameters for Error([string $message [, long $code [, Throwable $previous = NULL]]]) in /var/www/html/mtl/vendor/bcosca/fatfree-core/base.php:1823
Stack trace:
#0 [internal function]: Error->__construct(Object(Base), Array)
#1 /var/www/html/mtl/vendor/bcosca/fatfree-core/base.php(1823): ReflectionClass->newInstanceArgs(Array)
#2 /var/www/html/mtl/vendor/bcosca/fatfree-core/base.php(1844): Base->grab('Error->error_lo...', Array)
#3 /var/www/html/mtl/vendor/bcosca/fatfree-core/base.php(1294): Base->call('Error->error_lo...', Array, 'beforeroute,aft...')
#4 /var/www/html/mtl/vendor/bcosca/fatfree-core/base.php(2255): Base->error(500, 'syntax error, u...', '[vendor/bcosca/...')
#5 [internal function]: Base->{closure}(Object(ParseError))
#6 {main}
  thrown in /var/www/html/mtl/vendor/bcosca/fatfree-core/base.php on line 1823PHP message: Fatal error: Uncaught Error: Wrong parameters for Error([string $message [, long $code [, Throwable $previous = NULL]]]) in /var/www/html/mtl/vendor/bcosca/fatfree-core/base.php:1823
Stack trace:
#0 [internal function]: Error->__construct(Object(Base), Array)
#1 /var/www/html/mtl/vendor/bcosca/fatfree-core/base.php(1823): ReflectionClass->newInstanceArgs(Array)
#2 /var/www/html/mtl/vendor/bcosca/fatfree-core/base.php(1844): Base->grab('Error->error_lo...', Array)
#3 /var/www/html/mtl/vendor/bcosca/fatfree-core/base.php(1294): Base->call('Error->error_lo...', Array, 'beforeroute,aft...')
#4 /var/www/html/mtl/vendor/bcosca/fatfree-core/base.php(2255): Base->error(500, 'syntax error, u...', '[vendor/bcosca/...')
#5 [internal function]: Base->{closure}(Object(ParseError))
#6 {main}
  thrownPHP message: [vendor/bcosca/fatfree-core/base.php:1823]" while readin
ikkez commented 5 years ago

Check /var/www/html/mtl/application/Mnt.php:352, is says: unexpected '$this'.. also strange: Uncaught Error: Wrong parameters for Error([string $message [, long $code [, Throwable $previous = NULL]]]). Do you have an own class with name Error? If so rename it, because php7+ now has its own Error class, probably colliding with a custom one.

richardHangHimself commented 5 years ago

Ah... yes it was colliding all the time with the custom Error function I totally overlooked. Thank you!