errors = array(null); set_error_handler(array($this, 'addError'), \E_WARNING); $nodeList = $this->query($expression); restore_error_handler(); $exception = array_pop($this->errors); if ($exception) { throw $exception; } return $nodeList; } /** * Adds an error to the stack of errors * * @param int $errno * @param string $errstr * @param string $errfile * @param int $errline * @return void */ public function addError($errno, $errstr = '', $errfile = '', $errline = 0) { $last_error = end($this->errors); $this->errors[] = new ErrorException( $errstr, 0, $errno, $errfile, $errline, $last_error ); } }