On Mon, Feb 9, 2009 at 2:19 PM, Brad Freshour <bfreshour@xxxxxxxxx> wrote:
> Apache: 2.2.8 threaded
> PHP: 5.2.4-2
> mySQL: 5.051.a
>
> Ubuntu 8.04 minimal with everything needed installed via apt-get.
>
> Using SMF forum, I'm having an issue with the strtr command... Here's
> the code...
>
> $ftp_file = strtr($filename, array ($_SESSION['pack_ftp']['root'] =>''));
>
> The $_SESSION['pack_ftp']['root'] variable is an empty set: ''
>
> Well, if the above strtr command was translated it would look like this:
>
> strtr("/home/user/public_html/Packages/temp", array ('' =>''));
>
> You would think that the return would be : /home/user/public_html/Packages/temp
>
> However, it returns '' instead.
>
> I can get around this by modifying the code to the site manually and
> checking to see if $_SESSION['pack_ftp']['root'] == '' and if it does
> assign it something crazy, like $_SESSION['pack_ftp']['root'] =
> '%%%%%'
>
> However, the code works on another site I have that's hosted for me
> (shared hosting).
>
> Anyone have any ideas?
>
> I was wondering if it was related to this: http://bugs.php.net/bug.php?id=27457
> But that seems like an old bug...
>
> Thanks.
>
>You can run php as a 'BASIC-style' command-line interpreter
>and debug awkward code like this one line at a time.
>
>Just do:
>
>[root@localhost keith]# php -a
>Interactive shell
>
>php > $a= "hello";
>php > echo $a;
>hello
>php >
>
>All the php functions are available in interactive mode.
>That way you get immediate feedback on how your code works :)
>
Keith, thanks... no luck doing it that way either... Can someone else
try the snippet and see what is returned?
php > $a = "/home/user/public_html/Packages/temp";
php > $b = array('' => '');
php > echo strtr($a, $b);
php > echo $a;
/home/user/public_html/Packages/temp
php > print_r($b);
Array
(
[] =>
)
[Index of Archives]
[PHP Users]
[PHP Home]
[PHP on Windows]
[Kernel Newbies]
[PHP Classes]
[Postgresql]
[PHP Books]
[PHP Databases]
[PHP SOAP]