Parse error: parse error, unexpected '&', expecting T_VARIABLE or '$'
kenorb - October 24, 2008 - 12:03
| Project: | Cache browser |
| Version: | 6.x-1.1 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
I've got followed error when I'm going to admin/build/cache_browser:
Parse error: parse error, unexpected '&', expecting T_VARIABLE or '$' in /cache_browser/cache_browser.pages.inc on line 463Probably this reference method is not supported by PHP 4.x
Temporary I've changed:
foreach ($data as $key => &$value) {to:
foreach ($data as $key => $value) {But I don't know which functionality I'll lost.

#1
Line 463 and the same in line 504
#2
Hi,
The problem is I've been using a PHP5 thing here.
Your code above may cause to break the process when browsing an array or object with a lot of nested levels, such as things cached by views.
Could you please try this instead:
foreach ($data as $key => $value) {$value = &$data[$key]; // This & should work on PHP4.
...
This would replace the following in lines 463 and 504.
foreach ($data as $key => &$value) { // <-- This & here requires PHP5....
#3
Nah, it was not so easy...
I just released 6.x-1.2 with a fix for this, and a few more things.
Feel free to reopen if needs to be.
#4