← Back to team overview

mahara-contributors team mailing list archive

[Bug 1472443] Re: Can't use method return value in write context error in forgotpass.php

 

** Description changed:

- Need to remove the empty() check as the options for the variable
- 'pwchangerequested' is true/false
+ Reported on the mahara.org forum:
+ https://mahara.org/interaction/forum/topic.php?id=7288&offset=0&limit=10#post29295
+ 
+ "When we tried it on our server running php version 5.4.16 on Redhat
+ 7.1, we get a blank page and the the error
+ 
+ PHP Fatal error:  Can't use method return value in write context in
+ /var/www/html/mahara/forgotpass.php on line 21, referer:
+ http://cepd.aut.ac.nz/mahara/
+ 
+ Line 21 is:
+ 
+ if (!empty($SESSION->get('pwchangerequested'))) {
+ 
+ Looking into the issue I found
+ http://stackoverflow.com/questions/1075534/cant-use-method-return-value-
+ in-write-context/4328049#4328049 which basically says on empty() needs
+ to access value by reference (in order to check whether that reference
+ points to something that exists), and PHP before 5.5 didn't support
+ references to temporary values returned from functions. Following what
+ they suggested I changed line 21 to:
+ 
+ if ($SESSION->get('pwchangerequested')) {
+ 
+ Which if the answer in stackoverflow is correct should be the same as it
+ was previously. After doing that no error is given and the page renders.
+ Would this be the correct change for people that get that error?"
+ 
+ Summary: Need to remove the empty() check as the options for the
+ variable 'pwchangerequested' is true/false

** Description changed:

- Reported on the mahara.org forum:
+ Reported on the mahara.org forum, as a follow-up to Bug 1460911:
  https://mahara.org/interaction/forum/topic.php?id=7288&offset=0&limit=10#post29295
  
  "When we tried it on our server running php version 5.4.16 on Redhat
  7.1, we get a blank page and the the error
  
  PHP Fatal error:  Can't use method return value in write context in
  /var/www/html/mahara/forgotpass.php on line 21, referer:
  http://cepd.aut.ac.nz/mahara/
  
  Line 21 is:
  
  if (!empty($SESSION->get('pwchangerequested'))) {
  
  Looking into the issue I found
  http://stackoverflow.com/questions/1075534/cant-use-method-return-value-
  in-write-context/4328049#4328049 which basically says on empty() needs
  to access value by reference (in order to check whether that reference
  points to something that exists), and PHP before 5.5 didn't support
  references to temporary values returned from functions. Following what
  they suggested I changed line 21 to:
  
  if ($SESSION->get('pwchangerequested')) {
  
  Which if the answer in stackoverflow is correct should be the same as it
  was previously. After doing that no error is given and the page renders.
  Would this be the correct change for people that get that error?"
  
  Summary: Need to remove the empty() check as the options for the
  variable 'pwchangerequested' is true/false

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1472443

Title:
   Can't use method return value in write context error in
  forgotpass.php

Status in Mahara ePortfolio:
  Fix Committed
Status in Mahara 15.04 series:
  In Progress

Bug description:
  Reported on the mahara.org forum, as a follow-up to Bug 1460911:
  https://mahara.org/interaction/forum/topic.php?id=7288&offset=0&limit=10#post29295

  "When we tried it on our server running php version 5.4.16 on Redhat
  7.1, we get a blank page and the the error

  PHP Fatal error:  Can't use method return value in write context in
  /var/www/html/mahara/forgotpass.php on line 21, referer:
  http://cepd.aut.ac.nz/mahara/

  Line 21 is:

  if (!empty($SESSION->get('pwchangerequested'))) {

  Looking into the issue I found
  http://stackoverflow.com/questions/1075534/cant-use-method-return-
  value-in-write-context/4328049#4328049 which basically says on empty()
  needs to access value by reference (in order to check whether that
  reference points to something that exists), and PHP before 5.5 didn't
  support references to temporary values returned from functions.
  Following what they suggested I changed line 21 to:

  if ($SESSION->get('pwchangerequested')) {

  Which if the answer in stackoverflow is correct should be the same as
  it was previously. After doing that no error is given and the page
  renders. Would this be the correct change for people that get that
  error?"

  Summary: Need to remove the empty() check as the options for the
  variable 'pwchangerequested' is true/false

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1472443/+subscriptions


References