php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69020 Possible memory corruption on file error messages
Submitted: 2015-02-09 22:26 UTC Modified: 2015-02-17 17:57 UTC
From: php at maisqi dot com Assigned: ab (profile)
Status: Closed Package: Filesystem function related
PHP Version: 5.6.5 OS: Windows 8.1
Private report: No CVE-ID: None
 [2015-02-09 22:26 UTC] php at maisqi dot com
Description:
------------
If I try to handle a file whose name is ISO-8859-1 (on a NTFS file system), and force some error, the error message is printed with some unexpected chars, besides those that are to be expected when we cross different character encodings.

I tested this on PHP5.5 and it worked ok. PHP 5.6, 32 bits or 64 bits, print the strange chars and crashed a few times. I can't test this on Linux for now.

Test script:
---------------
file_get_contents (utf8_decode ('Z:/Voláção'));
echo '<br />';
trigger_error(utf8_decode ('Z:/Voláção'), E_USER_WARNING);
trigger_error(utf8_decode ('Z:/Voláção'), E_USER_WARNING);

/**
 * Note: I repeated the trigger_error() solely to prove that the output
 * is not random.
 */

Expected result:
----------------
The script should emit three very similar error messages.

Actual result:
--------------
This is what I get on my system:

  Warning: <`d��� : failed to open stream: No such file or directory [...]
  Warning: Z:/Vol���o in D:\Apache\exp\web\exp.php on line 22
  Warning: Z:/Vol���o in D:\Apache\exp\web\exp.php on line 23


The «garbage» chars are quite different in the first message. I suspect this is due to some memory corruption bug. In fact, this simple script crashes once in a while (at least on my system).

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-02-11 14:30 UTC] ab@php.net
-Status: Open +Status: Feedback
 [2015-02-11 14:30 UTC] ab@php.net
Please post a backtrace. Though, it sounds very similar to what was recently fixed in bug #68996. Maybe you also could check some latest snapshot.

Thanks.
 [2015-02-11 16:19 UTC] php at maisqi dot com
-Status: Feedback +Status: Open
 [2015-02-11 16:19 UTC] php at maisqi dot com
I'm sorry, but I'll need some help doing that. Any pointers will be greatly appreciated.
Regarding the snapshots, I'll have to compile it myself, right? I'm using the Windows version...
 [2015-02-11 17:37 UTC] ab@php.net
-Status: Open +Status: Feedback
 [2015-02-11 17:37 UTC] ab@php.net
No, you don't have to build yourself, just fetch some latest from here http://windows.php.net/downloads/snaps/php-5.6/ (also there's a snapshot page on windows.php.net).

If you've found that's not fixed in the latest, please check this page for the backtrace howto https://bugs.php.net/bugs-generating-backtrace-win32.php .

Thanks.
 [2015-02-12 21:25 UTC] php at maisqi dot com
-Status: Feedback +Status: Open
 [2015-02-12 21:25 UTC] php at maisqi dot com
Just tested with the latest snapshot and it seems fixed. Thanks for your help, ab@php.net.
 [2015-02-17 17:57 UTC] ab@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: ab
 [2015-02-17 17:57 UTC] ab@php.net
Thanks for the update. Marking as fixed now, expect an update in one of the next releases.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Nov 25 09:01:30 2024 UTC