Make examples fail on any PHP diagnostic
Previously we called set_error_handler() in tests.php to do this, but that only sets it for the test-suite. Now we set it in on the PHP command line, which works for both.
This commit is contained in:
parent
e22dd47ff5
commit
d6f9f4b6c0
3 changed files with 1 additions and 14 deletions
|
|
@ -1076,7 +1076,7 @@ php_cpp: $(SRCDIR_SRCS)
|
|||
# -----------------------------------------------------------------
|
||||
|
||||
php_run:
|
||||
$(RUNTOOL) $(PHP) -n -d extension_dir=. -d display_errors=stderr $(PHP_SCRIPT) $(RUNPIPE)
|
||||
$(RUNTOOL) $(PHP) -n -d extension_dir=. -d display_errors=stderr -r 'set_error_handler(function($$n,$$s,$$f,$$l){if($$f!==Null){print$$f;if($$l!==Null)print":$$l";print": ";}print"$$s\n";exit(1);});include($$argv[1]);' $(PHP_SCRIPT) $(RUNPIPE)
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# Version display
|
||||
|
|
|
|||
|
|
@ -31,9 +31,7 @@ check::is_a($spam,"spam");
|
|||
check::equal(1,$spam->_foo,"1==spam->_foo");
|
||||
check::equal(2,$spam->_bar,"2==spam->_bar");
|
||||
// multiple inheritance not supported in PHP
|
||||
set_error_handler(function () {return true;}, E_NOTICE|E_WARNING); // Don't complain that _baz is unknown.
|
||||
check::equal(null,$spam->_baz,"null==spam->_baz");
|
||||
restore_error_handler();
|
||||
check::equal(4,$spam->_spam,"4==spam->_spam");
|
||||
|
||||
check::done();
|
||||
|
|
|
|||
|
|
@ -1,16 +1,5 @@
|
|||
<?php
|
||||
|
||||
function die_on_error($errno, $errstr, $file, $line) {
|
||||
if ($file !== Null) {
|
||||
print $file;
|
||||
if ($line !== Null) print ":$line";
|
||||
print ": ";
|
||||
}
|
||||
print "$errstr\n";
|
||||
exit(1);
|
||||
}
|
||||
set_error_handler("die_on_error", -1);
|
||||
|
||||
$_original_functions=get_defined_functions();
|
||||
$_original_globals=1;
|
||||
$_original_classes=get_declared_classes();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue