1

Here is my code:

    <?php
    namespace joe;

    function shutdown()
    {
            if(is_null($e = error_get_last()) === false)
            {
                    mail('bili@web.de', 'Error from auto_prepend', print_r($e, true));
            }
    };

    register_shutdown_function('shutdown');
    ...

With this lines I will get the error:

Warning: register_shutdown_function(): Invalid shutdown callback 'shutdown' passed in /www/...

If I delete my namespace it works like a charm. Whats wrong??

Pradeep
  • 9,481
  • 13
  • 27
  • 34
hamburger
  • 1,193
  • 4
  • 16
  • 40
  • `register_shutdown_function('joe\\shutdown');` – naththedeveloper May 22 '18 at 13:35
  • 1
    Possible duplicate of [Why is my 'shutdown callback ' invalid when using register\_shutdown\_function()?](https://stackoverflow.com/questions/36881034/why-is-my-shutdown-callback-invalid-when-using-register-shutdown-function) – Mate May 22 '18 at 13:36
  • 1
    thx to naththedeveloper. It seems that I did not understand the namespace stuff. I have seen the duplicate marked answer before. But I did'nt see the context. – hamburger May 22 '18 at 13:42

0 Answers0