php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50243 Second attempt after successful file_put_contents to FTP causes crash
Submitted: 2009-11-20 14:32 UTC Modified: 2009-11-21 00:53 UTC
From: pontus dot alexander at gmail dot com Assigned: pierrick (profile)
Status: Not a bug Package: Reproducible crash
PHP Version: php5.3-200911202330 OS: Debian
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: pontus dot alexander at gmail dot com
New email:
PHP Version: OS:

 

 [2009-11-20 14:32 UTC] pontus dot alexander at gmail dot com
Description:
------------
After one successful write to FTP via file_put_contents (or fopen, fwrite, fclose) the next attempt causes PHP to die with message "Segmentation fault".

Reproduce code:
---------------
<?

$location = "ftp://foo:bar@domain.com/";

$unique = uniqid();

$items = array(
	'foo',
	'bar'
);

$i = 0;
foreach($items as $content) {
	$filename = $location . sprintf("File_%s_%03u.txt", $unique, $i++);
	file_put_contents($filename, $content); // Crash on _second_ successful iteration
}

Expected result:
----------------
Two files placed on FTP-server successfully containing foo and bar respectively.

Actual result:
--------------
First file writes fine. At second iteration file_put_contents causes PHP to die.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-11-20 17:22 UTC] pierrick@php.net
Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2009-11-20 17:53 UTC] rasmus@php.net
I tested this on an Ubuntu box and was unable to reproduce the crash.  And under Valgrind it didn't report anything suspicious either.

I assume this is without curlwrappers enabled?  Please list all your compile flags.
 [2009-11-20 18:45 UTC] pierrick@php.net
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.


 [2009-11-21 00:32 UTC] pontus dot alexander at gmail dot com
I can reproduce the crash in the recently announced 5.3.1 release. 

Here's my configure-string copied from phpinfo();

'./configure' '--with-config-file-path=/etc/php' '--with-gd' '--enable-inline-optimization' '--with-curl' '--with-gettext' '--with-iconv' '--with-openssl' '--enable-xml' '--with-pcre-regex' '--with-zlib' '--enable-exif' '--enable-magic-quotes' '--enable-sockets' '--with-mysql' '--with-jpeg-dir=/usr/lib/' '--with-mysqli' '--enable-mbstring' '--enable-zend-multibyte'
 [2009-11-21 00:34 UTC] rasmus@php.net
How about a gdb backtrace of the segfault then since I can't reproduce it here on a very similar OS with the same code and the same compile flags.
 [2009-11-21 00:40 UTC] felipe@php.net
5.3.1 doesn't have a fix for #49936, but it's present in 5.3-SVN.

Have you tested it with a 5.3 snapshot?
 [2009-11-21 00:42 UTC] pontus dot alexander at gmail dot com
Thought I should add. I've been able to reproduce this bug on three machines since version 5.3. All of them are running Debian Lenny and have the exact same configure-string as the one supplied in my earlier comment.

Unfortunately I haven't been able to have anyone else test it on a non-similar system.
 [2009-11-21 00:53 UTC] pontus dot alexander at gmail dot com
Can no longer reproduce in php5.3-200911202330

Expected result achieved.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 04:01:38 2024 UTC