欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

PHP 5.4中引用的的几个小问题

程序员文章站 2022-04-08 08:41:59
...
PHP 5.4中引用的的几个问题
问题 I. PHP Notice: Only variable references should be returned by reference
在调试函数时
function &GetSellerList($request) {
  $request->setVersion(EBAY_WSDL_VERSION);

  return ($res = & $this->call('GetSellerList', $request););
}

返回错误:PHP Notice: Only variable references should be returned by reference in /projects/ebay_api/tradding_api/EbatNsSamples/EbatNs/EbatNs_ServiceProxy.php on line 979

修改为:
function &GetSellerList($request) {
  $request->setVersion(EBAY_WSDL_VERSION);
  $res = & $this->call('GetSellerList', $request);
  return ($res);
}

即可.

问题 II. PHP Fatal error: Call-time pass-by-reference has been removed
运行代码返回错误:[30-Jan-2013 10:51:57 UTC] PHP Fatal error: Call-time pass-by-reference has been removed in /projects/ebay_api/tradding_api/EbatNsSamples/EbatNs/EbatNs_Client.php on line 245
因为PHP5.4语法改变,将245行代码
$this->_parser = &new EbatNs_ResponseParser( &$this, $tns, $this->_parserOptions );

修改为:
$this->_parser = &new EbatNs_ResponseParser( $this, $tns, $this->_parserOptions );

即可.
PHP 5.4中引用的的几个小问题

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。

相关文章

相关视频