Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7949271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T01:56:57+00:00 2026-06-04T01:56:57+00:00

isset() in php 5.3 seems to be behaving unexpectedly. I have a class called

  • 0

isset() in php 5.3 seems to be behaving unexpectedly. I have a class called DB details that encapsulates a bunch of string properties with getters and setters.

$dbdetails->getDatabasename() evaluates to a string (“mydb”)

This throws a 500 error:

if(!isset($dbdetails->getDatabasename())){
//do something
}

This works fine

$databasename = $dbdetails->getDatabasename();
if(!isset($databasename)){
//do something
}

I wasn’t able to see any log output because apache sent back a 500 even though the error ini param is set (sic) to On. I know this is something to do with the isset call for sure.
Any idea what could be wrong, or did I find a PHP bug?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T01:56:58+00:00Added an answer on June 4, 2026 at 1:56 am

    The isset function checks whether a variable is set. Checking against $databasename is valid, because it is a variable that can be set or not. Checking against a function is invalid, because it simply isn’t a variable.

    You probably want to use is_null( $value ) when checking the immediate result of a function.


    An example from the comments on the the is_null documentation:

    <?php
    function test( ) { return null; }
    var_dump( is_null( test( ) ) ); // displays "true"
    var_dump( isset( test( ) ) ); // parse error, because "test()" is not a variable
    ?>
    
    • PHP: is_null
    • PHP: isset
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

<?php if (isset($_GET['action']) && (!$_GET['action'] == 'reply')) { ?> <div class=actions> <input type=button onclick=javascript:
I have the following PHP code: <?php if(isset($_GET['article'])) { echo <b>success</b>; } ?> And
I have the following pages: page1.php <?php if (isset($_GET['link'])) { session_start(); $_session['myvariable'] = 'Hello
I have code like this: <?php if(isset($global_info_results)): ?> <?php echo count($global_info_results) ?> <span>Mali Oglasi:
i have a statement in my php: <? if(isset($_GET['mod']) && ($_GET['mod'] == category ||
I have a very simple test page for PHP session. <?php session_start(); if (isset($_SESSIONS['views']))
I have a simple file called index.php. I need to pass it a querystring
I got some legacy code that has this: <?PHP if(isset($_GET['pagina'])==homepage) { ?> HtmlCode1 <?php
I have a script that seems to not work, it it meant to update
I have a php login with two users. Everything seems to work fine but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.