Download & Extend

drupal_error_handler does not support PHP 5.3.0 error constants

Project:Drupal core
Version:6.x-dev
Component:base system
Category:bug report
Priority:critical
Assigned:Unassigned
Status:patch (to be ported)

Issue Summary

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

#1

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!

#2

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

Here is a patch.

AttachmentSizeStatusTest resultOperations
524664.patch728 bytesIdleFailed: 13457 passes, 12 fails, 0 exceptionsView details | Re-test

#3

Status:needs review» needs work

The last submitted patch failed testing.

#4

Status:needs work» needs review

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

AttachmentSizeStatusTest resultOperations
deprecated.patch885 bytesIdleUnable to apply patch deprecated.patchView details | Re-test

#5

drifter requested that failed test be re-tested.

#6

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.

#7

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.

#8

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:

<?php
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');
?>

#9

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

#10

subscribing and bump

#11

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?

#12

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.

#13

Version:5.2» 6.x-dev

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

nobody click here