ID: 29935 Comment by: rob at sharp dot id dot au Reported By: webmaster at martialartsmovies dot net Status: No Feedback Bug Type: Arrays related Operating System: Windows XP PHP Version: 5.0.1 New Comment:
I am seeing the same error using version 4.4.1, and was able to remove the error by explicitly allocating arrays using $variable = Array(); $variable[] = $object; Instead of allocating data using $variable[] = $object; Previous Comments: ------------------------------------------------------------------------ [2005-05-06 17:26:28] hans at velum dot net FYI, I'm using PHP 5.0.4. ------------------------------------------------------------------------ [2005-05-06 17:22:48] hans at velum dot net I am also getting segfaults using array_filter on Apache 2 (on Gentoo Linux). My backtrace looks like: #0 0x4070246e in zif_array_filter () from /etc/apache/modules/libphp5.so #1 0xbfff3f0c in ?? () #2 0xbfff3f10 in ?? () #3 0xbfff3f14 in ?? () I'm not sure what more I can get from that backtrace. My array filter code looks like: $discs = array_filter(Bb_DiscussionPeer::doSelectUnreadForUserByClique($cliqueId, $uid), array($this, 'hasPerms')); Where the first param to array_filter is an array of objects (verified). And the hasPerms method is a method in parent class that looks like this: protected function hasPerms($obj) { return ($obj->canUser(Perms::READ)); } (Changing that to be a 'public' method doesn't help.) I can't seem to narrow down the bug any more than that. It doesn't seem to happen *all* the time either, but if I have two such similar calls on a page it will segfault. Sometimes it will segfault if there's only one, but sometimes it works without segfaulting. ------------------------------------------------------------------------ [2004-09-17 01:00:03] php-bugs at lists dot php dot net No feedback was provided for this bug for over a week, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open". ------------------------------------------------------------------------ [2004-09-02 08:17:57] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php5-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php5.0-win32-latest.zip Your code works fine for me, please try a snapshot. ------------------------------------------------------------------------ [2004-09-01 20:10:27] webmaster at martialartsmovies dot net Description: ------------ I have PHP 5.0.1 installed together with the latest stable Apache 2 on Windows XP SP2. I used the example on the array_filter page on php.net an all I got was a window telling me that apache caused a problem and it needed to reboot. Reproduce code: --------------- <?php function odd($var) { return($var % 2 == 1); } function even($var) { return($var % 2 == 0); } $array1 = array("a"=>1, "b"=>2, "c"=>3, "d"=>4, "e"=>5); $array2 = array(6, 7, 8, 9, 10, 11, 12); echo "Odd :\n"; print_r(array_filter($array1, "odd")); echo "Even:\n"; print_r(array_filter($array2, "even")); ?> Expected result: ---------------- the array_filter function applied to the 2 arrays Actual result: -------------- apache 2 crashed. error.log: [Wed Sep 01 19:47:14 2004] [notice] Child 2412: Child process is running [Wed Sep 01 19:47:14 2004] [notice] Child 2412: Acquired the start mutex. [Wed Sep 01 19:47:14 2004] [notice] Child 2412: Starting 250 worker threads. [Wed Sep 01 19:50:15 2004] [notice] Parent: child process exited with status 3221225477 -- Restarting. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=29935&edit=1