backend when assertions fail.
Thus, you can write the following code:
assert ('$toto != blah')
If you run in debug mode, this will be evaluated and will raise an
exception in case of error. If you run in production mode, this will juste
be skipped.
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
$this->baseurl = @trim($base .$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']), '/');
$this->baseurl_http = @trim('http://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']), '/');
}
+ assert_options(ASSERT_ACTIVE, $this->debug != 0);
$this->setLocale();
}
}
}
+function pl_assert_cb($file, $line, $message)
+{
+ Platal::assert(false, "Assertion failed at $file:$line with message: $message");
+}
+
set_error_handler('pl_error_handler', E_ALL | E_STRICT);
+assert_options(ASSERT_CALLBACK, 'pl_assert_cb');
+assert_options(ASSERT_WARNING, false);
if (php_sapi_name() == 'cli') {
register_shutdown_function('pl_print_errors');
}