Giter VIP home page Giter VIP logo

Comments (9)

dereuromark avatar dereuromark commented on May 23, 2024

Is that in debug mode (with exception handling to browser output) or in production mode (log only)?

from cakephp-databaselog.

dereuromark avatar dereuromark commented on May 23, 2024

I cannot reproduce this for both debug and production with the documented approach.
In either way it is logged as expected for e.g.

<?php blaaaa ($tasks as $task) { ?>

as

[ParseError] syntax error, unexpected 'as' (T_AS), expecting ',' or ')

etc

Running on PHP7.1 (I think if you are on 5.6 this is an issue of our error handling in core).

from cakephp-databaselog.

inoas avatar inoas commented on May 23, 2024

Even on production mode it should log, should it not?

from cakephp-databaselog.

jcsiegrist avatar jcsiegrist commented on May 23, 2024

for me php return TypeErrors also do not log to DatabaseLog but log to default file Log.

function foo(string $string): string
{
   return null;
}

from cakephp-databaselog.

dereuromark avatar dereuromark commented on May 23, 2024

Could this be the issue of the ErrorHandler? Does stepping through with a debugger yield any more info here?

from cakephp-databaselog.

dereuromark avatar dereuromark commented on May 23, 2024

What PHP version are you using?
And what ErrorHandling setup?
Because in my case it also works there:

[TypeError] Return value of App\...::foo() must be of the type string, null returned

is properly logged to DB

from cakephp-databaselog.

dereuromark avatar dereuromark commented on May 23, 2024

Note that the Cake internal error handler has an issue with internal errors in PHP7.0+:

        try {
            if (!$rendererClassName) {
                throw new Exception("$rendererClassName is an invalid class.");
            }
            /* @var \Cake\Error\ExceptionRendererInterface $renderer */
            $renderer = new $rendererClassName($exception);
            $response = $renderer->render();
            $this->_clearOutput();
            $this->_sendResponse($response);
        } catch (Exception $e) {
            // Disable trace for internal errors.
            $this->_options['trace'] = false;
            $message = sprintf(
                "[%s] %s\n%s", // Keeping same message format
                get_class($e),
                $e->getMessage(),
                $e->getTraceAsString()
            );
            trigger_error($message, E_USER_ERROR);
        }

The PHP7 throwable catch part is missing here IMO.
And there might be other cases missing in other places.

Refs cakephp/cakephp#9043

from cakephp-databaselog.

dereuromark avatar dereuromark commented on May 23, 2024

Should be fixed with cakephp/cakephp#11462
Can someone confirm that branch of CakePHP together with PHP7 works?

from cakephp-databaselog.

inoas avatar inoas commented on May 23, 2024

I assume cakephp/cakephp#11462 will make it into 3.5.x branch - if yes, I hope I won't forget to attempt to use this Logger again with the next 3.5.x release and report back on low level errors, such as syntax.

from cakephp-databaselog.

Related Issues (18)

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.