Hi - I am working on a site that I developed on my local environment with no problems. Path Redirect was installed and enabled, but not configured of actively doing anything yet.

When I uploaded the site to the client's staging area I got this message:

Parse error: syntax error, unexpected T_ARRAY, expecting ')' in /kunden/138827_79102/webseiten/sites/all/modules/path_redirect/path_redirect.module on line 508

(actually this is taken from another site that seems to have the same problem).

I disabled the module directly in the system table and the rest of the site seems to work without any further issues. This does seem to be server specific.

My local dev environment is using MAMP Pro with PHP5.

The client server is running PHP 4.4.9. I haven't seen any documentation that Path Redirect is incompatible with PHP4 - this would be my guess as why it isn't working.

Some additional info to help:

Server: Linux n5-slc1-3.myobnet.com 2.6.29-gentoo4fc8-r5 #2 SMP Wed Jul 15 12:08:04 EST 2009 x86_64
PHP configure:
'./configure' '--with-config-file-path=/usr/local/lib/iniphp/slc' '--with-mysql=/usr' '--with-pgsql=/usr/local/pgsql' '--with-curl=/usr/local' '--with-openssl=/usr/local/ssl' '--with-apache=../apache_1.3.41' '--with-gd=/usr/local' '--with-imap=/usr/local/imap-2007a' '--with-imap-ssl' '--with-png' '--with-pdf' '--with-pdflib=/usr/local' '--enable-shared-pdflib' '--with-jpeg-dir=/usr/local/src/jpeg-6b' '--with-dom' '--with-zlib' '--with-zend' '--with-xml' '--enable-xslt' '--with-xslt-sablot' '--enable-gd-native-ttf' '--enable-safe-mode' '--enable-ftp' '--enable-track-vars' '--with-kerberos' '--enable-mbstring=all' '--enable-mbregex' '--with-ttf' '--with-freetype-dir=/usr/local' '--with-mcrypt' '--enable-exif' '--with-zip=/usr/local' '--enable-wddx' '--enable-calendar'

register_globals: On
safe_mode: On

Maybe relevant or not: The server has both IonCube and SourceGuardian PHP extensions loaded.

Comments

atheneus’s picture

Title: Syntax error on Line 508 - PHP4 » Add php version to .info file
StatusFileSize
new246 bytes

It seems that path_redirect is not compatible with PHP < 5.1

On line 507 the function prototype uses the 'array' type hint that is not available to versions of PHP < 5.1

I have attached a patch to add the PHP minimum version to the path_redirect.info file http://drupal.org/node/171205#php

This will help eliminate confusion when someone tries to use this module with an incompatible version of PHP.

atheneus’s picture

Status: Active » Needs review
dave reid’s picture

Status: Needs review » Postponed (maintainer needs more info)

Try the latest 6.x-1.x-dev. If it still needs PHP 5 or 5.1, I'd rather fix the causes rather than up the requirements.

atheneus’s picture

I agree - that would be preferable.

I just tried the latest 6.x-1.x-dev and got a different error on a different line (probably another type hint, but I haven't checked)

Parse error: syntax error, unexpected '=', expecting ')' in sites/all/modules/path_redirect/path_redirect.module on line 387

seems to not like the default empty array assignment to the reference of the query in the prototype of the _path_redirect_build_conditions(&$query = array(), $rids, $conditions) function.

http://php.net/manual/en/functions.arguments.php (Note: As of PHP 5, default values may be passed by reference.)

atheneus’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new1.34 KB

Also got an error at ln. 430. Attached patch has all array type hints removed and a fix for the default assignment on ln. 387.

I removed the array() default adding this line to set a default instead:

$query = ($query) ? $query : array();

I ran SimpleTest on 6.x-1.x-dev unpatched at it failed 12 test with 2 exceptions. I got the same failed tests and exceptions with the patch applied. Didn't seem to create any new fails. I guess there needs to be a little more review. However, all syntax errors on PHP 4.4.9 are eliminated when the patch is applied.

dave reid’s picture

Status: Needs review » Needs work

Committed most of this to CVS.
http://drupal.org/cvs?commit=403406


+++ path_redirect.module.785626	2010-05-05 02:02:38.000000000 +0700
@@ -384,12 +384,14 @@ function path_redirect_load_multiple($ri
@@ -397,7 +399,7 @@ function _path_redirect_build_conditions

@@ -397,7 +399,7 @@ function _path_redirect_build_conditions
 
   if ($rids) {
     $conditions += array('rid' => array());
-    $conditions['rid'] = array_merge($rids, (array) $conditions['rid']);
+    $conditions['rid'] = array_merge($rids, $conditions['rid']);
   }

I left this out because I don't see why its a necessary change?

Powered by Dreditor.

dave reid’s picture

Status: Needs work » Postponed (maintainer needs more info)
dave reid’s picture

Status: Postponed (maintainer needs more info) » Fixed

Marking as fixed due to lack of feedback.

Status: Fixed » Closed (fixed)

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