From: support at vikoshosting dot com Operating system: Linux Kernel version 2.6.9-42.0. PHP version: 5CVS-2007-01-24 (snap) PHP Bug Type: Filesystem function related Bug description: Bad File Descriptor, Please help me
Description: ------------ When I create a file using the FOPEN function and then try to change permissions on the file it says it cant be done because Bad File Descriptors. PHP version 5.1.6 Reproduce code: --------------- $conn_id = chmod_open(); $ourFileName = "testFile.txt"; $ourFileHandle = fopen($ourFileName, 'w') or die("can't open file"); fclose($ourFileHandle); function chmod_open() { // Use your own FTP info $ftp_user_name = 'vikoshos'; $ftp_user_pass = 'frath0pr'; $ftp_root = '/'; $ftp_server = 'localhost'; $conn_id = ftp_connect($ftp_server); $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); return $conn_id; } function chmod_file($conn_id, $permissions, $ftpath) { echo "$ftpath"; if (ftp_site($conn_id, 'CHMOD ' . $permissions . ' ' . $ftp_root . $ftpath) !== false) { return TRUE; } else { return FALSE; } } chmod_file($conn_id, 0777, $ourFileName); Expected result: ---------------- Change the file mod to 777 Actual result: -------------- Warning: ftp_site() [function.ftp-site]: Could not change perms on newfile.txt: Bad file descriptor in code.php on line 168 -- Edit bug report at http://bugs.php.net/?id=40214&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=40214&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=40214&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=40214&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=40214&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=40214&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=40214&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=40214&r=needscript Try newer version: http://bugs.php.net/fix.php?id=40214&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=40214&r=support Expected behavior: http://bugs.php.net/fix.php?id=40214&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=40214&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=40214&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=40214&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40214&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=40214&r=dst IIS Stability: http://bugs.php.net/fix.php?id=40214&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=40214&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=40214&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=40214&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=40214&r=mysqlcfg