Array Bug?
| From: | Robert Covell | Date: | Mon, 30 Jul 2001 14:24:55 +0000 |
| Subject: | Array Bug? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-60220@lists.php.net to get a copy of this message | ||
Recently I have noticed very strange occurances with PHP and arrays and
cannot for the life of me figure out why. When I deal with a large array,
+2000 entries the Apache child process Aborts. The same is true when I am
working with about 20 different arrays the vary in length, ranging from 3 to
30(total lines of code~230). To make it stranger, the later case mentioned,
works in PHP Version 4.0.4pl1 and does not work in PHP Version 4.0.6.
I switched to PHP Version 4.0.6 because the 4.0.4p1 child process was
Aborting when I tried to add words from MySql to a pspell dictionary. I
verified that the data was actually returning from MySql and that it got the
code to add it to the dictionary:
----------Code Example-----------
//Test loop to recreate crash manually without MySql
// for ($y=0;$y<2000;$y++)
// $wordlist[]=$y;
$query = "select check_word from dictionary";
$words = $db->selectQuery($query);
// for ($q=0;$q<2;$q++)
for ($q=0; $q<count($words); $q++)
{
$word = $words[$q]["check_word"];
// $wordlist[] = $words[$q]["check_word"];
echo "<br>" . $word;
$wordlist[]=$word;
}
//The data is all there
print_r($wordlist);
$sp = new SpellChecker($symbols, $wordlist, $wrongcolor);
--------In SpellChecker.checkSpelling()-----------
// for ($i=0;$i<5;$i++)
for ($i=0;$i<count($this->wordlist);$i++)
pspell_add_to_personal ($pspell_link, $this->wordlist[$i]);
If I comment out the above line to add only 5 elements to the list it
Aborts. If I change the 5 to a 4, it works.
The data at element 5 is: ACCP's
for live data.
And for test data it is: 5
In either case, live data or test data, the child apache process aborted
with both versions of PHP. PHP 4.0.4pl1 did not crash when including a file
with a list of arrays that are used for site Default values whereas 4.0.6
did. I have gone back to PHP 4.0.4pl1 for now.
Sincerely,
Robert T. Covell
President / Owner
Rolet Internet Services, LLC
Web: www.rolet.com
Email: rcovell@rolet.com
Phone: 816.210.7145
Fax: 816.753.1952