Skip to content

PHP Parse error #152

Closed
mattsnowboard opened this Issue Sep 2, 2011 · 4 comments

2 participants

@mattsnowboard

I ran the build script for the latest version from git. When I try to use this compiled version, I get the following error:

PHP Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in C:\web_workspace\feedstreem\protected\extensions\SimplePie.php on line 12179

The culprit line is:

if (substr($data, 0, 5) === '<?xml' && strspn(substr($data, 5, 1), "\x09\x0A\x0D\x20") && ($pos = strpos($data, '?>')) !== false)

which is in SimplePie_Parser::parse

Not really sure what the problem is, but notepad++ doesn't seem to like the parentheses

@rmccue
SimplePie member
rmccue commented Sep 2, 2011

That line looks fine to me. Can you paste the 5 lines before and after as well please?

@mattsnowboard

Here's the surrounding lines:

    elseif (substr($data, 0, 2) === "\xFF\xFE")
    {
        $data = substr($data, 2);
    }
    // UTF-8 BOM
    elseif (substr($data, 0, 3) === "\xEF\xBB\xBF")
    {
        $data = substr($data, 3);
    }

    if (substr($data, 0, 5) === '<?xml' && strspn(substr($data, 5, 1), "\x09\x0A\x0D\x20") && ($pos = strpos($data, '?>')) !== false)
    {
        $declaration = new SimplePie_XML_Declaration_Parser(substr($data, 5, $pos - 5));
        if ($declaration->parse())
        {
            $data = substr($data, $pos + 2);
            $data = '<?xml version="' . $declaration->version . '" encoding="' . $encoding . '" standalone="' . (($declaration->standalone) ? 'yes' : 'no') . '"?>' . $data;
        }
        else
        {
            $this->error_string = 'SimplePie bug! Please report this!';
            return false;
        }
    }
@mattsnowboard

Update: I compiled the file on Windows using git bash (because I thought it would work since it can run the command line commands it needs). However, I can run the latest source without compiling just fine.

@rmccue
SimplePie member
rmccue commented Sep 19, 2011

I can confirm a parser error when building, but not the same one. I'll fix that, and see if it fixes this bug too.

@rmccue rmccue added a commit that closed this issue Sep 19, 2011
@rmccue rmccue Remove Unix commands from build tool and replace with PHP native ones.
Also, only remove the beginning PHP open tag and file-level PHPDoc comment. Fixes #152.
166f5b9
@rmccue rmccue closed this in 166f5b9 Sep 19, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.