PHP heredoc generation error

This creates an OK output page.

$mystring = "<<<EOT";

Replacing it with the following expression,

Parse error: syntax error, unexpected $ end in .php file on line 737

$mystring = <<<EOT
   This is some PHP text.
   It is completely free
   I can use "double quotes"
   and 'single quotes',
   plus $variables too, which will
   be properly converted to their values,
   you can even type EOT, as long as it
   is not alone on a line, like this:
EOT;

Any ideas on what makes the parser suffocate?

I am using PHP 4.4.7.

Only in one file does this behavior occur; all others follow certain PHP functions.

What I'm trying to repeat is what might be wrong in the procedural lines so that the PHP parser is shown in this crash.

John

changed the contents of the file to: -

<?php

$mystring = <<<WHATEVER
   This is some PHP text.
WHATEVER;
?>

result =

Parse error: syntax error, unexpected $ end in .php file on line 5

Any hints

EDIT

T_ENCAPSED_AND_WHITESPACE, jQuery, , "if(x == y){$('#my_image').hide():}" heredoc the bigram "{$ , php .

2 .

1) Ch4m3l3on - "<?php" "<?".

2) Disintegrator - <q> , , utf-8 ( ) </q>.

1) .

2) ( ), , .

+3
7

heredoc . IDE , ! heredoc , php- (

+9

, "WHATEVER" . . , <enter> .

+7

, EOT; .

if ($muh="kuh") {
     $foo = <<<EOT
           some text text text
EOT;
}
+4

, :

$mystring = <<<'EOT'
...
EOT;

( EOT)

+2

/ , . (PHP 5.2.8 (cli) (: 6 2009 12:33:08))

, , , - , -, .

, PHP .

0

You should probably check if you have a closed brace (or a bracket, I don’t remember).

For example:

<?php

while(true) {
    echo "Something\n";

?>

Call this error.

0
source

I don't have a reputation for uptic, but Ch4m3l3on and Pedro Cunhna are right ... a wrong heredoc probably won't cause this unexpected $ end error, but an open brace will definitely be.

0
source

Source: https://habr.com/ru/post/1714978/


All Articles