ID: 14781
Updated by: mfischer
Reported By: [EMAIL PROTECTED]
Old Status: Open
Status: Bogus
Bug Type: FTP related
Operating System: Linux Redhat 6.2/7.2
PHP Version: 4.1.1
New Comment:
Your code doesn't watch out for operator precedence:
$foo = function1() || die("i'm dead now");
will evalute to
$foo = ( function1() || die("i'm dead now") );
which means $foo will be true (if function1 succeeded).
For your code this means:
$hFtp = ( ftp_connect ("localhost") || die ("Could not connect.\n") ).
and therefore $hFtp will be boolean true and not your resource/connection id. Proper
parenthesizing will solve this:
( $hFtp = ftp_connect ("localhost") ) || die ("Could not connect.\n");
Previous Comments:
------------------------------------------------------------------------
[2001-12-31 11:30:49] [EMAIL PROTECTED]
I wanted to connect to a ftp server, get some files and insert them into a database.
I started connecting to the ftp server, then logging in and that worked fine. Then I
added a mysql_connect and now I get an error on ftp_login that says that it can not
find ftpbuf.
(tried on two systems: Linux Redhat 6.2, Linux Redhat 7.2).
I'm not sure if this is a failure of ftp functions, mysql, a documentation problem or
me being too stupid.
After dropping all unneccessary code, the file looks like that:
<?php
$hHandle=mysql_connect("localhost", "nobody", "")
or die ("no connection.\n");
mysql_close ($hHandle); #this can be dropped
$hFtp = ftp_connect ("localhost") #this works
|| die ("Could not connect.\n");
# next line results in an error:
$iLoginResult=ftp_login($hFtp, "nobody", "")
|| die ("Error: Unable to login\n");
?>
I got the following error message:
Warning: Unable to find ftpbuf 1 in "scipt" on line "XX",
(which is the ftp_login line (ftp_connect works!)).
If you drop mysql_connect, its working fine...
I'm using build in mysql support (for version 3.23.39), ftp is of course enabled too.
Hopefully this is a stupid question and there is an easy answer...
Thanks in advance and a happy new year,
flim
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=14781&edit=1
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]