Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I reverse escapeshellarg?

Tags:

php

escaping

Well, header says it all.
in php, how do I reverse escapeshellarg()? To be more precise, what is the built-in function (if there is one) that will reverse it.

like image 823
Itay Moav -Malimovka Avatar asked Dec 20 '25 05:12

Itay Moav -Malimovka


1 Answers

Most thorough route would be to find out exactly what escapeshellarg() does and do the opposite. In a linux environment, it looks like it's just taking care of single quotes. In a Windows environment, it's doing a bit more. Your reverse function should take that into account as well.

Regarding a built-in function: The short answer is "there isn't one." The long answer is: there isn't one because escaped shell arguments aren't ever intended to get parsed by PHP (why escape them in the first place?) so nobody ever wrote one and submitted it as a patch to PHP. If you're passing arguments into a CLI PHP application, you don't need to unescape things as that was done already by the interpreter.

like image 103
WWW Avatar answered Dec 21 '25 18:12

WWW



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!