我收到警告:Call-time pass-by-reference has been deprecated对于以下代码行:
function XML() {
$this->parser = &xml_parser_create();
xml_parser_set_option(&$this->parser, XML_OPTION_CASE_FOLDING, false);
xml_set_object(&$this->parser, &$this);
xml_set_element_handler(&$this->parser, 'open','close');
xml_set_character_data_handler(&$this->parser, 'data');
}
function destruct() {
xml_parser_free(&$this->parser);
}
function & parse(&$data) {
$this->document = array();
$this->stack = array();
$this->parent = &$this->document;
return xml_parse(&$this->parser, &$data, true) ? $this->document : NULL;
}
Run Code Online (Sandbox Code Playgroud)
它是什么原因以及如何解决它?
我有一个古老的脚本,最近我得到这个错误:
Fatal error: Call-time pass-by-reference has been removed in /****/******/public_html/****/cp-list-summary.php on line 100
Run Code Online (Sandbox Code Playgroud)
它看起来像是在该文件的第100行:
if ($row[images])
{
$image_set = array ();
$result = mysql_query ('SELECT fname FROM ' . $dbimgs . ' WHERE listid=\'' . $_GET['id'] . '\' ORDER BY id ASC', $link);
while ($images = mysql_fetch_array ($result))
{
array_push (&$image_set, $images[fname]);
}
}
Run Code Online (Sandbox Code Playgroud)
是什么导致错误以及如何解决?我不是开发人员,所以请慢慢来.
我有这个错误消息与Centos 5.9,PHP 5.4和较旧的PHP程序扩展(typo3 CMS).
PHP致命错误:已在第279行的class.tx_spscoutnetcalendar_pi1.php中删除了调用时传递引用
这是模拟php代码的功能:
// ********* Start XML code *********
// get XML data from an URL and return it
function fetchCalendarData($xmlUrl,$timeout) {
$xmlSource="";
$url = parse_url($xmlUrl);
$fp = fsockopen($url['host'], "80", &$errno, &$errstr, $timeout);
if ($fp) {
fputs($fp, "GET ".$url['path']."?".$url['query']." HTTP/1.1\r\nHost: " . $url['host'] . "\r\n\r\n");
while(!feof($fp))
$xmlSource .= fgets($fp, 128);
}
// strip HTTP header
if ($pos = strpos($xmlSource,"<?xml")) { // this has to be the first line
$xmlSource = substr($xmlSource, $pos);
} else {
$xmlSource="";
} …Run Code Online (Sandbox Code Playgroud)