phpzend-framework3rackspace

Zend framework 3 and rackspace authenticate() is not working


This code was working fine with zf2 but when i migrated to ZF3 it is giving me the following error

$user = 'username';
$key  = 'secret key';

$rackspace = new ZendService\Rackspace\Files($user,$key);

if ($rackspace->authenticate()) {
    printf("Authenticated with token: %s",$rackspace->getToken());
} else {
    printf("ERROR: %s",$rackspace->getErrorMsg());
}

File : zendframework\zendservice-rackspace\library\ZendService\Rackspace\AbstractRackspace.php:365

Message: Call to a member function getFieldValue() on boolean

The error is from the Rackspace library, I haven't use getFieldValue() anywhere


Solution

  • IN the Library itself there is a line that was causing the error

    The line 401 in AbstractRackspace.php

    $this->managementUrl = $result->getHeaders()->get(self::MANAGEMENT_URL)->getFieldValue();
    

    the error was due to this line as the MANAGEMENT_URL is not set there in the header. i commented that line in the file and the error is gone