Opened 14 years ago

Closed 14 years ago

#3418 closed defect (fixed)

[PATCH] imgObj->saveImage(null); sends unnecessary headers

Reported by: adrive Owned by: aboudreault
Priority: normal Milestone:
Component: MapScript-PHP Version: 5.6
Severity: normal Keywords: header saveimage
Cc:

Description

As mentioned in this discussion http://n2.nabble.com/PHP-imgObj-saveImage-null-sends-headers-td4854424.html

imgObj->saveImage(null) sends unnecessary headers.

<?php
error_reporting(E_ALL);
ini_set('display_errors', 'on');
$map = ms_newMapObj('./test.map');
$img = $map->draw();

ob_start();
$img->saveImage(null);
$data = ob_get_clean();

header('Content-type: image/jpeg');
echo $data;

is producing error Warning: Cannot modify header information - headers already sent in /www/test/buffer/mapserver/ob-reproduce.php on line 11

Tested on PHP 5.2.6 and PHP 5.3.2

Attachments (2)

php_mapscript.patch (509 bytes ) - added by adrive 14 years ago.
patch removing php_header call
testcase.tar (10.0 KB ) - added by adrive 14 years ago.

Download all attachments as: .zip

Change History (5)

by adrive, 14 years ago

Attachment: php_mapscript.patch added

patch removing php_header call

by adrive, 14 years ago

Attachment: testcase.tar added

comment:1 by aboudreault, 14 years ago

Resolution: fixed
Status: newclosed

Since the function php_header() behavior depends on many factors, I decided to not call this function ONLY when there is an output buffer active. That way, it'll not change the old behavior of the saveImage() function for those special cases.

Fixed and committed in r10066.

comment:2 by adrive, 14 years ago

Resolution: fixed
Status: closedreopened

Can you merge that changeset also into branch-5.6, please?

comment:3 by aboudreault, 14 years ago

Resolution: fixed
Status: reopenedclosed

Backported in r10204.

Note: See TracTickets for help on using tickets.