|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #80168 Warning on using second arg for imagexbm
Submitted: 2020-10-01 14:42 UTC Modified: 2020-10-01 14:56 UTC
From: matt dot peveler at gmail dot com Assigned: cmb (profile)
Status: Closed Package: GD related
PHP Version: 7.4.11 OS: Ubuntu 18.04
Private report: No CVE-ID: None
 [2020-10-01 14:42 UTC] matt dot peveler at gmail dot com
The documentation says that the second argument to imagexbm (like the other functions) is optional, and that if not included, the output will be sent to stdout instead of to a file. However, on running the test script, I get a PHP Warning about the second argument missing and nothing is outputted to stdout. Changing the used function to imagegif (or any other variant) works as expected.

Test script:

// Create a blank image and add some text
$im = imagecreatetruecolor(120, 20);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5,  'A Simple Text String', $text_color);

// Output the image

// Free up memory

Expected result:
Output the imagexbm binary to stdout

Actual result:
PHP Warning:  imagexbm() expects at least 2 parameters, 1 given in /tmp/test.php on line 9


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-10-01 14:56 UTC]
-Status: Open +Status: Verified -Type: Bug +Type: Documentation Problem -Assigned To: +Assigned To: cmb
 [2020-10-01 14:56 UTC]
The docs are wrong about this.  The second parameter is not
optional, but it is nullable; so you could do

    imagexbm($im, null);

As of PHP 8.0.0, the second parameter is actually optional,
 [2020-10-01 15:22 UTC]
Automatic comment on behalf of cmb
Log: Fix #80168: Warning on using second arg for imagexbm
 [2020-10-01 15:22 UTC]
-Status: Verified +Status: Closed
 [2020-10-01 18:40 UTC]
Automatic comment on behalf of mumumu
Log: Fix #80168: Warning on using second arg for imagexbm
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Mon Nov 23 20:01:23 2020 UTC