Icy Phoenix


Post new topic  Reply to topic 
Page 1 of 1
Reply with quote Download Post
Post The Numeric Value Zero Is Empty() 
Came across this 'bug' in the version 2.0 beta, file adm/xs_style.php, line 37:

Code: [Download] [Hide] [Select]
// change "override" variable
$setoverride = request_var('setoverride', 0);
if(!empty($setoverride) && !defined('DEMO_MODE'))

The new value is written to the DB in the if statement - which will only fire if !empty(), but 0 *is* empty().

Is now:
Code: [Download] [Hide] [Select]
// change "override" variable
$setoverride = request_var('setoverride', $config['override_user_style']);

Brainfart, sorry - you can just test for a difference:
Code: [Download] [Hide] [Select]
$setoverride = request_var('setoverride', $config['override_user_style']);
if(($setoverride != $config['override_user_style']) && !defined('DEMO_MODE'))

Since the parameter setoverride *can* legally be zero, the problem is that the code will *never* switch the flag off, but will switch the flag on, with the result (in this case) that user selected styles are premanently overridden.

I don't know what a correct fix for this would be. I remember seeing a function to check if the parameter is there, but can't remember where or what it is - that would probably be a better solution.

As it is I'm causing a database write hit every time the page is executed
- but at least it works...


jhlSend private message  
Back to topPage bottom
Icy Phoenix is an open source project, you can show your appreciation and support future development by donating to the project.

Support us
Post new topic  Reply to topic  Page 1 of 1

Display posts from previous:    

HideWas this topic useful?

Link this topic

Permissions List
You cannot post new topics
You cannot reply to topics
You cannot edit your posts
You cannot delete your posts
You cannot vote in polls
You cannot attach files
You can download files
You cannot post calendar events