php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71287 Error message contains hexadecimal instead of decimal number
Submitted: 2016-01-05 15:43 UTC Modified: -
From: php dot bug dot stream_write at frankkleine dot de Assigned:
Status: Closed Package: Streams related
PHP Version: 7.0.1 OS:
Private report: No CVE-ID: None
 [2016-01-05 15:43 UTC] php dot bug dot stream_write at frankkleine dot de
Description:
------------
When a user defined stream wrapper implements the stream_write($data) method and this returns a number which is lower then the expected amounts of bytes passed as $data an error message is generated which informs about the problem that not all data was written. Starting with PHP 7, one of the integer values (the one returned from the stream wrapper method) in this warning is printed in hexadecimal representation, while the total amount is in decimal representation. In PHP 5 both numbers were in decimal representation.

Test script:
---------------
<?php
class Stream {
    public function stream_open($path, $mode, $options, $opened_path) {

        return true;
    }

    public function stream_write($data) {
        return strlen($data) - 2;
    }
}

stream_wrapper_register('test', Stream::class);
file_put_contents('test://file.txt', 'foobarbaz');
?>


Expected result:
----------------
Warning: file_put_contents(): Only 7 of 9 bytes written, possibly out of free disk space in - on line 14

Actual result:
--------------
Warning: file_put_contents(): Only 0x7l of 9 bytes written, possibly out of free disk space in - on line 14

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-01-06 00:42 UTC] laruence@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=695e8b79aff3108327d0189dba0abf05f58be847
Log: Fixed bug #71287 (Error message contains hexadecimal instead of decimal number)
 [2016-01-06 00:42 UTC] laruence@php.net
-Status: Open +Status: Closed
 [2016-01-06 00:42 UTC] laruence@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=695e8b79aff3108327d0189dba0abf05f58be847
Log: Fixed bug #71287 (Error message contains hexadecimal instead of decimal number)
 [2016-01-13 12:20 UTC] remi@php.net
I can reproduce with 7.0.2, but cannot with 7.0.3-dev.
 [2016-03-31 16:10 UTC] krakjoe@php.net
Automatic comment on behalf of krakjoe
Revision: http://git.php.net/?p=php-src.git;a=commit;h=034e8ec02e263f5908b469bba1285e26c0a67bc4
Log: fix #71287 (substr_replace bug when length type is string)
 [2016-03-31 16:11 UTC] krakjoe@php.net
Automatic comment on behalf of krakjoe
Revision: http://git.php.net/?p=php-src.git;a=commit;h=034e8ec02e263f5908b469bba1285e26c0a67bc4
Log: fix #71287 (substr_replace bug when length type is string)
 [2016-07-20 11:32 UTC] davey@php.net
Automatic comment on behalf of krakjoe
Revision: http://git.php.net/?p=php-src.git;a=commit;h=034e8ec02e263f5908b469bba1285e26c0a67bc4
Log: fix #71287 (substr_replace bug when length type is string)
 [2016-07-20 11:34 UTC] davey@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=695e8b79aff3108327d0189dba0abf05f58be847
Log: Fixed bug #71287 (Error message contains hexadecimal instead of decimal number)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Oct 11 09:01:26 2024 UTC