2
if (isset( $xml->xpath('/lfm/artist/image[@size="extralarge"]')[0])) {

PHP Version 5.3 in use (was 5.7 until server dude switched it to 5.3).

On the line at the top we're getting this error:

PHP Fatal error:  Can't use method return value in write context

I've read a few articles but nothing obvious springs to mind - might be a case of not seeing the wood through the trees.

Any advice on how to get rid of the error other than switching back to 5.7?

pee2pee
  • 3,619
  • 7
  • 52
  • 133

1 Answers1

1

For compatibility with PHP < 5.4, update your code as follows:

$elements = $xml->xpath('/lfm/artist/image[@size="extralarge"]');
if (isset($elements[0])) {

Take a look at https://wiki.php.net/rfc/functionarraydereferencing if you're interested in learning more.

Nate
  • 1,442
  • 14
  • 22