Bug #10438 Updated: problem with pdf_get_pdi_paramter()
| From: | sniper@php.net | Date: | Mon, 08 Oct 2001 22:48:18 +0000 |
| Subject: | Bug #10438 Updated: problem with pdf_get_pdi_paramter() | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-67576@lists.php.net to get a copy of this message | ||
ID: 10438
Updated by: sniper
Reported By: graeme@inetix.com.au
Old Status: Open
Status: Closed
Bug Type: PDF related
Operating System: Linux x86
PHP Version: 4.0 Latest CVS (15/04/2001)
New Comment:
not a bug in PHP -> closed
Previous Comments:
------------------------------------------------------------------------
[2001-10-08 15:56:33] rjs@php.net
This is a bug in the PDFlib core. It will be fixed with the next maintainace release of PDFlib
(V4.0.2)
------------------------------------------------------------------------
[2001-04-22 04:15:40] graeme@inetix.com.au
Configure line is:
'./configure' '--with-apxs=/usr/local/apache/bin/apxs'
'--enable-track-vars' '--enable-magic-quotes' '--enable-debug'
'--with-mysql=shared,/usr' '--with-dom=shared' '--with-pgsql=shared'
'--with-xml' '--enable-bcmath=shared' '--with-swf=shared,/usr'
'--enable-exif' '--enable-ftp=shared' '--with-gd=shared'
'--with-sablot=shared' '--enable-sablot-errors-descriptive'
'--with-jpeg-dir=/usr' '--with-png-dir=/usr' '--enable-gd-imgstrttf'
'--with-pdflib=shared'
When attempting to call pdf_get_pdi_paramter() with the only key currently implemented,
"filename", Apache dies with the following error:
FATAL: emalloc(): Unable to allocate 1076577297 bytes
Compiling PHP with debugging executed the script correctly with the following errors showing up in
the logs:
pdf.c(264) : Freeing 0x0810F184 (372 bytes), script=/usr/local/apache/htdocs/test/index.php
Last leak repeated 17 times
pdf.c(264) : Freeing 0x08102A94 (372 bytes), script=/usr/local/apache/htdocs/test/index.php
Last leak repeated 17 times
Line 264 is:
static void *pdf_emalloc(PDF *p, size_t size, const char *caller)
{
return(emalloc(size));
}
Sample script (apologies for long lines):
<?
// create first file
$filepdf = pdf_new();
pdf_open_file($filepdf, "firstfile.pdf");
pdf_begin_page($filepdf, 500, 700);
pdf_moveto($filepdf, 125, 175);
pdf_lineto($filepdf, 375, 175);
pdf_lineto($filepdf, 375, 525);
pdf_lineto($filepdf, 125, 525);
pdf_closepath_stroke($filepdf);
pdf_end_page($filepdf);
pdf_close($filepdf);
// end of first file
// open second file
$pdf = pdf_new();
pdf_open_file($pdf);
// open open first file and read values
$pdi = pdf_open_pdi($pdf, "firstfile.pdf", "", 0);
$page= pdf_open_pdi_page($pdf, $pdi, 1, "");
$width = pdf_get_pdi_value($pdf, "width", $pdi, $page, 0);
$height = pdf_get_pdi_value($pdf, "height", $pdi, $page, 0);
$name = pdf_get_pdi_parameter($pdf, "filename", $pdi, $page, 0);
pdf_begin_page($pdf, $width, $height);
// place page from first file into second file
pdf_place_pdi_page($pdf, $page, 0.0, 0.0, 1.0, 1.0);
// now add some text
$font = pdf_findfont($pdf, "Courier", "host", 0);
pdf_setfont($pdf, $font, 10);
pdf_show_xy($pdf, "PDI File: $name", 200, 350);
pdf_close_pdi_page($pdf, $page);
pdf_end_page($pdf);
pdf_close($pdf);
$data = pdf_get_buffer($pdf);
header("Content-type: application/pdf");
header("Content-disposition: inline; filename=test.pdf");
header("Content-length: " . strlen($data));
echo $data;
?>
Comment out call to pdf_get_pdi_parameter() to compare
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=10438&edit=1