Warning: Call-time pass-by-reference has been deprecated in


#1

Any clue how to resolve this issue?

Warning: Call-time pass-by-reference has been deprecated in …


#2

What software are you using? Chances are that it’s old, and needs to be updated to work correctly with PHP 5.


#3

Huh? Software?


#4

This message must be showing up in some piece of PHP software that you’re running. What is it?


#5

It’s showing up in an area that is pulling rss headlines from another site.


#6

If you are a programmer, this should answer your question
http://php.net/manual/en/language.references.pass.php

Note: There is no reference sign on a function call - only on function definitions.


#7

Yeah, I’m not a programmer.


#8

As explained on php.net, there is no reference sign on a function call - only on function definitions.

You need to have the sign “&” when you define the function.
You need to remove the sign “&” when you call the function.


#9

I have no idea what you’re talking about… here’s the php for the file that’s having the issue:

[php]<?php

class RSSParser {

var $insideitem = false;
var $tag = "";
var $title = "";
var $link = "";

function startElement($parser, $tagName, $attrs) {
	if ($this->insideitem) {
		$this->tag = $tagName;
	} elseif ($tagName == "ITEM") {
		$this->insideitem = true;
	}
}

function endElement($parser, $tagName) {
	if ($tagName == "ITEM" && $_SESSION['i'] < 5) {
		$_SESSION['i'] = $_SESSION['i'] + 1;
		//printf("<dt><b><a href='%s'>%s</a></b></dt>",
			//trim($this->link),htmlspecialchars(trim($this->title)));
		printf("<tr>");
    	printf("<td class='latest'><div align='left'><a href='%s' class='latest'>%s</a></div></td>",trim($this->link),htmlspecialchars(trim($this->title)));
		printf("</tr>");
		$this->title = "";
		$this->link = "";
		$this->insideitem = false;
	}
}

function characterData($parser, $data) {
	if ($this->insideitem) {
	switch ($this->tag) {
		case "TITLE":
		$this->title .= $data;
		break;
		case "LINK":
		$this->link .= $data;
		break;
	}
	}
}

}
$_SESSION[‘i’] = 0;
$xml_parser = xml_parser_create();
$rss_parser = new RSSParser();
xml_set_object($xml_parser,&$rss_parser);
xml_set_element_handler($xml_parser, “startElement”, “endElement”);
xml_set_character_data_handler($xml_parser, “characterData”);
$fp = fopen(“http://news.cnet.com/2547-1_3-0-20.xml?tag=txt","r”)
or die(“

Error reading RSS data.”);
while ($data = fread($fp, 4096))
xml_parse($xml_parser, $data, feof($fp));
// or die(sprintf(“XML error: %s at line %d”, xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser)));
fclose($fp);
xml_parser_free($xml_parser);

?>


more from C|Net News

[/php]

#10

Near the bottom:
[php]xml_set_object($xml_parser,&$rss_parser);[/php]
Remove the & before $rss_parser.


#11

Thank you much!!