If you run PHP 5.3.0 with notices turn on you get a flurry of notices with every page load about errors in common.inc.

Notice: Undefined offset: 8192 in T:\home\clist.d6\public_html\includes\common.inc on line 602
Notice: Undefined offset: 8192 in T:\home\clist.d6\public_html\includes\common.inc on line 609

The fix: In common.inc, on line 581, the line that reads:

$types = array(1 => 'error', 2 => 'warning', 4 => 'parse error', 8 => 'notice', 16 => 'core error', 32 => 'core warning', 64 => 'compile error', 128 => 'compile warning', 256 => 'user error', 512 => 'user warning', 1024 => 'user notice', 2048 => 'strict warning', 4096 => 'recoverable fatal error');

should read (as per http://ca2.php.net/manual/en/errorfunc.constants.php ):

$types = array(1 => 'error', 2 => 'warning', 4 => 'parse error', 8 => 'notice', 16 => 'core error', 32 => 'core warning', 64 => 'compile error', 128 => 'compile warning', 256 => 'user error', 512 => 'user warning', 1024 => 'user notice', 2048 => 'strict warning', 4096 => 'recoverable fatal error', 8192=> 'use of deprecated functions', 16384=>'use of deprecated user code');

Comments

Erich Schulz’s picture

Version: 6.x-dev » 6.13

Thanks yes I concur! only the fix is on line 591 in 6.13!

i was just about to hack this on my local install, and a google for the php error codes brought me here!! perfect!

codecowboy’s picture

Version: 6.13 » 7.x-dev
Component: system.module » base system
StatusFileSize
new728 bytes

Here is a patch.

Status: Needs review » Needs work

The last submitted patch failed testing.

mfb’s picture

Status: Needs work » Needs review
StatusFileSize
new885 bytes

E_DEPRECATED will not be defined in PHP 5.2, so using these new constants should be conditional.

drifter requested that failed test be re-tested.

webchick’s picture

Version: 7.x-dev » 6.x-dev
Status: Needs review » Patch (to be ported)

Committed to HEAD. Looks like exists in 6.x as well. Doesn't apply cleanly, though, so needs porting.

cburschka’s picture

This also exists in Drupal 5, though I can't remember if 5.x is supposed to support PHP 5.3+.

Since Drupal 5 does not use the PHP-defined bitmask constants, the unconditional change in the original post works just fine.

cburschka’s picture

Note that in D6, Drupal will actually define the E_DEPRECATED bitmask if it does not exist. However, it doesn't actually use the bitmask when making the type array.

In particular, it has an odd condition there:


if ($errno & (E_ALL ^ E_DEPRECATED)) {
    $types = array(1 => 'error', 2 => 'warning', 4 => 'parse error', 8 => 'notice', 16 => 'core error', 32 => 'core warning', 64 => 'compile error', 128 => 'compile warning', 256 => 'user error', 512 => 'user warning', 1024 => 'user notice', 2048 => 'strict warning', 4096 => 'recoverable fatal error');

summit’s picture

Original fix worked well for me! thanks!
greetings, Martijn

ñull’s picture

subscribing and bump

brianfeister’s picture

Version: 6.x-dev » 5.2

This fixed worked PARTIALLY for me. Changing this code caused the error to go away for logged-in users, but it is still visible to non-logged-in users. How can I get rid of the error for them as well?

webchick’s picture

One reason it might be showing for non-logged in users because page caching is enabled. Try clearing the cache and see if that fixes it.

webchick’s picture

Version: 5.2 » 6.x-dev

Also, setting back to 6.x-dev. 5.x is no longer supported.

roball’s picture

Issue summary: View changes
Status: Patch (to be ported) » Closed (works as designed)

This problem does not exist in the current D6 release.

roball’s picture

Priority: Critical » Normal
Status: Closed (works as designed) » Active

Sorry, no - the problem DOES actually still exist in Drupal 6, affecting PHP versions < 5.3, where E_DEPRECATED is not defined.

roball’s picture

Title: drupal_error_handler does not support PHP 5.3.0 error constants » E_DEPRECATED may be used even if it is not defined (affecting PHP versions < 5.3)
Status: Active » Needs review
StatusFileSize
new1.14 KB

The attached patch fixes the bug. Also correcting this issue's title for Drupal 6. The only problem in D6 is that PHP versions < 5.3 would trigger the E_NOTICE message Use of undefined constant E_DEPRECATED.

roball’s picture

StatusFileSize
new1.27 KB

Attached is the same patch as in #16 above, but with an added comment as requested in #1954296: Restore original D6 behaviour to prevent logging E_STRICT warnings.

NaX’s picture

Status: Needs review » Reviewed & tested by the community
roball’s picture

Sure that nowadays there is no more deep focus on D6, but is there any chance the reviewed patch from #17 will be committed to 6.x ?

Status: Reviewed & tested by the community » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.