php.net |  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: matt dot peveler at gmail dot com
New email:
PHP Version: OS:

 

 [2020-10-01 14:42 UTC] matt dot peveler at gmail dot com
Description:
------------
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:
---------------
<?php

// 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
imagexbm($im);

// Free up memory
imagedestroy($im);


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

Patches

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-10-01 14:56 UTC] cmb@php.net
-Status: Open +Status: Verified -Type: Bug +Type: Documentation Problem -Assigned To: +Assigned To: cmb
 [2020-10-01 14:56 UTC] cmb@php.net
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,
though.
 [2020-10-01 15:22 UTC] phpdocbot@php.net
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=029ab30c40dc8c94480f3adcf2737771ebf3a8dc
Log: Fix #80168: Warning on using second arg for imagexbm
 [2020-10-01 15:22 UTC] phpdocbot@php.net
-Status: Verified +Status: Closed
 [2020-10-01 18:40 UTC] phpdocbot@php.net
Automatic comment on behalf of mumumu
Revision: http://git.php.net/?p=doc/ja.git;a=commit;h=2ba8d70c597905c99d1b4ddf8bb84763db452c2e
Log: Fix #80168: Warning on using second arg for imagexbm
 [2020-12-30 11:58 UTC] nikic@php.net
Automatic comment on behalf of mumumu
Revision: http://git.php.net/?p=doc/ja.git;a=commit;h=84d6ae9c5bab149b038d72a2b4742c5a06d44a0b
Log: Fix #80168: Warning on using second arg for imagexbm
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Sep 08 01:01:28 2024 UTC