php quote shell arguments function ... doing a better job than php's builtin escapeshellarg
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Alexey Berezhok 06fd83a6be
Init commit
10 months ago
src/Hestiacp/quoteshellarg Init commit 10 months ago
LICENSE Init commit 10 months ago
README.md Init commit 10 months ago
composer.json Init commit 10 months ago

README.md

phpquoteshellarg

php quote shell arguments function ... doing a better job than php's builtin escapeshellarg(): https://3v4l.org/Hkv7h

Developed by https://github.com/divinity76/phpquoteshellarg

installation

the script is just a standalone .php file, you can just copypaste it.

another alternative is to use composer:

composer require 'hestiacp/phpquoteshellarg'

usage

<?php
require_once(__DIR__ . '/vendor/autoload.php');
use function Hestiacp\quoteshellarg\quoteshellarg;

$str="æøå\x01";
var_dump(["str"=>$str,"escapeshellarg"=>escapeshellarg($str), "quoteshellarg"=>quoteshellarg($str)]);

may outputs something like

array(3) {
  ["str"]=>
  string(7) "æøå"
  ["escapeshellarg"]=>
  string(3) "''"
  ["quoteshellarg"]=>
  string(9) "'æøå'"
}