php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66279 parse error problem starting with 5.5.0
Submitted: 2013-12-12 19:43 UTC Modified: 2013-12-12 19:52 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: felixl at densi dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.5.7 OS: x86 Windows and linux
Private report: No CVE-ID: None
 [2013-12-12 19:43 UTC] felixl at densi dot com
Description:
------------
Problem does not exist in 5.4.9 (windows tested)
Problem exist in 5.5.0 (windows tested)
Problem exist in 5.5.6 & 5.5.7 (ubuntu linux x86 tested)

@see link with code
The code is part of my symfony project (using propel db)
code is generated with propel model generator
(php app/console propel:model:build)
using latest propel 1.x
But symfony and propel are not the problem here.

Valid php should not give a parse error.

to test
- rename file to .php
php <path-to-file>


Test script:
---------------
http://www.densi.com/phpError/BaseCrossRefStockCode.php.txt


Expected result:
----------------
Result on php 5.4.9 and below :

Fatal error: Class 'BaseObject' not found in <path-to-file> on line 37

Actual result:
--------------
result on php >= 5.5.0:

Parse error: syntax error, unexpected 'YIELD' (T_YIELD) in <path-to-file> on line 889

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-12-12 19:45 UTC] felixl at densi dot com
tested on windows 7 x64 (fully patch)
tested on ubuntu 13.10 x86
 [2013-12-12 19:52 UTC] requinix@php.net
-Status: Open +Status: Not a bug
 [2013-12-12 19:52 UTC] requinix@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

--

  $this->modifiedColumns[] = CrossRefStockCodePeer::YIELD;

"yield" is a keyword as of PHP 5.5 [http://www.php.net/manual/en/language.generators.overview.php]. If you want to use PHP 5.5+ then you need to edit your code to not use that as a name.
 [2013-12-12 19:52 UTC] requinix@php.net
Ah, the link includes the ]. Oops.

http://www.php.net/manual/en/language.generators.overview.php
 [2013-12-12 20:08 UTC] felixl at densi dot com
so a class variable can be called $yield, but a class constant cannot ?

for all propel 1.x user, the problem is here:

https://github.com/propelorm/Propel/blob/master/generator/lib/builder/om/ClassTools.php

in getPhpReservedWords()
must add the word 'yield' to the list.
 [2013-12-12 20:11 UTC] felixl at densi dot com
https://github.com/propelorm/Propel/issues/803
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 03 19:01:32 2024 UTC