All attempts to run backend tasks queue with PHP 7.0.6 fail with error:

WD php: Error: Call to a member function get_services() on null in Provision_Context->get_services() (line 298 of /data/disk/o2/.drush/sys/provision/Provision/Context.php). [error]
Error: Call to a member function get_services() on null in Provision_Context->get_services() (line 298 of /data/disk/o2/.drush/sys/provision/Provision/Context.php).
Drush command terminated abnormally due to an unrecoverable error. [error]

Comments

omega8cc created an issue. See original summary.

steven jones’s picture

Seeing this error too. :(

steven jones’s picture

It's because of this line in the class Provision_Context:

if (isset($this->options[$field])) {

In PHP 7 it seems that effectively this code is called first:

if (isset($this->options)) {

But because the classes uses magic getters and issets:

function __isset($name) {
  return isset($this->properties[$name]) || property_exists($this, $name);
}

That is always returning FALSE.

AFAIK, we should consider isset($this->options) to always be TRUE, as you'll always get something returned from the magic getter.

FUN.

steven jones’s picture

Status: Active » Needs review
StatusFileSize
new503 bytes
steven jones’s picture

This sorts it out for me.

omega8cc’s picture

Status: Needs review » Reviewed & tested by the community

The patch works for me too, thanks! Please commit this :)

steven jones’s picture

If only I had commit access...wait a second!

  • Steven Jones committed e772b0d on 7.x-3.x
    Issue #2718437 by Steven Jones: Options is always isset on a context
    
steven jones’s picture

Status: Reviewed & tested by the community » Fixed
omega8cc’s picture

Thank you :)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.