Bug #71287 [NEW]: Error message contains hexadecimal instead of decimal number
| From: | php dot bug dot stream_write at frankkleine dot de | Date: | Tue, 05 Jan 2016 15:43:15 +0000 |
| Subject: | Bug #71287 [NEW]: Error message contains hexadecimal instead of decimal number | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-198429@lists.php.net to get a copy of this message | ||
From: php dot bug dot stream_write at frankkleine dot de
Operating system:
PHP version: 7.0.1
Package: Streams related
Bug Type: Bug
Bug description:Error message contains hexadecimal instead of decimal number
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
--
Edit bug report at https://bugs.php.net/bug.php?id=71287&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71287&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71287&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71287&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=71287&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=71287&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=71287&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=71287&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=71287&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=71287&r=support
Expected behavior: https://bugs.php.net/fix.php?id=71287&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=71287&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=71287&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=71287&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71287&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=71287&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=71287&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=71287&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=71287&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=71287&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=71287&r=mysqlcfg