[PHP] Make the testsuite fail on any PHP diagnostic

This commit is contained in:
Olly Betts 2019-02-09 12:52:25 +13:00
commit 6833bb7e0f
3 changed files with 13 additions and 11 deletions

View file

@ -31,7 +31,9 @@ check::is_a($spam,"spam");
check::equal(1,$spam->_foo,"1==spam->_foo"); check::equal(1,$spam->_foo,"1==spam->_foo");
check::equal(2,$spam->_bar,"2==spam->_bar"); check::equal(2,$spam->_bar,"2==spam->_bar");
// multiple inheritance not supported in PHP // multiple inheritance not supported in PHP
set_error_handler(NULL, 0); // Don't complain that _baz is unknown.
check::equal(null,$spam->_baz,"null==spam->_baz"); check::equal(null,$spam->_baz,"null==spam->_baz");
restore_error_handler();
check::equal(4,$spam->_spam,"4==spam->_spam"); check::equal(4,$spam->_spam,"4==spam->_spam");
check::done(); check::done();

View file

@ -3,17 +3,6 @@
require "tests.php"; require "tests.php";
require "li_std_string.php"; require "li_std_string.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);
// Global variables // Global variables
//$s="initial string"; //$s="initial string";
//check::equal(GlobalString2_get() ,"global string 2", "GlobalString2 test 1"); //check::equal(GlobalString2_get() ,"global string 2", "GlobalString2 test 1");

View file

@ -1,5 +1,16 @@
<?php <?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_functions=get_defined_functions();
$_original_globals=1; $_original_globals=1;
$_original_classes=get_declared_classes(); $_original_classes=get_declared_classes();