Ejemplo n.º 1
0
 function &capture_call($func_name, $exp_length, $args = array(), $debug = FALSE, $check_for_warning = TRUE)
 {
     if ($debug) {
         capture_stop();
         capture_reset_text();
     } else {
         capture_reset_and_start();
     }
     $rval = call_user_func_array($func_name, &$args);
     $this->set_text(capture_stop_and_get());
     capture_reset_text();
     $this->_testFor_string_length($exp_length);
     // this is a paranoia check: make sure that no PHP warnings were
     // generated, if so, then print a warning and the entire text
     if ($check_for_warning && (preg_match('/[<]b[>]Warning[<]\\/b[>]:/', $this->get_text()) || preg_match('/[<]b[>]Fatal error[<]\\/b[>]:/', $this->test_text))) {
         print "<b>CaptureCall: Warning: captured text contained a " . "warning message?</b>\n";
         $this->print_text_as_html();
     }
     return $rval;
 }
Ejemplo n.º 2
0
function capture_reset_and_start()
{
    capture_reset_text();
    capture_start();
}