XMB Forum Software
Not logged in [Login - Register]
Go To Bottom

Printable Version  
 Pages:  1  2
Author: Subject: [Resolved] Critical error: Usage of norwegian special characters (æ, ø, å) blanks the post.
solbu
Member
***




Posts: 33
Registered: 1-10-2007
Location: Norway
Member Is Offline

Mood: No Mood

thumbup.gif posted on 9-12-2013 at 08:51 PM


Quote: Originally posted by Daniel Gouveia  
The problem is the php 5.4 like lottos said.

Maybe this can fix this problem but is not a permanent solution

Just replace the file validate.inc.php

And that did the trick. Thank you so much.



My posts are licensed under a Creative Commons license
View user's profile Visit user's homepage View All Posts By User
SFSW
New Poster
**




Posts: 3
Registered: 5-26-2014
Member Is Offline


[*] posted on 5-26-2014 at 07:57 AM


Thank you for this fix, I ran into this same php 5.4 problem recently. The new validate.inc file generally works, however, the new validate file apparently disables changing the boards settings in the admin control panel. Likely due to changes in the array items check section of the file to include the $charset option. Would there be a fix available for this? I've been trying to change things around myself, but am concerned I'll break some other functionality.

Edit: To expand on this, I activated the debug flag and the problem occurs at the 'bbrulestxt' part of the 'UPDATE xmb_settings' query. The error that occurs is:

(errno = 1064)

Apparently some kind of problem with ' characters/quotes being used within the text content of the array. Still hunting for a solution...
View user's profile View All Posts By User
SFSW
New Poster
**




Posts: 3
Registered: 5-26-2014
Member Is Offline


[*] posted on 5-27-2014 at 02:17 AM


I've managed to pin down the cause and come up with a work-around, but unfortunately, fixing the initial problem breaks other functionality within the validate function. Here are the details, maybe someone else could provide a better solution with this information:

Magic quotes has been removed in php 5.4, so the get_magic_quotes_gpc() call will always return false. Bypassing that check is simple:

// if (get_magic_quotes_gpc()) {
$retval = stripslashes($retval);
// }

That removes the magic quotes check and runs the stripslashes function to get rid of the ' delimiter before and after the string. Here is where things get tricky and start to break down. Due to something in the new validate.inc file, any delimiters within strings must be marked with a slash, otherwise they will divide the strings in the wrong places. This is what causes the errorno 1064 with the new validate.inc file. In order for the admin settings option to work, the delimeters must be marked with slashes, so the above can be modified like this:

// if (get_magic_quotes_gpc()) {
$retval = stripslashes($retval);
$retval = addslashes($retval);
// }

This effectively adds slashes to the delimiters left behind (namely any apostrophes), which allows the admin settings to function properly. However, because of this change, regular forum posts will now have slashes ahead of any apostrophes, altering the post content in an undesired way. So there just needs to be a way to allow one to include the slashes while the other doesn't or maybe some other solution. Anyone have ideas for an effective solution to this?

Ideally, any apostrophes in strings should just not be treated as delimiters. The old system worked this way, but I'm having trouble coming up with the solution for the new validate.inc file under php 5.4.
View user's profile View All Posts By User
SFSW
New Poster
**




Posts: 3
Registered: 5-26-2014
Member Is Offline


[*] posted on 5-28-2014 at 05:22 AM


Here is more information and a solution to the problem I mentioned above.

If you rem out the old magic quotes part of the validate.inc file entirely and add 'addslashes' to the requires fields in the settings section of the cp.php file, the settings option will then work with this new validate.inc file that works with php 5.4. Here are the steps:


In validate.inc.php, find:

if (get_magic_quotes_gpc()) {
$retval = stripslashes($retval);
}

rem these lines out so they look like this (magic quotes returns false in php 5.4 anyway):

// if (get_magic_quotes_gpc()) {
// $retval = stripslashes($retval);
// }


Then in cp.php, find:

$bbrulestxtnew = postedVar('bbrulestxtnew', '', FALSE);

add the 'addslashes' command like this:

$bbrulestxtnew = addslashes(postedVar('bbrulestxtnew', '', FALSE));


Then in cp.php, find:

$bboffreasonnew = postedVar('bboffreasonnew');

add the 'addslashes' command like this:

$bboffreasonnew = addslashes(postedVar('bboffreasonnew'));


Then in cp.php, find:

$tickercontentsnew = postedVar('tickercontentsnew');

add the 'addslashes' command like this:

$tickercontentsnew = addslashes(postedVar('tickercontentsnew'));


With these changes and additions in place, the settings in the admin control panel will work correctly even if a delimeter is used in any of these three text fields (otherwise changes to the settings will fail without these changes). There may be other parts of the codebase that need this kind of modification in order to work.

So please, if someone else who is familiar with the XMB codebase knows of any other entry areas that need to have slashes added to prevent functions from failing, please post any other required changes to keep XMB boards working properly on PHP 5.4.

If I find any others, I'll try to post them here, but I'll likely only find them through trial and error as I try to use the board over time.
View user's profile View All Posts By User
 Pages:  1  2

  Go To Top

Powered by XMB 1.9.12 (Debug Mode)
XMB Forum Software © 2001-2024 The XMB Group
[Queries: 16] [PHP: 26.4% - SQL: 73.6%]