Closed jarodium closed 3 months ago
This is all in https://github.com/kvz/phpjs/blob/master/functions/var/unserialize.js which might be in need of some love. If you want to contribute please add a failing testcase to the header of the file and run
node bin/phpjs.js --action test --name unserialize
..until it works : ) and submit a pull request. Thanks in advance for your help!
It seems our unserialize function needs some love as people reported problems in #109, #190 and #257 too
My fix for #257 fixed also this issue: https://github.com/kvz/locutus/pull/310
Consider the following string:
a:5:%7Bs:7:%22nome_pt%22;s:27:%22Participa%C3%A7%C3%A3o%20no%20Congresso%22;s:4:%22tipo%22;s:5:%22texto%22;s:6:%22opcoes%22;a:0:%7B%7Ds:5:%22preco%22;s:5:%2210.00%22;s:11:%22obrigatorio%22;s:3:%22nao%22;%7D
Applying the following:
var t = decodeURI(valor);
t gets the following:
a:5:{s:7:"nome_pt";s:27:"Participação no Congresso";s:4:"tipo";s:5:"texto";s:6:"opcoes";a:0:{}s:5:"preco";s:5:"10.00";s:11:"obrigatorio";s:3:"nao";}
Next I apply unserialize function to t
at the 'nome_pt' field I'm getting a "Participa磯 no Congresso" ( Japanese character replacing the 'ç' and 'ão' )
The first value comes from php which puts that into a hidden input field. The decodeURI works as expected.
Can anyone point out if this is a bug or I am missing something? Regards