PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Caching » Cache » Bug #3693

Missing $this

Details

Submitted2005-03-03 19:56 UTC
Fromcmoehrke at netviser dot de
StatusBogus
PackageCache
PHP Version5.0.3
OSLinux
Roadmaps(Not assigned)

Comments

[2005-03-03 19:56 UTC] cmoehrke at netviser dot de

Description:
------------
Calling cacheImageLink() results in a fatal error when image is already cached.

Reproduce code:
---------------
<?php
require_once('Cache/Graphics.php');

$text='Hallo Welt';
$width=100;
$height=50;

$img = imagecreate($width, $height);

$cache = new Cache_Graphics();
$cache->setCacheDir('cache');

$id = $cache->generateID($text.$width.$height.__FILE__,'png');

if (!($link=$cache->getImageLink($id,'png')))
{
if (false == $img)
{
die ("Konnte Bild nicht anlegen");
}
$bg_color = imagecolorallocate($img, 255, 255, 255);
$txt_color = imagecolorallocate($img, 200, 20, 20);
imagestring($img, 3, 5, 5, $text, $txt_color);
$link = $cache->cacheImageLink($id,&$img,'gif');
}

echo "<a href='$link[0]' />";
?>

Actual result:
--------------
Notice: unserialize() [function.unserialize]: Error at offset 0 of 3 bytes in /usr/local/php/pear/Cache/Container.php on line 406

Fatal error: Call to undefined function isExpired() in /usr/local/php/pear/Cache/Graphics.php on line 294

[2005-03-03 20:04 UTC] cmoehrke at netviser dot de

Sorry, my fault...