throw new Exception in PHP

Asked

Viewed 2,517 times

0

Good afternoon, I’m having trouble with a script

switch($engine) {
        case "asterisk":
            if(method_exists($core_conf, "addRtpAdditional")) {
                $core_conf->addRtpAdditional('general', array("icesupport" => "yes"));
            } else {
                throw new \Exception(_("Please update the module named 'motif' or enable the module named 'core'."));
            }
            break;
    }

the problem happens in this line here

throw new \Exception(_("Please update the module named 'motif' or enable the module named 'core'."));

my server is php 5.1.6

the error that appears is this

[Wed Feb 08 16:59:18 2017] [error] [client 200.204.166.13] PHP Warning:  Unexpected character in input:  '\\' (ASCII=92) state=1 in /var/www/html/admin/modules/motif/functions.inc.php on line 21
  • 3

    Remove the Exception bar, let only throw new Exception(...)

  • I’ll try thank you

1 answer

3

  • 1

    Just to complement, the character only becomes valid from the PHP version that implemented the namespaces (PHP 5.3.0 onwards).

Browser other questions tagged

You are not signed in. Login or sign up in order to post.