Bug #77124 [NEW]: FTP with SSL memory leak
From: antoine dot guenard+php at gmail dot com
Operating system: Debian GNU/Linux 9 (stretch)
PHP version: 7.2.12
Package: FTP related
Bug Type: Bug
Bug description:FTP with SSL memory leak
Description:
------------
Tested on PHP 7.2.10, there might be memory leak while using ftp_login
function and maybe other functions with FTPS (FTP over SSL).
To reproduce the memory leak, you should open a connection to a FTP
server with SSL and then try to login with ftp_login. The test script
uses a public FTP that supports SSL for testing but I could reproduce
with other FTP servers with valid or invalid credentials.
I also provided another test script (for Unix/Linux) that uses an
infinite loop to have a better view of the memory increasing at every
turn just after ftp_login is called, see:
https://gist.githubusercontent.com/guenard/6fca07e5c99f959de42dbed67628acf9/raw/b1c97d732a3e8acf249cf415e067b7f0e94075ae/lopp-ftp-with-ssl-login-memory-leak.php
The closest issue I found was https://bugs.php.net/bug.php?id=65228 but
it looks like the patch has made it from PHP 5.5.x to PHP 7.2.x.
Test script:
---------------
<?php
$conn = @ftp_ssl_connect('test.rebex.net', 21);
@ftp_login($conn, '', '');
@ftp_close($conn);
Expected result:
----------------
No memory leak.
Actual result:
--------------
==9752== LEAK SUMMARY:
==9752== definitely lost: 947 bytes in 6 blocks
==9752== indirectly lost: 15,057 bytes in 219 blocks
==9752== possibly lost: 0 bytes in 0 blocks
==9752== still reachable: 4,267 bytes in 26 blocks
==9752== suppressed: 0 bytes in 0 blocks
--
Edit bug report at https://bugs.php.net/bug.php?id=77124&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77124&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77124&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77124&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=77124&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=77124&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=77124&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=77124&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=77124&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=77124&r=support
Expected behavior: https://bugs.php.net/fix.php?id=77124&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=77124&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=77124&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=77124&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77124&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=77124&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=77124&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=77124&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=77124&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=77124&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=77124&r=mysqlcfg
Thread (4 messages)
- antoine dot guenard+php at gmail dot com