Bug #71453 [Opn]: sscanf() ignores format text after string placeholder
| From: | dormilich at netscape dot net | Date: | Thu, 28 Jan 2016 15:02:20 +0000 |
| Subject: | Bug #71453 [Opn]: sscanf() ignores format text after string placeholder | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-198949@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=71453&edit=1
ID: 71453
User updated by: dormilich at netscape dot net
Reported by: dormilich at netscape dot net
Summary: sscanf() ignores format text after string
placeholder
Status: Open
Type: Bug
Package: *General Issues
Operating System: Mac OS X (10.11.3)
PHP Version: 5.6.17
Block user comment: N
Private report: N
New Comment:
this bug occurs for every string placeholder, not just the last one.
Previous Comments:
------------------------------------------------------------------------
[2016-01-26 11:14:05] dormilich at netscape dot net
Description:
------------
When the format string contains text after the last placeholder, which must be a string (i.e. %s),
the variable is not only assigned the intended value, but also the text coming after it.
Test script:
---------------
<?php
sscanf('<report>cf2b27b5556c2ddc</report>',
'<report>%s</report>', $hex);
echo $hex;
?>
Expected result:
----------------
cf2b27b5556c2ddc
Actual result:
--------------
cf2b27b5556c2ddc</report>
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=71453&edit=1