Bug #76439 [Com]: Changed behaviour in unclosed HereDoc

From: Date: Sat, 09 Jun 2018 22:47:05 +0000
Subject: Bug #76439 [Com]: Changed behaviour in unclosed HereDoc
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-215572@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=76439&edit=1 ID: 76439 Comment by: danack@php.net Reported by: love at sickpeople dot se Summary: Changed behaviour in unclosed HereDoc Status: Open Type: Bug Package: Scripting Engine problem PHP Version: 7.3.0alpha1 Block user comment: N Private report: N New Comment: tl:dr - the error message for unclosed heredoc makes no sense for PHP 7.3alpaha To: Parse error: Invalid body indentation level (expecting an indentation level of at least 1) in /in/VQqm7 on line 10 From Parse error: syntax error, unexpected end of file in /in/VQqm7 on line 12 Previous Comments: ------------------------------------------------------------------------ [2018-06-09 22:45:55] danack@php.net Running you exact code gives me the error "Parse error: syntax error, unexpected end of file in /in/VQqm7 on line 12" - https://3v4l.org/VQqm7 That's because there are spaces before the "BAR;" in your script, and the parser gets to the end of the file unexpectedly. Removing those spaces makes the script work - https://3v4l.org/19bhe However I'm going to leave this open as the error has changed for PHP7.3alpha, and it makes no sense. ------------------------------------------------------------------------ [2018-06-09 22:24:09] love at sickpeople dot se Description: ------------ "$foo" in heredoc works, while "$foo." triggers a ParseError. For clarity with newlines etc, the script below encoded: PD9waHAKCiRmb28gPSAnZm9vJzsKCmVjaG8gPDw8QkFSCiAkZm9vCiBCQVI7CgplY2hvIDw8PEJBUgogJGZvby4KIEJBUjsKCg== Test script: --------------- $foo = 'foo'; echo <<<BAR $foo BAR; echo <<<BAR $foo. BAR; Expected result: ---------------- No ParseError. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=76439&edit=1

« previous php.bugs (#215572) next »