php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #53446 Missing } error message
Submitted: 2010-12-02 05:52 UTC Modified: 2010-12-02 11:45 UTC
From: lynch@php.net Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.3.3 OS: N/A
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: lynch@php.net
New email:
PHP Version: OS:

 

 [2010-12-02 05:52 UTC] lynch@php.net
Description:
------------
Parse error: syntax error, unexpected $end

99 times out of a hundred this means they are missing a closing }

How tricky would it be to make this message say what TOKEN is expected next, or something along the lines of "look for a missing '}', ')' or quote" or whatever gets the parser into this state?...

Every newbie gets bit by this.  Some of us got bit a lot. :-)



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-12-02 06:04 UTC] aharvey@php.net
-Package: Documentation problem +Package: Scripting Engine problem
 [2010-12-02 06:04 UTC] aharvey@php.net
I suspect this would need Lemon, but I'll let the people who know about
such things weigh in.
 [2010-12-02 11:45 UTC] johannes@php.net
-Status: Open +Status: Bogus
 [2010-12-02 11:45 UTC] johannes@php.net
Thee are quite a few options. Given

class Foo {
    public function bar() {}

the next thing might be a "}" or "public" or "var" or "const" or a comment or ... the parser can't know. The parser can only tell you what is not allowed. There's a project for a new parser which tries to improve error messages.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 22 17:00:02 2025 UTC