Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:53541 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 83381 invoked from network); 23 Jun 2011 18:16:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Jun 2011 18:16:18 -0000 Authentication-Results: pb1.pair.com smtp.mail=j.boggiano@seld.be; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=j.boggiano@seld.be; sender-id=pass Received-SPF: pass (pb1.pair.com: domain seld.be designates 74.125.82.54 as permitted sender) X-PHP-List-Original-Sender: j.boggiano@seld.be X-Host-Fingerprint: 74.125.82.54 mail-ww0-f54.google.com Received: from [74.125.82.54] ([74.125.82.54:49264] helo=mail-ww0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 93/31-09437-FE2830E4 for ; Thu, 23 Jun 2011 14:16:17 -0400 Received: by wwf4 with SMTP id 4so2049099wwf.11 for ; Thu, 23 Jun 2011 11:16:13 -0700 (PDT) Received: by 10.227.205.67 with SMTP id fp3mr2227674wbb.53.1308852972907; Thu, 23 Jun 2011 11:16:12 -0700 (PDT) Received: from [192.168.1.85] (40-34.60-188.cust.bluewin.ch [188.60.34.40]) by mx.google.com with ESMTPS id gb6sm1421281wbb.17.2011.06.23.11.16.11 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 23 Jun 2011 11:16:12 -0700 (PDT) Message-ID: <4E0382EC.10309@seld.be> Date: Thu, 23 Jun 2011 20:16:12 +0200 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.12) Gecko/20101027 Lightning/1.0b2 Thunderbird/3.1.6 MIME-Version: 1.0 To: internals@lists.php.net References: <887FE7CFF6F8DE4BB3A9535F53AFD06A492D09D2@il-ex2.zend.net> <4DD2A731.9000400@sugarcrm.com> In-Reply-To: X-Enigmail-Version: 1.1.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Re: [RFC] Improved parser error message From: j.boggiano@seld.be (Jordi Boggiano) Thanks for the great work. More should be done on the front of helping newcomers solve trivial issues imo. On 23.06.2011 20:08, Felipe Pena wrote: > $ sapi/cli/php -r 'class ' > Current: > Parse error: syntax error, unexpected $end, expecting T_STRING > > Patched: > Parse error: syntax error, unexpected end of file, expecting > 'identifier' (T_STRING) identifier should not be quoted. The quotes are fine for "expecting '{'" and "unexpected 'foo'" because those are text literals, but this implies you were supposed to actually type "class identifier", which is obviously not the intended message. > $ sapi/cli/php -r 'class abc foo' > Current: > Parse error: syntax error, unexpected T_STRING, expecting '{' in > Command line code on line 1 > > Patched: > Parse error: syntax error, unexpected 'foo' (T_STRING), expecting '{' > in Command line code on line 1 > > > As can be noticed, I added the actual scanned string in the > "unexpected" part. This might be useful for finding really which makes > the parser error. (It was a bit tricky though :D) Good stuff, maybe "unexpected string 'foo' (T_STRING)" or "unexpected string (T_STRING) 'foo'" would be more clear, but no big deal really. Cheers -- Jordi Boggiano @seldaek - http://nelm.io/jordi