Get current function name in strict mode

For logging/debugging purposes, you can create a new Error object in the logger and inspect its .stack property, e.g. function logIt(message) { var stack = new Error().stack, caller = stack.split(‘\n’)[2].trim(); console.log(caller + “:” + message); } function a(b) { b() } a(function xyz() { logIt(‘hello’); });

PHP 5 disable strict standards error

Do you want to disable error reporting, or just prevent the user from seeing it? It’s usually a good idea to log errors, even on a production site. # in your PHP code: ini_set(‘display_errors’, ‘0’); # don’t show any errors… error_reporting(E_ALL | E_STRICT); # …but do log them They will be logged to your standard … Read more

Strict Standards: mysqli_next_result() error with mysqli_multi_query

While pipodesign corrected the error within the $querystring and alleviated the problem, the actual solution was not provided regarding the Strict Standards error. I disagree with SirBT’s advice, changing from DO WHILE to WHILE is not necessary. The Strict Standards message that you receive is quite informative. To obey, use this: do{} while(mysqli_more_results($db) && mysqli_next_result($db)); … Read more

Error message “Strict standards: Only variables should be passed by reference”

Consider the following code: error_reporting(E_STRICT); class test { function test_arr(&$a) { var_dump($a); } function get_arr() { return array(1, 2); } } $t = new test; $t->test_arr($t->get_arr()); This will generate the following output: Strict Standards: Only variables should be passed by reference in `test.php` on line 14 array(2) { [0]=> int(1) [1]=> int(2) } The reason? … Read more