Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Defect interpreting a quotes enclosed php instruction #62

Open
GoogleCodeExporter opened this issue Apr 8, 2016 · 2 comments
Open

Defect interpreting a quotes enclosed php instruction #62

GoogleCodeExporter opened this issue Apr 8, 2016 · 2 comments

Comments

@GoogleCodeExporter
Copy link

What will reproduce the problem?

<a href="/Docs/Elements/details/<?php echo $link ?>"><?php echo 'aaa' ?></a>

What is the expected output? 

Probably the same line?

What do you see instead?

<a href="/Docs/Elements/details/&lt;?= $item-&gt;mainfield ?&gt;"><?php echo 
$item->Name ?></a>

Which version are you using?

Latest. ganon_rev78

Please provide any additional information below.

I think it doesn't expect PHP code inside an attribute, probably adding a check 
would fix it. Posting here in case someone had the same problem (and hopefully 
a solution :), as ganon has proven to be THE software I was looking for. 

Original issue reported on code.google.com by gaston...@gmail.com on 7 Jul 2014 at 10:45

@GoogleCodeExporter
Copy link
Author

Hey, I reckon this is a nasty hack and might cause problems with certain code, 
but as I just needed for 1 specific issue and I'm around the clock here, I 
wanted to share my temp solution (If I ever come back at this and build a more 
elegant solution, for sure I'll post it here!)

gan_tokenizer.php, at next_pos function, right after $str = substr...  I added 
a check to see if the contained string has a <, if it does, then just looks for 
the closing tag: ?>. moves the pos right after that one, then continues:

if ($problem = stripos($str,'<') !== false) { // Found a <
    $newpos = stripos($this->doc, '?>', $this->pos + 1);
    $p = stripos($this->doc, $needle, $newpos);
    $len = $p - $this->pos - 1;
    if ($len > 0) {
        $str = substr($this->doc, $this->pos + 1, $len);
    }
}

And I also took out the htmlspecialchars from attributes_toString function (do 
you guys really need it there?)

Anyway, ganon is GREAT! I can't thank you enough for your effort.

Original comment by gaston...@gmail.com on 8 Jul 2014 at 4:38

@GoogleCodeExporter
Copy link
Author

Hi, this is not fault. Input format for ganon should be HTML file, not template 
file.
This is not defect.

Original comment by i...@standa-david.com on 28 Jul 2014 at 5:54

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant