[PHP-dev 131] Re: [Apc-cache] Segfault: APC and --enable-debug (Possible serialize/deserialize bug)

Yasuo Ohgaki php-dev@php.gr.jp
Fri, 30 Nov 2001 10:42:22 +0900


George Schlossnagle wrote:

>>>Can you try this under current cvs (as of this afternoon)?  Or send me a
>>>reproduceable test case.  I tried it with
>>>
>>
>>I'll try to create simple scripts that reproduce the problem.
>>
> Great.
> 


I'm not able to create script reproduce segfault (yet), but this 
script cause memory leak with APC. It does not leak memory first 
time loaded, but it leaks memory from second time. PHP does not 
leak memory without APC.

Fixing this problem may fix segfualt...

I also send this mail to Japanese PHP Developer list, since it 
seems this problem is related to mbstring module.

**APACHE ERROR LOG**
apc_serialize.c(1926) :  Freeing 0x0818D214 (84 bytes), 
script=/home/yohgaki/public_html/bugs/apc/bug.php
Last leak repeated 1 time

**SCRIPT**
[yohgaki@dev apc]$ cat bug.php
<?php
// Note: This script requries mbstring module for mb_convert_kana


//////////////////////// INPUT CONVERSION ///////////////////////////
/**
  * convert encoding - for array_walk in _conv_input()
  *
  */
function __conv_encoding(&$value, $key)
{
         if (is_array($value)) {
                 array_walk($value, '__conv_encoding');
         }
         elseif (is_scalar($value)) {
                 $value = trim(mb_convert_kana($value,'nrK'));
         }
}

/**
  * Convert HTTP inputs to site default charactors.
  *
  * @return void
  * @access private
  */
function _conv_inputs()
{
         if (!empty($_REQUEST)) {
                 reset($_REQUEST);
                 array_walk($_REQUEST,'__conv_encoding');
         }
}

// Start execution
_conv_inputs(); // Convert input char style to site default

?>





_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com