php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30041 pdf_open_file() expects exactly 2 parameters, 1 given
Submitted: 2004-09-09 21:00 UTC Modified: 2004-10-01 20:56 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: pdowson at aea9 dot k12 dot ia dot us Assigned:
Status: Not a bug Package: PDF related
PHP Version: 4.3.8 OS: FreeBSD 5.2
Private report: No CVE-ID: None
 [2004-09-09 21:00 UTC] pdowson at aea9 dot k12 dot ia dot us
Description:
------------
The PHP manual describes pdf_open_file as working with just one argument (the pdf handle). The code works fine if you supply a filename as the second argument.

Reproduce code:
---------------
$pdf = pdf_new();
pdf_open_file($pdf);

Expected result:
----------------
It should work without an error. Should create a PDF document in memory, not in a file.

Actual result:
--------------
Warning: pdf_open_file() expects exactly 2 parameters, 1 given in /home/wwwpath/pdf.php on line 2

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-09-15 10:50 UTC] sniper@php.net
Are you REALLY using PHP 4.3.8 ?
As in PHP _5_ the 2nd parameter IS required.
This works fine for me with PHP 4.3.8 with just one parameter.
 [2004-09-15 18:33 UTC] pdowson at aea9 dot k12 dot ia dot us
I am so sure I could spit.

#shell$ php -v
PHP 4.3.8 (cli) (built: Jul 23 2004 18:01:43)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
 [2004-09-16 10:30 UTC] sniper@php.net
Try this script and paste the output here:

<?php

error_reporting(E_ALL);

$pdf = pdf_new();
pdf_open_file($pdf);

echo "\n", phpversion(), "\n";

?>

 [2004-09-17 06:34 UTC] pdowson at aea9 dot k12 dot ia dot us
#shell$ php -e pdf.php
<font color=ff0000>
Warning: pdf_open_file() expects exactly 2 parameters, 1 given in /home/pdf.php on line 7
</font>
4.3.8

#shell$ php -l pdf.php
No syntax errors detected in pdf.php
 [2004-09-23 21:47 UTC] iliaa@php.net
Are you using native PHP pdf extension or are you using the one provided by the libpdf developers?
 [2004-09-24 16:01 UTC] pdowson at aea9 dot k12 dot ia dot us
How do I check which pdf extension I am using?
 [2004-10-01 09:50 UTC] sniper@php.net
How did you compile PHP? You really need some pdf library, you should know what you have installed in your machine, shouldn't you? :)

Try running the test script I gave like this:

# php -n pdf.php

And you can check what pdf extension version you have with this:

# php -i | grep PDF


 [2004-10-01 19:01 UTC] pdowson at aea9 dot k12 dot ia dot us
# php -n pdf.php
Fatal error: Call to undefined function:  pdf_new() in /root/pdf.php on line 6


# php -i | grep PDF
PDF Support => enabled
PDFlib GmbH Version => 6.0.0p1
 [2004-10-01 19:03 UTC] pdowson at aea9 dot k12 dot ia dot us
I forgot to mention about the installation of PHP. PHP was installed using the FreeBSD ports collection
 [2004-10-01 20:56 UTC] sniper@php.net
We don't support that port. If you experience this error when you compile PHP yourself, reopen.

 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sun May 26 09:01:25 2019 UTC