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.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | path_redirect.module.785626.patch | 1.34 KB | atheneus |
| #1 | path_redirect_php_version-785626.patch | 246 bytes | atheneus |
Comments
Comment #1
atheneus commentedIt 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.
Comment #2
atheneus commentedComment #3
dave reidTry 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.
Comment #4
atheneus commentedI 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.)
Comment #5
atheneus commentedAlso 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.
Comment #6
dave reidCommitted most of this to CVS.
http://drupal.org/cvs?commit=403406
I left this out because I don't see why its a necessary change?
Powered by Dreditor.
Comment #7
dave reidComment #8
dave reidMarking as fixed due to lack of feedback.