Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.6.0a3

Bug #16191 fprintf parameters lost
Submitted: 2009-05-06 23:01 UTC
From: eridal Assigned: arpad
Status: Closed Package: PHP_Compat (version 1.6.0a2)
PHP Version: 4.3.10 OS: Linux
Roadmaps: 1.6.0a3    

 [2009-05-06 23:01 UTC] eridal (Martin Scotta)
Description: ------------ the function php_compat_fprintf complains that no parameters has been passed FIX: function fprintf() { $args = func_get_args(); return call_user_func_array('php_compat_fprintf',$args); } Test script: --------------- if ( function_exists('fprintf')) exit('Can\'t test here'); require 'Compat.php'; fprintf(STDOUT, "%s\n", 'Just a test'); Actual result: -------------- Wrong parameter count for fprintf() en c:\archivos de programa\easyphp\www\mfwdiet\mfwdiet\core\PHP_Compat\PHP\Compat\Function\fprintf.php en la linea 23


 [2009-05-07 00:08 UTC] hm2k (James Wade)
-Status: Open +Status: Feedback
Right you are, although the script would be quicker if it didn't call the suggested functions. Instead it should pass the variables. IE: if (!function_exists('fprintf')) { function fprintf($handle, $format, $args=false) { return php_compat_fprintf($handle, $format, $args); } } Please test and let me know it works as expected for you. Meanwhile I'll commit it to the CVS.
 [2009-05-07 00:16 UTC] eridal (Martin Scotta)
int fprintf ( resource $handle , string $format [, mixed $args [, mixed $... ]] ) fprintf supports multiple parameters fprintf($file, "%s%s%s\n", 'Hello', 'World', '!'); So, i MUST pass all the parameters to the PHP_compat function.
 [2009-05-07 01:03 UTC] arpad (Arpad Ray)
-Status: Feedback +Status: Closed -Assigned To: +Assigned To: arpad
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on by the end of next Sunday (CET). If this was a problem with the website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.