Modx 1.0.7 - php5.3 - magic_quotes_gpc - date.timezone

myit web design graphics

Problems recently with a modx site - maybe this will save you some time when your php version is upgraded and you see the following errors.

new php version - 5.3.20
mysql - client api version - 5.1.68
modx evolution - 1.0.7

I was on the modx forum http://forums.modx.com/ and google but I still couldn't get both of my errors to go at the same time.

All these issues came to the fore recently when a modx evolution 1.0.7 site's php version was upgraded to 5.3.20 and the following errors appeared: 

The date functions timezone had to be set explicitly - the php errors are immediately fixed by calling the following or similar for your country/location:

e.g. date_default_timezone_set(
           'America/Los_Angeles');

before date calls, but by using:

date.timezone = "Europe/Dublin"

in [ROOT]/php.ini, that issue was addressed. So, that removed the 'timezone' error messages.


The other issue was 'magic quotes' or 'extra backslashes' and it was coming from 2 angles.

The modx database couldn't input data if the magic-quotes were OFF, so it was giving errors for that ... and the TINYMCE editor wouldn't work correctly with magic-quotes ON.

The tinymce editor (in the case of selecting an existing image in a chunk using the tinymce editor) would immediately add in backslashes to the <img /> tag giving you:

<img src=\"assets/images/rolio-logo2.jpg\" alt=\"\" width=\"155\" height=\"76\" /> 

and then the tinymce editor wouldn't recognise the location of that image:

\"assets/images/rolio-logo2.jpg\"

so the editor wouldn't allow the user to edit the image, or even select it.

The solution to the above 2 was the following in [ROOT]/php.ini:

magic_quotes_gpc = On
magic_quotes_runtime = Off
magic_quotes_sybase = Off

and as per http://tracker.modx.com/issues/3724 I edited the [ROOT]/manager/index.php line 88-93.

This fixed the tinymce editor issue and the missing backslashes in mysql database calls.

Update: A bug then appeared in chunks with a single quote in them. It appears that the single quotes weren't being entered into mysql and throwing a mysql error - it could take double quotes but not single quotes. This edit below to manager/includes/extenders/dbapi.mysql.class.inc.php fixed it. I tested single and double quotes in templates, chunks, snippets, tinymce etc and all is fine now - http://forums.modx.com/thread/80990/evo-php5-4#dis-post-446178 . The new modx 1.0.9 has lots of new additions and a big focus is a release that will sit perfectly on php 5.4 - http://tracker.modx.com/versions/267