Please login or register.

Login with username, password and session length
Advanced search  

News:

You need/want an older version of sNews ? Download an older/unsupported version here.

Author Topic: PHP 5.2.5 confict with language variable placement  (Read 7013 times)

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6020
  • Semantically Challenged
    • snews.ca
PHP 5.2.5 confict with language variable placement
« on: June 22, 2008, 12:04:52 am »

UPDATED: June 24.08
NOTE: Disregard all posts below this one as they do not relate to the solution explained here in this post.
I should also note that this problem seems (at this time) to occur only with the sNews 1.6 MEMU package. sNews 1.7RC2, sNews 1.6 (default) and sNews 1.6.3MU are not affected.

Background:
One of my sNews 1.6 websites... based on the 1.6 MEMU package... was working fine on one of my host's servers running PHP 4.4.7. The host did me a "favor" and moved this site to a new server running with PHP 5.2.5. But the move created a new problem.

The Problem:
Most of the Admin panels were not displaying their components below a certain point. In all cases, the footer was not visible and, in some, most of what was supposed to show in the "Customize" panel in the content management panels was also missing. It took some time for me to track the problem down... looking in a few different directions... but all problem areas were caused by the exact same thing... placement of language variables within PHP script. Again... this problem is only apparent on a host server running PHP 5.2.5... it is not noticable on servers running PHP 4.4.7 or lower.

The Solution:
In all cases... it was necessary to replace the '.l('variable').' with the actual text so PHP parsing would continue. Here one example.

1 - In the //CATEGORIES - ADMIN LIST function (1.6 MEMU, snewsMU.php file), the 1st string shown below displays the category titles in the VIEW Categories panel... its name, the author's username... followed by the '.l('divider').'... before the start of the "Edit" text-link. As shown in the 2nd string... I found it necessary to REMOVE '.l('divider').' and replace it with  .  just before the '.l('edit').' at the end of the string.

Code: [Select]
<?php

# STRING CREATING THE PROBLEM
echo '<p class="subcattitle">-&nbsp;<strong>'.$sub['name'].'</strong> ('.get_identity($r['author_id'], 'username_real').') '.l('divider').' <a href="'.db('website').'index.php?action=admin_category&amp;id='.$sub['id'].'" title="'.$sub['description'].'">'.l('edit').'</a> ';

# STRING WITH DIVIDER REMOVED. REPLACED WITH ACTUAL TEXT BEFORE "Edit" variable at end of String.
echo '<p class="subcattitle">-&nbsp;<strong>'.$sub['name'].'</strong> ('.get_identity($r['author_id'], 'username_real').') <a href="'.db('website').'index.php?action=admin_category&amp;id='.$sub['id'].'" title="'.$sub['description'].'">&nbsp;.&nbsp;'.l('edit').'</a> ';

?>


Now... I have no idea WHY this works as it does... I am just happy that it DOES work. So if anyone else understands this... please feel free to share it in a new reply.  :)

« Last Edit: June 24, 2008, 04:16:32 pm by Keyrocks »
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

funlw65

  • Hero Member
  • *****
  • Karma: 96
  • Posts: 771
    • Country Lab
Re: Possible Bugs or Conflicts with PHP5
« Reply #1 on: June 22, 2008, 12:29:21 am »

Something like this?

Quote
Hi all, I'm having issues with a form I'm working with. My server is running php 5.2.5. I have a form that has some checkboxes that are supposed to echo out which cities are selected on the next page. All of my other varibles are passing correctly, except for the cities array.

In my hunting for an answer I found a tutorial which basically has the same thing(a form passing info through checkboxes) which I KNOW works on their server, so I just copy and pasted it over to mine: Tutorial

and it doesn't work on my server. I tested on another server which is running php 5.2.4 and it's working there too.

Google led me to this: old php bug fix which really sounds like the same problem, so I changed all the POSTs to GETs in my copy of that tutorial, and it works.

If I absolutely have to I suppose the form could stay as GET, but I'd really rather not for the obvious reasons. Has anybody encountered this problem before? Know anything about fixing/working around it?

Edit: I didn't want to post the actual site, but screw it: test site
code: here

Forgot address, sorry!
Another one.
What server is running and under what operating system?

I did more searches on google and found many problems also in Wordpress with different plugins, users yelling at developers, and developers trying to find bugs... but all have in common php 5.2.5 and checkboxes. See also this (one of them):
http://img47.imageshack.us/img47/7836/customwritepanelerror1cnd0.png
« Last Edit: June 22, 2008, 01:23:10 am by funlw65 »
Logged

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6020
  • Semantically Challenged
    • snews.ca
Re: Possible PHP5 Bugs or Conflicts (running with)
« Reply #2 on: June 22, 2008, 01:25:01 am »

I just go through comparing the phpinfo for the old and new servers.
Old  Server: Apache 1.3.37
New Server: Apache 1.3.41
Both are using MySQL version 4.1.22.
I noticed that magic_quotes_gpc is "off" on the new server and "on" on the old one... a possible problem?
« Last Edit: June 22, 2008, 01:26:46 am by Keyrocks »
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

funlw65

  • Hero Member
  • *****
  • Karma: 96
  • Posts: 771
    • Country Lab
Re: Possible PHP5 Bugs or Conflicts (running with)
« Reply #3 on: June 22, 2008, 01:39:03 am »

I found on net reports about problems solved with that thing set on "on", others solved with that thing set on "off". All about php 5.2.5....

Try with that variable "on" but maybe others from that host will have problems... I think the solution is an downgrade to a working 5.0.x version ....
« Last Edit: June 22, 2008, 01:41:37 am by funlw65 »
Logged

Joost

  • Guest
Re: Possible PHP5 Bugs or Conflicts (running with)
« Reply #4 on: June 22, 2008, 01:50:58 am »

You can switch it off and on, using .htaccess:

php_flag magic_quotes_gpc off

or

php_flag magic_quotes_gpc on

But as far as I know it only affects GET, POST an Cookies. Well,.... give it a try.

Logged

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6020
  • Semantically Challenged
    • snews.ca
Re: Possible PHP5 Bugs or Conflicts (running with)
« Reply #5 on: June 22, 2008, 02:00:58 am »

I found on net reports about problems solved with that thing set on "on", others solved with that thing set on "off". All about php 5.2.5....
Try with that variable "on" but maybe others from that host will have problems... I think the solution is an downgrade to a working 5.0.x version ....

magic_quotes_gpc is OFF on the new server running PHP 5.2.5 and it is ON on the old server where all worked well before... which is why I thought it might be an issue. If it is already off on the server... I would expect that it cannot be over-ridden or controlled from the .htaccess file anyway.... right  ???
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

funlw65

  • Hero Member
  • *****
  • Karma: 96
  • Posts: 771
    • Country Lab
Re: Possible PHP5 Bugs or Conflicts (running with)
« Reply #6 on: June 22, 2008, 02:13:11 am »

On my post, try=contact your hoster :) . I suppose you can't switch from .htaccess but on other hosters you can (according to my searches on net).
Logged

Joost

  • Guest
Re: Possible PHP5 Bugs or Conflicts (running with)
« Reply #7 on: June 22, 2008, 02:18:26 am »

I found on net reports about problems solved with that thing set on "on", others solved with that thing set on "off". All about php 5.2.5....
Try with that variable "on" but maybe others from that host will have problems... I think the solution is an downgrade to a working 5.0.x version ....

magic_quotes_gpc is OFF on the new server running PHP 5.2.5 and it is ON on the old server where all worked well before... which is why I thought it might be an issue. If it is already off on the server... I would expect that it cannot be over-ridden or controlled from the .htaccess file anyway.... right  ???

It can be overwritten in general, else I would not mention it. ;)

Any errors thrown at all?
Logged

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6020
  • Semantically Challenged
    • snews.ca
Re: PHP 5.2.5 confict with language variable placement
« Reply #8 on: June 24, 2008, 04:19:32 pm »

UPDATE: Problem Found.

As it turns out, it all had to do with placement of language variables within the sNews 1.6 MEMU package. Removing them solved the problem.
See the first post in this topic (now edited) for the full story.
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU