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 » Images » Image_GraphViz » Bug #109

image() calls header() for non-binary imagemap-data

Details

Submitted2003-10-16 12:49 UTC
Fromwinkelmann at someon dot com
Assignedsebastian
StatusClosed
PackageImage_GraphViz
PHP Version4.3.3
OSLinux
Roadmaps(Not assigned)

Comments

[2003-10-16 12:49 UTC] winkelmann at someon dot com

Description:
------------
The image-method tries to set the contentlenght-header independent of file format. This results in a warning when Graphviz is used to generate a Imagemap inside a html page.

Solution: Add a format check around the header(); in line 121

Reproduce code:
---------------
$map = new Graphviz;

$map->AddNode(...);

echo '<map name="dependencies">';
$map->Image('cmap');
echo '</map>';

[2004-02-20 08:39 UTC] sebastian at php dot net

This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pear.php.net.

In case this was a pear.php.net website problem, the change will show
up on the website in short time.

Thank you for the report, and for helping us make PEAR better.

[2004-02-22 10:41 UTC] winkelmann at someon dot com

This Bug has not been fixed.
In version 1.20 (Feb.20), this bug is still open.

[2004-02-22 11:18 UTC] sebastian at php dot net

Sorry for closing this bug before, I misread your report.

Does the patch below solve the problem for you?

Index: GraphViz.php
===================================================================
RCS file: /repository/pear/Image_GraphViz/GraphViz.php,v
retrieving revision 1.20
diff -u -r1.20 GraphViz.php
--- GraphViz.php 20 Feb 2004 08:47:25 -0000 1.20
+++ GraphViz.php 22 Feb 2004 11:23:58 -0000
@@ -106,6 +106,8 @@
@`$command`;
@unlink($file);

+ $sendContentLengthHeader = true;
+
switch ($format) {
case 'gif':
case 'png':
@@ -128,9 +130,15 @@
header('Content-Type: image/svg+xml');
}
break;
+
+ default: {
+ $sendContentLengthHeader = false;
+ }
}

- header('Content-Length: ' . filesize($outputfile));
+ if ($sendContentLengthHeader) {
+ header('Content-Length: ' . filesize($outputfile));
+ }

$fp = fopen($outputfile, 'rb');

[2004-02-25 10:27 UTC] sebastian at php dot net

This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pear.php.net.

In case this was a pear.php.net website problem, the change will show
up on the website in short time.

Thank you for the report, and for helping us make PEAR better.