PHP4 compatability: Parse error: syntax error, unexpected '&'
marinesct - September 25, 2008 - 03:11
| Project: | KML module |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
Received the following error on install:
Parse error: syntax error, unexpected '&', expecting T_VARIABLE or '$' in ../modules/kml/kml.module on line 700
Line 700 of kml.module is:
foreach ($nodes_array as &$node) {The correct code should be:
foreach ($nodes_array as $node) {I deleted the & and the module successfully installed.

#1
Thanks for the report. Can I just ask what version of PHP you use? This seems to work fine for me, and I think it's valid (see e.g.).
#2
Looks like it's invalid in PHP4: #260016: PHP 4 Parse error: syntax error, unexpected '&'. We should see if there's another way of doing it, but, ideally, is there any way you can upgrade to PHP5?
#3
Thats a big negatory. I setup the htaccess file with
AddType x-mapp-php5 .phpand my whole site goes kaput. Probably cause I'm using 1and1's hosting package. Unless of course I mistyped the above line.#4
Ok, if the code is working for you without the & (passing updates back to the original variable) then stick with that for now. The idea is that the changes being made in that foreach statement would be stored for later use, but currently I don't think they're used later on.