in my server error_log I get many lines with :
PHP Fatal error: Call to a member function get() on a non-object in /components/com_users/models/login.php on line 62
the line 62 -> if ($return = $input->$method->get('return', '', 'BASE64'))
any idea of what could be wrong ?
thank you
Joomla 3.4.3
PHP 5.5.28
Apache 2.4.16
MySQL 5.5.42-cll
it should be ?
if (!empty($method) && isset($input->$method) && is_object($input->$method) && $return = $input->$method->get('return', '', 'BASE64')
Thanks a lot for your fast reply
And from my side there is nothing to do, I’ve got hundreds of error lines
Le 6 sept. 2015 à 02:35, Michael Babker notifications@github.com a écrit :
$method is set a few lines before that and should always have a value (see https://github.com/joomla/joomla-cms/blob/staging/libraries/joomla/input/input.php#L334 https://github.com/joomla/joomla-cms/blob/staging/libraries/joomla/input/input.php#L334), the extra checks should be absolutely unnecessary. It seems traffic is hitting your site with invalid HTTP requests as $_SERVER['REQUEST_METHOD'] is a pretty standard value to be set when running PHP applications via web request.
—
Reply to this email directly or view it on GitHub #7826 (comment).
Category | ⇒ | Libraries |
Priority | Urgent | ⇒ | Medium |
Please provide some testing instructions that we can try to reproduce the issue.
On my system this happens due to some clients accessing the website using the HEAD method. This is valid HTTP, as far as I understand things, however there is no php superglobal for HEAD
(as opposed to GET
and POST
).
JINPUT has a __get()
magic method to get input objects. When $method == 'GET'
, $input->$method
results in said superglobal being accessed. However when $method == 'HEAD'
this fails. The following final line from the method (file libraries/joomla/input/input.php) shows that something is missing:
// TODO throw an exception
I am new to php and to Joomla, but I fail to see the reason for accessing request inputs in this manner. It seems to me that in components/com_users/models/login.php the line:
if ($return = $input->$method->get('return', '', 'BASE64')
could (should?) be replaced with:
if ($return = $input->get('return', '', 'BASE64'))
Just some links to the code I referenced above:
The __get() magic method
The TODO comment
The line where I think a fix could be made (same line where this error occurs)
Hi you created this issue sometime ago but no code has been provided for people to evaluate. As no one has shown any interest in providing a pull request I am closing this at this time. If code is provided (a pull request) it can always be re-examined.
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-05-08 17:17:21 |
Closed_By | ⇒ | brianteeman |
I have gotten this same error a few times recently:
PHP Fatal error: Call to a member function get() on a non-object in /path/to/site/components/com_users/models/login.php on line 62
However, it seems to have just started in 2017.
$method
is set a few lines before that and should always have a value (see https://github.com/joomla/joomla-cms/blob/staging/libraries/joomla/input/input.php#L334), the extra checks should be absolutely unnecessary. It seems traffic is hitting your site with invalid HTTP requests as$_SERVER['REQUEST_METHOD']
is a pretty standard value to be set when running PHP applications via web request.