Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions XML/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ function setHandlerObj($obj)
*/
function _initHandlers()
{
if (!is_resource($this->parser)) {
if (!$this->parser) {
return false;
}

Expand Down Expand Up @@ -333,7 +333,7 @@ function _create()
} else {
$xp = @xml_parser_create($this->srcenc);
}
if (is_resource($xp)) {
if ($xp) {
if ($this->tgtenc !== null) {
if (!@xml_parser_set_option($xp, XML_OPTION_TARGET_ENCODING,
$this->tgtenc)
Expand Down Expand Up @@ -544,7 +544,7 @@ function _parseString($data, $eof = false)
*/
function parseString($data, $eof = false)
{
if (!isset($this->parser) || !is_resource($this->parser)) {
if (!$this->parser) {
$this->reset();
}

Expand All @@ -569,9 +569,9 @@ function parseString($data, $eof = false)
**/
function free()
{
if (isset($this->parser) && is_resource($this->parser)) {
if ($this->parser) {
xml_parser_free($this->parser);
unset( $this->parser );
$this->parser = null;
}
if (isset($this->fp) && is_resource($this->fp)) {
fclose($this->fp);
Expand Down Expand Up @@ -734,7 +734,7 @@ class XML_Parser_Error extends PEAR_Error
*/
function __construct($msgorparser = 'unknown error', $code = 0, $mode = PEAR_ERROR_RETURN, $level = E_USER_NOTICE)
{
if (is_resource($msgorparser)) {
if (!is_string($msgorparser)) {
$code = xml_get_error_code($msgorparser);
$msgorparser = sprintf('%s at XML input line %d:%d',
xml_error_string($code),
Expand Down