php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61827 incorrect \e processing on Windows
Submitted: 2012-04-23 15:35 UTC Modified: 2014-07-09 02:56 UTC
From: ab@php.net Assigned: felipe (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5.4.0 OS: windows
Private report: No CVE-ID: None
 [2012-04-23 15:35 UTC] ab@php.net
Description:
------------
Zend\tests\bug60350.phpt fails on windows. Simple reproduce case

> Debug_TS\php -r "$str = \"\e\"; var_dump(ord($str));"
int(101)

where it should be 27

The implementation in bug 60350 seems to be not compatible with windows, consider the following snippet

==========================================
#include <stdio.h>

int main(void)
{
    printf("'%d' '%c' '%d'\n", (int)'\e', (char)27, (int)(char)27);

    return 0;
}
==========================================

compiled on linux it gives

'27' ' '27'

compiled on windows 

'101' '←' '27'

The current implementation uses '\e' for escaping, which should be (char)27 on windows.


Patches

60350.diff (last revision 2012-04-23 15:35 UTC by ab)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-04-23 16:35 UTC] ab@php.net
Btw. compiling that snippet on windows there is an interesting line in the compiler out:

>cl esc.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86
Copyright (C) Microsoft Corporation.  All rights reserved.

esc.c
esc.c(5) : warning C4129: 'e' : unrecognized character escape sequence
Microsoft (R) Incremental Linker Version 10.00.40219.01
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:esc.exe
esc.obj
 [2012-04-26 14:56 UTC] ab@php.net
As a variation VK_ESCAPE or 0x1b could be used to represent \e on windows, which is equivalent to (char)27
 [2012-04-26 14:56 UTC] ab@php.net
-Assigned To: +Assigned To: pajoye
 [2012-04-29 22:37 UTC] felipe@php.net
Automatic comment on behalf of felipensp@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=cc5b995c78038b92317b38356c9009ff80850d8b
Log: - Fixed bug #61827 (incorrect \e processing on Windows) patch by: ab@php.net
 [2012-04-29 22:38 UTC] felipe@php.net
-Summary: incorrect \e processing +Summary: incorrect \e processing on Windows -Status: Assigned +Status: Closed
 [2012-04-29 22:38 UTC] felipe@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 [2012-04-30 05:24 UTC] pajoye@php.net
-Status: Closed +Status: Assigned -Assigned To: pajoye +Assigned To: felipe
 [2012-04-30 05:24 UTC] pajoye@php.net
hi Felipe!

Please use VK_ESCAPE instead.

Thanks!
 [2012-05-02 09:16 UTC] ab@php.net
-Status: Assigned +Status: Closed
 [2014-07-08 17:51 UTC] abanarn at gmail dot com
Recently, I have been working on upgrading my php5.3 in my Windows servers. I have noticed that some of the includes are failing because the path name has \e for example : C:\epo\example.php and it thinks that "\e" is an escape code for ESC.

No issues in <= php-5.4.3

In php >= 5.4.4 I received the below:

Warning: require(C:←po\example.php): failed to open stream: In
valid argument in C:\php\db_connection.php on line 20

Fatal error: require(): Failed opening required 'C:←po\example.php'
 [2014-07-09 02:56 UTC] yohgaki@php.net
abanarn 
It would be better to open new report. Please do it with details.
 [2014-10-07 23:26 UTC] stas@php.net
Automatic comment on behalf of felipensp@gmail.com
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=cc5b995c78038b92317b38356c9009ff80850d8b
Log: - Fixed bug #61827 (incorrect \e processing on Windows) patch by: ab@php.net
 [2014-10-07 23:37 UTC] stas@php.net
Automatic comment on behalf of felipensp@gmail.com
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=cc5b995c78038b92317b38356c9009ff80850d8b
Log: - Fixed bug #61827 (incorrect \e processing on Windows) patch by: ab@php.net
 [2015-01-15 17:17 UTC] vrana@php.net
Automatic comment from SVN on behalf of vrana
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=335758
Log: Fix version of \e (was not available on Windows before, see bug #61827)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 09:01:32 2024 UTC