Doc #80168 [Ver->Csd]: Warning on using second arg for imagexbm

From: Date: Thu, 01 Oct 2020 15:22:11 +0000
Subject: Doc #80168 [Ver->Csd]: Warning on using second arg for imagexbm
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-17951@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80168&edit=1 ID: 80168 Updated by: phpdocbot@php.net Reported by: matt dot peveler at gmail dot com Summary: Warning on using second arg for imagexbm -Status: Verified +Status: Closed Type: Documentation Problem Package: GD related Operating System: Ubuntu 18.04 PHP Version: 7.4.11 Assigned To: cmb Block user comment: N Private report: N New Comment: 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 Previous Comments: ------------------------------------------------------------------------ [2020-10-01 14:56:52] 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 14:42:30] 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 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=80168&edit=1

« previous php.doc.bugs (#17951) next »