php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77101 Wrong error message on unexpected token
Submitted: 2018-11-03 17:46 UTC Modified: 2018-11-03 20:16 UTC
From: teo8976 at gmail dot com Assigned:
Status: Open Package: Scripting Engine problem
PHP Version: 7.3.0RC4 OS: all
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
31 - 14 = ?
Subscribe to this entry?

 
 [2018-11-03 17:46 UTC] teo8976 at gmail dot com
Description:
------------
When a syntax error occurred where an unexpected kind of token is found, if the error message says "Unexpected X, expecting Y", then Y **MUST** be a completely exhaustive list of valid expected kinds of tokens. If there are too many, then just say "Unexpected X", but do not tell me "expecting Y" if Y is not the only valid option.

See example

Test script:
---------------
<?php

$a = ['foo'=>'bar'];

unset($a['foo'];

Expected result:
----------------
Either this:

>  syntax error, unexpected ';', expecting '::' (T_PAAMAYIM_NEKUDOTAYIM) or ')' or [... add any other valid options]

or this:

> syntax error, unexpected ':', expecting '::' (T_PAAMAYIM_NEKUDOTAYIM) or possibly something else.


Actual result:
--------------
syntax error, unexpected ';', expecting :: (T_PAAMAYIM_NEKUDOTAYIM)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-11-03 20:16 UTC] petk@php.net
-Package: *Compile Issues +Package: Scripting Engine problem
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sat Jan 18 05:01:22 2020 UTC