简体   繁体   English

Zend框架3和机架空间authenticate()无法正常工作

[英]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 这段代码在zf2上运行正常,但是当我迁移到ZF3时,出现了以下错误

$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 文件:zendframework \\ zendservice-rackspace \\ library \\ ZendService \\ Rackspace \\ AbstractRackspace.php:365

Message: Call to a member function getFieldValue() on boolean 消息:在布尔值上调用成员函数getFieldValue()

The error is from the Rackspace library, I haven't use getFieldValue() anywhere 错误来自Rackspace库,我没有在任何地方使用getFieldValue()

IN the Library itself there is a line that was causing the error 在库本身中,有一行导致错误

The line 401 in AbstractRackspace.php AbstractRackspace.phpline 401

$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. 该错误归因于此行,因为标头中未设置MANAGEMENT_URL i commented that line in the file and the error is gone 我在文件中注释了这一行,错误消失了

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM