Doc->Bug #73420 [Opn->Ver]: unsemicoloned expressions vs statements

From: Date: Sun, 15 Mar 2020 22:32:36 +0000
Subject: Doc->Bug #73420 [Opn->Ver]: unsemicoloned expressions vs statements
References: 1  Groups: php.standards 
Request: Send a blank email to [email protected] to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73420&edit=1

 ID:                 73420
 Updated by:         [email protected]
 Reported by:        ewan dot delanoy at gmx dot fr
 Summary:            unsemicoloned expressions vs statements
-Status:             Open
+Status:             Verified
-Type:               Documentation Problem
+Type:               Bug
 Package:            PHP Language Specification
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

> […] it seems to be an expression-statement.

Well, looks more like an echo-statement, but that's not really the
point anyway.  The relevant omission from the language
specification is that a semicolon is automatically inserted before
an PHP end tag[1].  To let that be valid syntax, an
empty-statement would also have to be defined (and is needed
anyway).

[1] <https://github.com/php/php-src/blob/php-7.4.3/Zend/zend_language_scanner.l#L2216>


Previous Comments:
------------------------------------------------------------------------
[2016-10-30 13:31:42] ewan dot delanoy at gmx dot fr

Description:
------------
    Consider the following (valid) one-line php code :

<input type="<?php echo 'text' ?>"/>

   According to https://github.com/php/php-langspec/blob/master/spec/04-basic-concepts.md,
in the code above echo 'text' must be a statement-list.
  
   According to https://github.com/php/php-langspec/blob/master/spec/11-statements.md,
this statement-list must in fact consist of a single statement.

  But what type of statement is it ? If we look at the enumeration at https://github.com/php/php-langspec/blob/master/spec/11-statements.md#general,
it seems to be an expression-statement. But https://github.com/php/php-langspec/blob/master/spec/11-statements.md#expression-statements
says that expression-statements always end with a semicolon.


   

Test script:
---------------
<input type="<?php echo 'text' ?>"/>



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=73420&edit=1


Thread (1 message)

« previous php.standards (#1502) next »