Skip to content

Startup error #1685

@bertmsk

Description

@bertmsk

If you try to start() Madelineproto in a closure instead of regular file you'll get a startup exception in Magic.php:255
self::$script_cwd = self::$cwd = \dirname(end($backtrace)['file']);

because closures don't have "file" value in returned debug_backtrace() array but in "function":

Array
(
    [0] => Array
        (
            [function] => {closure:/app/test.php:35}
            [args] => Array
                (
                )
        )
)

Furthermore, these two lines in the same file should be removed as well:

            set_error_handler(Exception::exceptionErrorHandler(...));
            set_exception_handler(Exception::exceptionHandler(...));

It is very bad practice and anti-pattern to modify exception handling routines inside the library if it's not strictly required by library itself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions