This appears to have been fixed some time between 5.3.2 and 5.3.5:

clint@clint-MacBookPro:~$ php -f test_pound2.php
string(26) "!+_£@#&;`|*?~<>^()[]{}$\,"
string(28) "'!+_£@#&;`|*?~<>^()[]{}$\,'"
string(1) "'"
string(1) "!"
string(1) "+"
string(1) "_"
string(1) "�"
string(1) "�"
string(1) "@"
string(1) "#"
string(1) "&"
string(1) ";"
clint@clint-MacBookPro:~$ php --version
PHP 5.3.5-1ubuntu1 with Suhosin-Patch (cli) (built: Feb 22 2011 16:51:15) 
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

vs.

(lucid-amd64)clint@clint-MacBookPro:~$ php -f test_pound2.php 
string(26) "!+_£@#&;`|*?~<>^()[]{}$\,"
string(26) "'!+_@#&;`|*?~<>^()[]{}$\,'"
string(1) "'"
string(1) "!"
string(1) "+"
string(1) "_"
string(1) "@"
string(1) "#"
string(1) "&"
string(1) ";"
string(1) "`"
string(1) "|"
(lucid-amd64)clint@clint-MacBookPro:~$ php --version
PHP 5.3.2-1ubuntu4.7 with Suhosin-Patch (cli) (built: Jan 12 2011 18:36:55) 
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

It goes a bit deeper though.. there is a workaround for lucid's php:

string(1) "C"
string(26) "!+_£@#&;`|*?~<>^()[]{}$\,"
string(28) "'!+_£@#&;`|*?~<>^()[]{}$\,'"
string(1) "'"
string(1) "!"
string(1) "+"
string(1) "_"
string(1) "�"
string(1) "�"
string(1) "@"
string(1) "#"
string(1) "&"
string(1) ";"
(lucid-amd64)clint@clint-MacBookPro:~$ cat test_pound2.php 
<?php
var_dump(setlocale(LC_CTYPE, NULL));
setlocale(LC_CTYPE, "en_US.UTF-8");
// test script
$before = '!+_£@#&;`|*?~<>^()[]{}$\,';

var_dump($before);

$escaped = escapeshellarg($before);

var_dump($escaped);

for ($i=0; $i < 10; $i++)
{
 var_dump($escaped[$i]);
}

?>

This shows that the language was C (because I was in a minimal chroot
probably). I installed langauge-pack-en and then this script started
showing the pound symbol properly. So the real issue is making sure your
locale is set to UTF-8. This is the exact suggestion of the first
comment on http://us3.php.net/escapeshellarg

Given all of this, I think this isn't a bug that we're going to fix or
even can.. users need to be explicit about their locale if they expect
characters specific to that locale to work.

Marking as Won't Fix.

** Changed in: php5 (Ubuntu)
       Status: New => Won't Fix

-- 
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to php5 in ubuntu.
https://bugs.launchpad.net/bugs/732306

Title:
  php escapeshellarg removes £ incorrectly

-- 
Ubuntu-server-bugs mailing list
Ubuntu-server-bugs@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server-bugs

Reply via email to