[horde] singleton() and ftp_get() conflict?

Espen Jürgensen olfert at hhkol.dk
Mon Sep 16 08:18:44 PDT 2002


Hi Horde people,

For some reason singleton() and PHP's ftp_get() seem to conflict, making it impossible to for me to use ftp_get in the Horde add-on I'm writing. I use the latest release of Horde (2.1), and PHP is 4.1.2.

The bug (or at least, that's what I think it is) is quite easy to reproduce if you have access to a FTP-server. Just put the following code in a .php in a directory belonging to some Horde-app, adjust host-name, user and password, and then run the code a couple of times. You will find that after 1 or 2 reloads the php 'freezes', and that it won't log out of the ftp-server until timeout.

<?php
// Find the base file path of Horde
@define('HORDE_BASE', dirname(__FILE__) . '/..');

// Registry
require_once HORDE_BASE . '/lib/Registry.php';
$registry = &Registry::singleton();

$host = 'localhost'; $port = 21;
$user = ''; $pass = '';
$src= ".forward"; $dst = "/tmp/forwardftp";
$mode = FTP_ASCII;

$ftpConnection = ftp_connect($host, $port);
ftp_login($ftpConnection, $user, $pass);
ftp_get($ftpConnection, $dst, $src, $mode);
ftp_quit($ftpConnection);

echo "Transfer complete";
?>

If you remove singleton(), everything is sweet... and even if you just do ftp_put instead of ftp_get, it will work.

Anybody know of a fix og a possible work-around? I couldn't find anything in the bug database nor in the maillist archives.

Regards,
Espen


More information about the horde mailing list