Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'×' multiplication symbol replaces &timestamp in URL

Tags:

php

wordpress

I have a problem with a link, which generates from GoCardless PHP library. I'm using WordPress and I've found that the file /wp-includes/formatting.php have a function "ent2ncr", which replaces "&times" with multiplication sign "&#215" and in some magical way, this function ( may be I'm wrong ) changes ...&timestamp=2017-08-24T12%3A26%3A34Z to ...×tamp=2017-08-24T12%3A26%3A34Z

I can't change a name of this parameter, because it is required by GoCarldess API.

P.S. I've tried to comment this line in formatting.php, but nothing changes.

like image 655
Cheslav Avatar asked Oct 17 '22 07:10

Cheslav


2 Answers

Whats happening is the &times part of &timestamp is being translated as x as a result you end up with xtamp

Try encoding the & in front of timestamp with &

edited: to say encoding not escaping

like image 109
Software.Developer Avatar answered Oct 21 '22 01:10

Software.Developer


I had ever meet a question with ×(&times) and then fixed below by use htmlentities

$str = $node->getAttribute('href');
echo $str;//output http://mp.weixin.qq.com/profile? 
src=3×tamp=1524825376&ver=1  
echo htmlentities($str);

here is the output

like image 25
Specia_Lee Avatar answered Oct 21 '22 02:10

Specia_Lee