I am running Wampserver version 2.0 on Windows XP SP3 operating system. This version of Wampserver contains of:
- PHP Version 5.2.6
- Apache Version 2.2.8
- MySQL Version 5.0.51b
I don't know whether some of you have known that in PHP Version 5.2.6, the PHP syntax must be started with <?php (and not <? or without php after the question-mark character).
Let's see some example below.
If you use the code like this in PHP Version 5.2.6:
<?
echo "Hello world!";
?>
then the browser will give you a blank page without "Hello world" on it!
So? You have to use code like this in order to display that string:
<?php
echo "Hello world!";
?>
Unfortunately, the first time I've used osTicket (version 1.6 RC4), I found that so many <? syntax in the .php files.
For example: In \include\client\login.inc.php in line 8, you will find the code like this:
<?if($errors) {?>
This code will not work at all in PHP version 5.2.6 or above! :
Again, that code should be written like this in order to work properly:
<?php if($errors) {?>
Not only that, I also found a unique technique to show string by using = (equal mark character).
Let's take a look at \include\client\login.inc.php in line 11:
<p class="warnmessage"><?=$warn?></p>
This code will return an error:
Parse error: syntax error, unexpected '=' in
Even you have changed the code become:
<p class="warnmessage"><?php =$warn?></p>
this code also will not work at all in PHP version 5.2.6 or above!
In this case, you have to change the code become:
<p class="warnmessage"><?php echo $warn?></p>
So...? Guess what...? :
Yes! I have to find and replace <? with <?php, and then also replace =$blablabla with echo $blablabla especially for string-displaying purpose to user. Can you imagine, how long will I take my time to do all of this? :
Wait! This find and replace does not so easy as you think. You have to find and replace one by one carefully, or you will replace the wrong phrase if you find and replace all! For example: you cannot replace all =$blabla with echo $blabla because sometimes you will find the =$blabla is part of $a=$blabla string!
Well, everyone... I just wanted to let you know about this, and also asking to anyone or whoever will continue to develop the next version of this great osTicket, in all modesty, please... please... please... you have to obey the newest PHP coding convention based on some examples that I mention above in order working with the newest PHP version. However, if you use <?php instead of <?, your code still working properly in PHP old version. Because I have tried it.
Again, with my all respect, I am begging of you. Please change <? (without php after question-mark) become: <?php. Also, please change =$blabla become echo $blabla if you want to display or echo the string.
Thank you very much for your kindly attention.
I am still waiting for the next version of this great osTicket.
Two thumbs!
Best regards,
Masino Sinaga