Skip to content

escape some text may contain xml special char <&>#5

Open
GHolk wants to merge 1 commit intowsmwason:masterfrom
GHolk:escape-xml
Open

escape some text may contain xml special char <&>#5
GHolk wants to merge 1 commit intowsmwason:masterfrom
GHolk:escape-xml

Conversation

@GHolk
Copy link

@GHolk GHolk commented Jun 2, 2021

your code may encounter this warning:
https://stackoverflow.com/questions/17027043/unterminated-entity-reference-in-php
so I escape title, author and description in entry.

for example in this gamer home:
https://home.gamer.com.tw/creation.php?owner=mitsueyn ,
it contain & in article title, and your code would produce incorrect rss.

you can test with following command:

php -r '
include("vendor/autoload.php");
function userRss($owner, $maxPage) {
    $GamerHomeCreation = new wsmwason\gamer\GamerHomeCreation($owner);
    $GamerHomeCreation->setOwner($owner);
    $GamerHomeCreation->setMaxCrawlPage($maxPage);
    return $GamerHomeCreation->asXml();
}

$owner = $argv[1];
userRss($owner, 1);
' mitsueyn

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant