Results 1 to 10 of 29

Threaded View

  1. #12
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Need some help diagnosing functions_general,php errors

    PHP Code:
    if ( (!in_array($key$exclude_array)) && (strlen($value) > || is_array($value) && array_filter($value) ) && ($key != 'main_page') && ($key != zen_session_name()) && ($key != 'error') && ($key != 'x') && ($key != 'y') ) { 
    The statement is testing conditions for some situation, based on $key which stands for the name of the current array-item key in the array being evaluated, and $value which holds the value of the current key.
    Breaking down the statement,
    if ( (!in_array($key, $exclude_array))
    ---> the key is not in a list of keys to exclude,

    && (strlen($value) > 0 || is_array($value) && array_filter($value) )
    ---> and the value is a string that is longer than '' (empty or blank) or the value is an array and this filter applied to it gives "true' or a positive result

    && ($key != 'main_page') && ($key != zen_session_name()) && ($key != 'error') && ($key != 'x') && ($key != 'y') ) {
    ---> and the key is not one of these names.


    Apparently $value should not be an array if the key passes the "exclude" test. Casting it to int seems to make it safe, but destroys the test's value (unless it is a string starting with a number, it will be viewed as 0 (zero)); casting it to string will keep the information if it is a string, and hopefully make it safe if it is an array.

    Best would be to find out why it is being an array when it apparently should not, and fixing that, or testing for it being an array and handling it appropriately if it is.
    Last edited by gjh42; 12 Feb 2013 at 03:23 AM.

 

 

Similar Threads

  1. Need to display Product ID in functions_general.php to edit Category List Showcase
    By vandiermen in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 9 Mar 2009, 03:25 AM
  2. Need to override functions_general.php
    By lbowenc in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 28 Mar 2008, 12:18 PM
  3. Replies: 2
    Last Post: 1 Jul 2007, 05:10 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg