coolkid
coolkid

Reputation: 543

Cache error in error_get_last function?

I'm inspecting an open source web application. There's aproblem that it used error_get_last function as in this code

$last_error = error_get_last();
if($last_error['type'] === E_ERROR || $last_error['type'] === E_PARSE) {
  include 'error.php';
}
if (ob_get_length()) ob_end_flush();

It annoys me because it seem that it cache old error of the old code however the edited code doesn't have any error. Therefore it display old error for a while. Does anyone know how to solve this problem? Thanks for any help

Edit: I show the function __shutdown() where the code run in the end of a request

function __shutdown() {
    $logger_session = Logger::getSession();
    if (($logger_session instanceof Logger_Session) && !$logger_session->isEmpty()) {
      Logger::saveSession();
    } // if
    $last_error = error_get_last();
    if($last_error['type'] === E_ERROR || $last_error['type'] === E_PARSE) {
      include 'error.php';
    }
    if (ob_get_length()) ob_end_flush();
  } // __shutdown

Upvotes: 0

Views: 801

Answers (1)

rik
rik

Reputation: 8612

The function error_get_last does not cache anything, it's just a function like substr and all the others. If what you see seems to be cached, the cacheing happens at a different place. Maybe you are editing the wrong file (or you didn't really fix the error), have an opcode or output cache or whatever.

Upvotes: 1

Related Questions