Allowed Memory Size Bytes Exhausted

Joined: 11/28/2008
User offline. Last seen 38 weeks 6 days ago.

I'm making a registration form for a clients site and I've gotten an error:

QUOTE
Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 4104 bytes) in /var/www/html/wp-includes/cache.php on line 48

and line 48 in cache.php (which is a wordpress file) is

CODE
46.  function wp_cache_set($key, $data, $flag = '', $expire = 0) {
47.    global $wp_object_cache;
48.    $data = unserialize(serialize($data));
49.
50.    return $wp_object_cache->set($key, $data, $flag, $expire);
51.  }

The line of code that is causing the error is 261, 262 and 263.

CODE
258.   $i=1;
259.   while($i <= get_option(session_id().'childrennumber')){
260.      echo "<td></td>";
261.      echo "<td>". get_option(session_id().'child'.$i.'name') ."</td>";
262.      echo "<td>". get_option(session_id().'child'.$i.'age'). "</td>";
263.      echo "<td>". get_option(session_id().'child'.$i). "</td>";
264.      $i++;    
265.    } // end while

And this is where I'm creating them

CODE
80.   $i=1;
81.   while ($i <= get_option(session_id().'childrennumber')){
82.      update_option(session_id().'child'.$i.'name', $_REQUEST['child'.$i.'name']);
83.      update_option(session_id().'child'.$i.'age', $_REQUEST['child'.$i.'age']);
84.      update_option(session_id().'child'.$i, $_REQUEST['child'.$i]);
85.      $i++;
86.    } // end while

Update_option() in Wordpress plugins creates or updates the item to the database and get_option() just gets it.

You can see the whole code here.

I don't see where it's overloading it. Any suggestions?

Joined: 11/28/2008
User offline. Last seen 3 years 10 weeks ago.
Echo

Echo get_option(session_id().'childrennumber'), to see the number of times the loop iterates.

Also, what is the point of unserialize(serialize(.)), that would imply $data = $data wouldn't it?

~Andrew~

Joined: 11/28/2008
User offline. Last seen 3 years 9 weeks ago.
I can't see where

I can't see where $_REQUEST['childrennumber'] would be defined in any of your forms. Though that should make it effectively 0.

Paul Davey
Whitford Church
"Everyone who calls on the name of the Lord will be saved." Romans 10:13
"For all have sinned and fall short of the glory of God, and are justified

Joined: 11/28/2008
User offline. Last seen 38 weeks 6 days ago.
Nexonen @ Mar 24 2008,
QUOTE(Nexonen @ Mar 24 2008, 03:07 AM)
Echo get_option(session_id().'childrennumber'), to see the number of times the loop iterates.

Also, what is the point of unserialize(serialize(.)), that would imply $data = $data wouldn't it?

Nope, that's not looping out of control. I input 3 and it returns just that.

I don't know about that unserialize(serialize()). That's what WordPress has in their cache.php.

QUOTE(bobbymac @ Mar 24 2008, 09:17 AM)
I can't see where $_REQUEST['childrennumber'] would be defined in any of your forms. Though that should make it effectively 0.

I have it in an include on line 33. You can view the page here

Thanks for working with me. Keep it comming

Joined: 11/28/2008
User offline. Last seen 38 weeks 6 days ago.
Ah hah! I figured out the

Ah hah! I figured out the problem. Simply a missing $i++; in the while().

Thanks guys!