From:             [EMAIL PROTECTED]
Operating system: Linux x86
PHP version:      4.0 Latest CVS (15/04/2001)
PHP Bug Type:     PDF related
Bug description:  problem with pdf_get_pdi_paramter()

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 Bug report at: http://bugs.php.net/?id=10438&edit=1



-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to