I was working on http://drupal.org/node/81958 and found a bug with t(), specifically the array_walk() function.
With the patch working, when deleting users with PHP 4.4.2, it returns a blank screen or warning: array_walk(): Unable to call () - function does not exist in /Users/edmund/Documents/htdocs/cvs/drupal/includes/common.inc on line 636. Digging deeper leads to the t() in user_delete when returning feedback to admin for deleted users (watchdog and drupal_set_message).
Works alrite with PHP 5. Changing the placeholder from % to @ in the t()'s of user_delete makes the problem disapear.
Heine experienced the same problem, and chx pointed out http://bugs.php.net/bug.php?id=20658.
Comment | File | Size | Author |
---|---|---|---|
#8 | t_no_array_walk_inline.patch.txt | 2.9 KB | Heine |
#7 | common.inc.1.572_p1.txt | 990 bytes | AjK |
#3 | t_no_array_walk.patch.txt | 676 bytes | Heine |
Comments
Comment #1
edmund.kwok CreditAttribution: edmund.kwok commentedTo reproduce if you're running PHP 4:
1. Get latest HEAD and patch http://drupal.org/files/issues/delete_multiple_users_7.patch user.module
2. Add dummy users, skip this if you already have them
3. Start deleting users! (try selecting only one user to delete, or two users one after another, or two users both at different ends of the list, or just randomly select)
4. You'll know you hit the bug when you get a blank screen or the warning message instead of a delete successful message.
Admin logs might have some clues as to what's happening.
Comment #2
chx CreditAttribution: chx commentedI only linked that bug out to make my point that array_walk is very unlikely (but of course not impossible) to be the culprit as that's the only open array_walk crash bug and it's severl years old.
But, why the array_walk here? Is a mere php loop slower than iterating with array_walk which includes a function call?
Comment #3
Heine CreditAttribution: Heine commentedt() segfaults either gives the above warning or segfaults Apache (Apache/2.2.2 (Win32), php 4.4.2-pl) on certain pages. Last string & args before crash on user delete:
Attached patch replaces array_walk with a loop. I haven't observed any crashes or array_walk errors since.
Comment #4
edmund.kwok CreditAttribution: edmund.kwok commentedTested patch and no more warnings or blank pages.
Comment #5
AjK CreditAttribution: AjK commentedPatch in #3, applied and tested. Looks good.
regards,
--AjK
Comment #6
chx CreditAttribution: chx commentedwhy the function call inside the loop? move the switch inside.
Comment #7
AjK CreditAttribution: AjK commentedchx, you mean like in the attached patch?
The comments for _t() refer to t() and st() but couldn't find st() in the API manual. If st() "is no more" then the helper function _t() could be removed.
regards,
--AjK
Comment #8
Heine CreditAttribution: Heine commentedboth _t and _st replaced with an inline foreach
Comment #9
AjK CreditAttribution: AjK commentedPatch in #8 applied and tested. Looks good.
regards,
--AjK
Comment #10
dwwi was having all sorts of evil problems trying to run update.php from 4.7 to 5.0 on my local test site and apache kept seg faulting or getting bus errors. after applying #8, all those problems went away, and i could finally update to 5.0. i reviewed the code and it looks fine to me. patch from #8 is hereby RTBC.
Comment #11
drummCommitted to HEAD.
Comment #12
(not verified) CreditAttribution: commented