Bug #70983 [NEW]: commenting a printf line causes script to fail with "Unexpected end of file"
| From: | php at rossw dot net | Date: | Fri, 27 Nov 2015 06:35:24 +0000 |
| Subject: | Bug #70983 [NEW]: commenting a printf line causes script to fail with "Unexpected end of file" | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-197452@lists.php.net to get a copy of this message | ||
From: php at rossw dot net
Operating system: FreeBSD 10.2
PHP version: 5.6.16
Package: Reproducible crash
Bug Type: Bug
Bug description:commenting a printf line causes script to fail with "Unexpected end of
file"
Description:
------------
A quoted string containing ?> is treated correctly inside an active code
block, but causes errors due to being handled differently if the line is
commented out.
I can see how it could be argued that ?> should not appear, but there
are times you might actually WANT to print it. Simply commenting out the
line should not materially alter the way the (otherwise perfectly
healthy) script runs.
Test script:
---------------
<?php
printf("This is a test\n");
if(1 > 0)
{
// printf("?> Debug code\n");
printf("Got here\n");
}
printf("Finished\n");
?>
Expected result:
----------------
php is seeing the "?> Debug code" as quoted text, and handles it
correctly while the line is not commented. As soon as the line is
commented, php is seeing the quoted ?> as the end of the code and
errors.
--
Edit bug report at https://bugs.php.net/bug.php?id=70983&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70983&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70983&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70983&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=70983&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=70983&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=70983&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=70983&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=70983&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=70983&r=support
Expected behavior: https://bugs.php.net/fix.php?id=70983&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=70983&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=70983&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=70983&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70983&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=70983&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=70983&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=70983&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=70983&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=70983&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=70983&r=mysqlcfg