I’m getting the message in log:log.DEBUG: Slim Application Error Type: ParseError Code: 0 Message: syntax error, unexpected ‘throw’ (T_THROW) File: C:.…\www\project\src\LdapConn.phpThis file is like this:
// Constructor
public function __construct ($hostname = "***", $port = 389, $options = [])
{
if (function_exists("ldap_connect")) {
$this->Conn = ldap_connect($hostname, $port);
if (is_array($options)) {
$this->Options = $options + $this->Options;
}
if (is_array($this->Options)) {
foreach ($this->Options as $key => $value) {
ldap_set_option($this->Conn, $key, $value) or throw new \Exception("Unable to set LDAP option: " . $key); //** side effect
}
}
} else {
throw new \Exception("LDAP support in PHP is not enabled. To install, see http://php.net/manual/en/ldap.installation.php."); //** side effect
}
}
I’m modifying the line below to work.
From:
ldap_set_option($this->Conn, $key, $value) or throw new \Exception("Unable to set LDAP option: " . $key); //** side effectTo:
ldap_set_option($this->Conn, $key, $value);In the PHP documentation it says you can’t use it like that.
https://www.php.net/manual/en/language.exceptions.php#81960