?
avatar gsexton
gsexton
4 Apr 2016

I was coding along, and I reversed the order of the args in my page to the property_exists() function. After I fixed my error, I searched for any other instances where I'd done that. The editor found this code in libraries/cms/application/administrator.php at line 421:

if (property_exists('JConfig', 'root_user')
    && (JFactory::getUser()->get('username') == $rootUser || JFactory::getUser()->id === (string) $rootUser))
{
    $this->enqueueMessage(
    JText::sprintf(
    'JWARNING_REMOVE_ROOT_USER',
                    'index.php?option=com_config&task=config.removeroot&' . JSession::getFormToken() . '=1'
                ),
                'notice'
            );
        }

I didn't really dig into what it's supposed to be doing, but it's definitely not correct.

avatar gsexton gsexton - open - 4 Apr 2016
avatar mbabker
mbabker - comment - 4 Apr 2016

How's it not correct? property_exists() lets you check if a property is defined on a class name (string parameter) or an object, so that use is just fine.

avatar gsexton
gsexton - comment - 4 Apr 2016

My mistake. I didn't see that it takes a class name. I assumed it was an instance.

avatar gsexton gsexton - change - 4 Apr 2016
Status New Closed
Closed_Date 0000-00-00 00:00:00 2016-04-04 20:28:53
Closed_By gsexton
avatar gsexton gsexton - close - 4 Apr 2016
avatar gsexton gsexton - close - 4 Apr 2016
avatar brianteeman brianteeman - close - 4 Apr 2016
avatar mbabker
mbabker - comment - 4 Apr 2016

No problem. There are more than enough quirks in PHP to make you second guess yourself, I do it every day :laughing:

avatar brianteeman brianteeman - change - 22 Apr 2016
Labels Added: ?

Add a Comment

Login with GitHub to post a comment