'Fatal error: Cannot use isset, use null expression

I keep receiving the error:

Fatal error: Cannot use isset() on the result of an expression (you can use "null !== expression" instead) in line 42

This is line 42:

if (isset($_GET['reply_id'] && $_GET['reply_user'])) {

Here's the "entire" part of that code:

<?php
if (isset($_GET['reply_id'] && $_GET['reply_user'])) {
$reply_id = $_GET['reply_id'];
$reply_user = $_GET['reply_user'];
echo '<form action="#" method="post">
<center>
<textarea rows="4" cols="50" maxlength="300" name="comment_box" placeholder="Say something awesome..." Style="width:94%;font-family:helvetica;font-size:14px;">@' . $reply_user . '.</textarea></center>
<center><input type="submit" name="post2" class="post_text" value="Post"></center>
</form>';
}
?>

How do I fix this?



Solution 1:[1]

Do you mean

 if ( isset($_GET['reply_id'], $_GET['reply_user']) ) {
      // code here
 }

Solution 2:[2]

Late reply, but usually this error is caused by a typo or syntax error.

(isset($_GET['reply_id'], $_GET['reply_user']))

(isset($_GET['reply_id']) && isset($_GET['reply_user']))

Both are fine!

Solution 3:[3]

Try by replacing with this condition.

if (isset($_GET['reply_id']) && isset($_GET['reply_user'])) {
 // your code.
}

Solution 4:[4]

make sure isset is receiving simple expressions. Ex:

instead of

if(isset(old('name'))){
//...
}

do something like

$name = old('name');

if(isset($name)){
//...
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 TheBosti
Solution 3 sandeepsure
Solution 4 Baraja Swargiary