PHP 4 Parse error: syntax error

jpereza - April 2, 2008 - 20:59
Project:Content Templates (Contemplate)
Version:5.x-2.0
Component:Code
Category:bug report
Priority:critical
Assigned:jrglasgow
Status:closed
Description

I've just installed the ConTemplate module (v5.x-2.0) in my site and after enabling the module, I just got a blank page. All of my site have got blank pages.

Looking at the apache error log I see this error:

PHP Parse error: syntax error, unexpected '=', expecting ')' in C:\\web\\enelsur.es\\sites\\all\\modules\\contemplate\\contemplate.module on line 743

Looking at that line, it looks like this:

function contemplate_eval($tmplt, $obj, &$xml_elements = null) {

And if I remove "= null" then, the error disappears and my site come to life again.

My installation:

  • PHP 4.4.7
  • Web Server Apache/2.2.6 (Win32)

If more info is needed, just ask for it.

#1

jrglasgow - April 2, 2008 - 22:04
Assigned to:Anonymous» jrglasgow
Status:active» active (needs more info)

I am developing with PHP 5 so this is probably something with PHP 4

if you change line 743 to read

function contemplate_eval($tmplt, $obj, &$xml_elements = array()) {

do you still have this same error

#2

jpereza - April 3, 2008 - 07:30

Thanks for your quick answer, jrglasgow.
I cannot check it right now, I will do when I get back to home this afternoon.

But I think it won't work because the error said unexpected '=', so I suppose that in PHP 4 you cannot initialize a parameter that have this syntax &$xml_elements.

#3

jpereza - April 3, 2008 - 08:03
Title:PHP Parse error: syntax error» PHP 4 Parse error: syntax error

My supposition was true.

I've read in the PHP Manual this:

Note: As of PHP 5, default values may be passed by reference.

So, in PHP 4 it cannot be assigned a default value to a parameter passed by reference, as it is trying to do.

#4

jrglasgow - April 3, 2008 - 13:48
Status:active (needs more info)» fixed

I have committed a fix for this, it is in the next release, 5.x-2.01

#5

Anonymous (not verified) - April 17, 2008 - 13:52
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.