View Issue Details

IDProjectCategoryView StatusLast Update
0001175phpList 3 applicationGeneralpublic19-10-04 11:02
ReporterBruce Morrison 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version 
Target VersionFixed in Version 
Summary0001175: Use of short tags
DescriptionI noticed that the code uses short tags (<? instead of <?php ) to indicate php code. This the code should be changed to use long tags as the short tags can conflict with XML.
Additional InformationAlso see forum posting http://www.phplist.com/forums/viewtopic.php?t=677
TagsNo tags attached.

Relationships

related to 0006419 resolveduser1822 Short tags are not supported on everywhere 
related to 0006682 resolved PHP Short Tags 
related to 0015179 resolvedmichiel PHP Short Tags 

Activities

michiel

23-04-04 12:38

manager   ~0001242

That's more a feature request than a bug, but in effect you're right. Issue is how easy it is to go through all the code and replace them all.

Bruce Morrison

27-04-04 08:53

reporter   ~0001252

Hi Michiel

I'd be happy to do it. What is the best way to work it?

Cheers
Bruce

michiel

10-05-04 14:30

manager   ~0001304

I have just done a test by doing a mass "fix" ie

sed s/<?/<?php/

but it breaks the system. The problem is in <?= PHPlist uses that a lot, so what is the long tag equivalent of that? Do you know? It doesn't seem to be <?php=

Once that's sorted I can do the global update.

Bruce Morrison

11-05-04 01:30

reporter   ~0001306

'<?=' is a shortcut for '<?php echo'

michiel

11-05-04 12:34

manager   ~0001307

Hmm, that's not as neat, but I'll give it a try.

Bruce Morrison

12-05-04 01:56

reporter   ~0001309

Hi Michiel

Have you considered the separating the presentation (HTML) and logic by using a templating system (like smarty) to produce the HTML?

This would certainly give you more control over the presentation and make the code much easier to work with (also get rid of the need for the <?php echo bits)

Cheers
Bruce

michiel

12-05-04 11:58

manager   ~0001310

Yes, I have considered it, but it's for now too much work. By the way, with a little shell script I managed to convert all <? to <?php It's in CVS now, and the next release will have that sorted. I'll close this bug fro now.

michiel

12-05-04 11:58

manager   ~0001311

applied to CVS, and will propagate to the next release

Bruce Morrison

10-06-04 11:43

reporter   ~0001436

Last edited: 10-06-04 11:52

Missed fixing the short tags in
/phplist-2.8.7/public_html/lists/admin/commonlib/lib/userlib.php

And also
following files still start with "<?"

phplist-2.8.7/phplist.php
phplist-2.8.7/public_html/lists/admin/dbcheck.php
phplist-2.8.7/public_html/lists/admin/commonlib/lib/accesscheck.php
phplist-2.8.7/public_html/lists/admin/commonlib/lib/errorlib.php
phplist-2.8.7/public_html/lists/admin/commonlib/lib/interfacelib.php
phplist-2.8.7/public_html/lists/admin/commonlib/lib/oldphp_vars.php
phplist-2.8.7/public_html/lists/admin/commonlib/pages/attributes.php
phplist-2.8.7/public_html/lists/admin/commonlib/pages/dbcheck.php
phplist-2.8.7/public_html/lists/admin/commonlib/pages/importcsv.php

The following files contain <?=
phplist-2.8.7/phplist.sql
phplist-2.8.7/public_html/lists/admin/adminattributes.php
phplist-2.8.7/public_html/lists/admin/admins.php
phplist-2.8.7/public_html/lists/admin/editattributes.php
phplist-2.8.7/public_html/lists/admin/fckphplist.php
phplist-2.8.7/public_html/lists/admin/footer.inc
phplist-2.8.7/public_html/lists/admin/send_core.php
phplist-2.8.7/public_html/lists/admin/spageedit.php
phplist-2.8.7/public_html/lists/admin/info/en/community.php
phplist-2.8.7/public_html/lists/admin/info/en/import.php
phplist-2.8.7/public_html/lists/admin/plugins/sidebar/main.php
phplist-2.8.7/public_html/lists/admin/commonlib/pages/attributes.php
phplist-2.8.7/public_html/lists/admin/commonlib/pages/importcsv.php

edited on: 06-10-04 10:46

edited on: 06-10-04 10:52

michiel

15-06-04 23:34

manager   ~0001461

The short2long.sh should do it, although this one will not process images, which is better (the old one happened to find <? inside one image

---
# script to replace short php tags <? with long one <?php

for i in `find public_html -type f|grep -e "\.php\|\.inc"`; do echo $i;
sed "s/<?/<?php/" $i > /tmp/$$
mv -f /tmp/$$ $i
done
# remove accidentally doubled ones
for i in `find public_html -type f|grep -e "\.php\|\.inc"`; do echo $i;
sed "s/<?phpphp/<?php/" $i > /tmp/$$
mv -f /tmp/$$ $i
done
# change the echo ones
for i in `find public_html -type f|grep -e "\.php\|\.inc"`; do echo $i;
sed "s/<?php echo /<?php echo /" $i > /tmp/$$
mv -f /tmp/$$ $i
done
---

michiel

19-10-04 11:02

manager   ~0002337

the support script, now included can be used