1

Full Error:

in_array() [<a href='function.in-array'>function.in-array</a>]: Wrong datatype for second argument in /var/www/vhosts/example.com/httpdocs/sites/example.com/themes/example/page.tpl.php on line 22.

Relevant Code:

if (($_GET['nid']) && ($_GET['uid'] != '5')) :
    $arr = array("7916","7917","7996","7918","7990","7919","7921","7924","7925","7923","7922","8011");
    reset($arr);
    $nid = $_GET['nid'];
    // settype($nid, "integer"); 
elseif(($_GET['uid'] == '5') && ($is_front)):
    include("include_ad_front.php");    
endif;

if((in_array($nid, $arr)) && ($is_front) && (!$_GET['uid'])) {
    //code continues below...

Lines 3 and 5 were just my attemts to fix the problem. Line 10 is actually line 22 in this error and the one throwing the error.

0

1 Answer 1

2

I think I see your problem.

You have the in_array stuff being called after you've done your first set of if..else checks. Now the first part of your if...else has the array being created, but not the second.

Try moving the array somewhere before your first if...else instead of inside it.

Sign up to request clarification or add additional context in comments.

2 Comments

It should't create the array unless that first issue validates, but I see what you're saying... Let me look at it and see if I get it. Just to test though, I'll try your suggestion as a band aid.
If you only want to check the array if the first if validates, try checking the existence of the $arr variable, for example if (isset($arr) and isset($nid) and in_array($nid, $arr) ...) {

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.