Page 1 of 1

[SOLVED] Module translation file makes it impossible to login in.

Posted: Mon Feb 04, 2008 8:41 pm
by alinome.net
I have been searching in the forum for a similar problem, but I found nothing. Then I've been browsing the boards looking for the right one to post this report. I think this one is the best option. I suspect the problem I've had is a CMSMS bug and has nothing to do with the module itself. Sure you can tell me if I'm right or not.

I'm using CMS Made Simple 1.2.3. Today I was trying the little module Sendeplan, that I downloaded in tgz format. The installation was easy and all seemed right, apart from some typos in the provided template and translations. As the module provides only English and German versions, I decided to write the Spanish translation. But after uploading the file es_ES.php to my server things went wrong: all module options disappeared from the menus, and when I tried to login in again the whole admin panel was not accessible: a blank page (no HTML received!) was all I got.

At first I thought the reason was file permissions in the server, because I had chmod'ed the modules directory to 777 before uploading and installing the module. After several chmod's and tests I realized file permissions had nothing to do with the problem. The last chance to get a clue was to take a look at the server error log. I downloaded the 500 MB error log file from the control panel of my hosting. It was easy to find out the problem. There were many errors like this one (with different referer pages):

PHP Parse error:  syntax error, unexpected T_ARRAY in /var/www/vhosts/MY_DOMAIN/httpdocs/MY_CMSMS_SITE/modules/Sendeplan/lang/ext/es_ES.php on line 75, referer: http://MY_DOMAIN/MY_CMSMS_SITE/admin/login.php

Line 75 was the last line of the file es_ES.php, the line with the final "?>", so it was clear that something was wrong with the PHP syntax.

But nothing seemed wrong: no misplaced quote, no missing semicolon... After isolating parts of the code with block comments, and uploading the file to see the effect, I find out the problem: there was one line longer than 255 characters in the multi line content of the item $lang['help']:

Code: Select all

$lang['help'] = '
<h3>Bla bla bla</h3>
<p>
bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla
blabla bla bla bla blalabla bla bla <<< more than 255 chars in this line>>> bla bla blabla bla bla bla bla bla
bla bla bla bla bla bla
</p>';
After breaking that line in two, everything was right again.

Does CMSMS something to do with that or is it a PHP problem or limitation while assigning multiline strings?

Anyway, It's quite frustating that a such a silly mistake can make it impossible to login in, without a single warning. A bug or not a bug, I hope this report will be useful to people trapped in the same situation.

(By the way, the translation is ready. I will propose it to the module author, with a corrected version of the English one too.)

Cheers

Marcos

Re: [SOLVED] Module translation file makes it impossible to login in.

Posted: Mon Feb 04, 2008 8:51 pm
by calguy1000
Thank you very much.... for your excellent debugging skills.  I hope more people read this post and notice what you should do to diagnose a problem.  You experienced the problem, tried a few things,then went right into 'debugging'....  first checking your error log, finding the suspected problem file, and then using elimination techniques to find the problem.  Most of the people here need to learn to do things like this before posting.... Again, thank you.

Messages like 'this doesn't work' or 'my admin stylesheet is simplistic' are just descriptions of 'symptoms'.... not causes to the problem.

Anyways, I digress...

I think this is more a PHP thing than a CMS thing (that would depend on your php version, etc) because if you dug far enough into the code, the lang stuff is just 'included'... there's no explicit file opening, reading and closing stuff happenning.