PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Caching » Cache_Lite » Bug #8361

Cache_lite bug with MBSTRING

Details

Submitted2006-08-04 13:37 UTC
Fromvincent dot dupont at ausy dot be
Assignedfab
StatusNo Feedback
PackageCache_Lite
PHP Version4.3.11
OSwin XP
Roadmaps(Not assigned)

Comments

[2006-08-04 13:37 UTC] vincent dot dupont at ausy dot be

Description:
------------
Hi,

Cache_Lite will not work correctly when MBSTRING is activated . The error seem random; but I think it occurs on the validation codes generated by cache_lite.

The source of the bug seem to be mbsting extension because it stopped to bug when i removed this extension. This is normal as far as mbstring will (could) change the content of the files writtent by cache_lite.

Actual result:
--------------
the save() and get() function return false.
on the Save(), The error is generated dureing the integrity check _writeAndControl()

[2006-09-14 17:36 UTC] fab at php dot net

I will try to investigate

[2006-11-07 13:14 UTC] a dot vi at laposte dot net

Hi,

same problem when I activate "mbstring.func_overload = 7" in the PHP.ini. My server runs with Linux Ubuntu. I can save properly the cache but I can't read it again.

Is there any hotfix?

Regards

Axel

[2006-11-07 13:47 UTC] a dot vi at laposte dot net

Following my previous post. I patched the code to make it work with mbstring. This code extract comes from the _write function:

$fp = @fopen($this->_file, "wb");
if ($fp) {

/* PATCH BY AQUEL */
$mqr = get_magic_quotes_runtime(); # We save the magic quotes status
set_magic_quotes_runtime(0); # We disable the magic quotes
/* END PATCH */

if ($this->_fileLocking) @flock($fp, LOCK_EX);
if ($this->_readControl) {
@fwrite($fp, $this->_hash($data, $this->_readControlType), 32);
}

/* PATCH BY AXEL */
/* $len = strlen($data); */
/* @fwrite($fp, $data, $len); */
@fwrite($fp, $data);
set_magic_quotes_runtime($mqr); # We set the magic quotes status back to default
/* END PATCH */

if ($this->_fileLocking) @flock($fp, LOCK_UN);
@fclose($fp);
return true;
}

It seems to be working now.
Regards

[2007-01-08 21:46 UTC] fab at php dot net

I just commited the proposed patch (thanks) to CVS, it's ok for you now ?