Closed (won't fix)
Project:
Drupal core
Version:
8.0.x-dev
Component:
base system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
21 Feb 2009 at 21:04 UTC
Updated:
29 Jul 2014 at 18:09 UTC
Jump to comment: Most recent file
Comments
Comment #1
karens commentedEdit, I mean PHP 5.3.
Comment #2
yhahn commentedo man. hook #fail
will think about best path to victory for this one...
Comment #3
thekevinday commentedThat certainly explains why I cannot find the date_diff() in the date module that I happen to have installed.
The only thing I can imagine doing is adding a more unique string to the _diff() hook, but that would break existing modules.
Is it possible to blacklist certain names for drupal hooks?
I will look into this as well as I would like to get this solved asap.
Comment #4
thekevinday commentedAfter looking around the PHP docs, this seems to be what we want to use:
http://us3.php.net/manual/en/function.get-defined-functions.php
PHP core functions get stored in the array called:
internalAll others seem to get stored in the array called:
userThe drupal_hook() needs to be changed to only call a hook if it is defined in the
userarray.I have attached a patch that makes this check for drupal 6.x.
The patch changes
module_invokeandmodule_invoke_allto have the following added:I have moved this thread to drupal core because I believe this is the proper solution to this problem.
If you think otherwise, please move this issue back to the Diff project.
Comment #5
damien tournoud commentedBumping to D7 for consideration. Changing module_hook() seems to be the only thing necessary here.
Comment #6
thekevinday commentedI wonder what would happen if the
get_defined_function()failed to return a properly populated array.I am now thinking that if the
get_defined_function()function failed to return sane results that the code should gracefully fail.Would
isset()be a better choice in this case thanis_array($defined) && array_key_exists('user', $defined)?For example:
The idea with that change would be to fallback to previous behavior if the
$definedvariable is not properly populated.EDIT:
After reading #5, I just tried only changing
module_hook(), but the original php error message appears.Did you mean
module_hook_all()?I also just tried only changing
module_hook_all()instead ofmodule_hook()and the original php error message does not appear.Comment #7
damien tournoud commentedComment #8
thekevinday commented#4: drupal-6.x-avoid_internal_hookage-1.patch queued for re-testing.
Comment #10
superspring commentedThis fixes the bug in Drupal 8
Comment #11
tim.plunkettThis seems like it might be worth statically caching, thoughts?
Comment #12
chx commentedThis would very slow and a memory hog. Sorry.