Drupal core, Drupal contrib and 3rd party libraries are all equally guilty of abusing the global namespace in PHP.

This particular issue deals with one particular function that is often in conflict: error_handler().

Drupal's really should be named drupal_error_handler().

Comments

Chris Johnson’s picture

Status: Active » Needs review
StatusFileSize
new1.11 KB

Patch for Drupal 6 core attached.

Chris Johnson’s picture

StatusFileSize
new1.12 KB

Patch for Drupal 5 attached.

Chris Johnson’s picture

StatusFileSize
new1.13 KB

Patch for Drupal 4.7 attached.

Chris Johnson’s picture

Example problem with the 3rd party Sparkline library: http://drupal.org/node/131060

Chris Johnson’s picture

StatusFileSize
new2.14 KB

Patch for all Drupal 6 contrib modules which call the core error_handler() function directly.

Chris Johnson’s picture

StatusFileSize
new1.48 KB

Patch for all Drupal 4.7 contrib modules which call the core error_handler() function directly.

Note these are only modules which are actually tagged DRUPAL-4-7.

Note also that there appear to be no modules tagged DRUPAL-5 with these calls, which leads me to believe they simply are not tagged, rather than they don't exists. For example, both modules patched here for 4.7 are also patched in HEAD for 6.

dries’s picture

Status: Needs review » Reviewed & tested by the community

Works for me. Will commit when home. :-)

dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks.

Chris Johnson’s picture

Great!

If I just had time, I'd go through all of core (and then all of contrib), and clean up all the namespace problems. Then I'd continue with cleaning up all the other little things. ;-)

Can this be applied to D5 if we roll another 5.x release? I know the sparkline users would appreciate it. (Do we have a policy on core changes after a release?)

drumm’s picture

I don't think this will go into 5. Function name changes are generally API changes, although this function might be exempt since it is the internal error handler.

Anonymous’s picture

Status: Fixed » Closed (fixed)