php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74598 unlink ignores stream context
Submitted: 2017-05-15 14:10 UTC Modified: 2017-05-28 04:26 UTC
From: ma at temponizer dot dk Assigned: pollita (profile)
Status: Closed Package: FTP related
PHP Version: 7.0.19 OS: CentOS
Private report: No CVE-ID: None
 [2017-05-15 14:10 UTC] ma at temponizer dot dk
Description:
------------
When using unlink for a FTPS filename with a stream context where verify_peer is set to false, it still tries to verify the certificate.

This results in two warnings
- "SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed"
- "Unable to connect to ftps://servername/path"

Test script:
---------------
$sslContext = stream_context_create(['ssl' => [
  'verify_peer' => false,
  'verify_peer_name' => false
]]);

unlink('ftps://servername/path', $sslContext);


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-05-16 06:57 UTC] ma at temponizer dot dk
-Summary: unlink ignores verify_peer +Summary: unlink ignores stream context
 [2017-05-16 06:57 UTC] ma at temponizer dot dk
Just tested further and it seems like it ignores the stream context completely.
 [2017-05-16 07:09 UTC] requinix@php.net
-Status: Open +Status: Verified -Package: Filesystem function related +Package: FTP related
 [2017-05-16 07:09 UTC] requinix@php.net
Indeed, it is ignored.
https://github.com/php/php-src/blob/PHP-7.0.19/ext/standard/ftp_fopen_wrapper.c#L911

Same for rename, mkdir, and rmdir. opendir and stat do use it.
 [2017-05-28 04:24 UTC] pollita@php.net
Automatic comment on behalf of pollita
Revision: http://git.php.net/?p=php-src.git;a=commit;h=05849a242a878d5513e3e3be78a0c89fb9fa342b
Log: Bugfix #74598 ftp:// ignores context
 [2017-05-28 04:24 UTC] pollita@php.net
-Status: Verified +Status: Closed
 [2017-05-28 04:26 UTC] pollita@php.net
-Assigned To: +Assigned To: pollita
 [2017-05-28 04:26 UTC] pollita@php.net
Fixed for PHP 7.0.21, 7.1.7, and 7.2.0 by https://github.com/php/php-src/commit/05849a242a878d5513e3e3be78a0c89fb9fa342b
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Oct 13 15:01:29 2024 UTC