Problem/Motivation
When running a test that triggers an error with the severity E_USER_DEPRECATED or E_DEPRECATED the test suite crashes with the following fatal error:
Notice: Undefined offset: 16384 in /var/lib/drupaltestbot/sites/default/files/checkout/modules/simpletest/drupal_web_test_case.php on line 545
exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'message_group' cannot be null' in /var/lib/drupaltestbot/sites/default/files/checkout/includes/database/database.inc:2168
These codes were only intruduced in PHP 5.3.0 and although included in drupal_error_levels() (API) they are not supported by DrupalTestCase::errorHandler() (API).
To reproduce, test any code with
trigger_error('Message', E_USER_DEPRECATED);
in it. For example, this patch: #2090987: Provide methods on the Party entity to access data sets (#14)
Proposed resolution
Add E_DEPRECATED and E_USER_DEPRECATED to DrupalTestCase::errorHandler() and set to bo "Run-time notice"
Comments
Comment #1
rlmumfordHere's a test that will do nothing on servers running PHP 5.2 but will fail on PHP 5.3
Comment #2
rlmumfordThere was a typo in that one. (Embarrassing). Here's the test. The patch should fail.
Comment #3
rlmumfordThis one has the fix in it. The test still doesn't pass, but I don't know how to set the error handler in a way that will detect the 500 error thrown but not detect it otherwise.
Comment #5
pfrenssenThis is a duplicate of #2054205: Broken Tests on PHP 5.5 which already has been committed to D8 and has a backport for D7.