php-windows Digest 29 Jul 2013 22:27:56 -0000 Issue 4122

Topics (messages 31070 through 31074):

Re: CLI Crash Bug
        31070 by: Keith Davis
        31071 by: Jan Ehrhardt
        31072 by: Keith Davis
        31073 by: Jan Ehrhardt

php can't resolve 8.3 paths to unicode filenames, is that expected ?
        31074 by: R. S.

Administrivia:

To subscribe to the digest, e-mail:
        php-windows-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-windows-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-wind...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
Jan, this version does not work (crashed.) I'm showing File Version of 1.3.5.0.

Keith Davis - (214) 906-5183


-----Original Message-----
From: Jan Ehrhardt [mailto:php...@ehrhardt.nl]
Sent: Friday, July 26, 2013 12:25 PM
To: php-wind...@lists.php.net
Subject: Re: [PHP-WIN] Re: CLI Crash Bug

Eric Stenson in php.windows (Thu, 25 Jul 2013 18:35:25 +0000):
>I've filed bug https://bugs.php.net/bug.php?id=65338 to track this
>issue.  The root cause of the AV is when more than one module hooks the
>interned strings, a "wrong" value will be left in
>CG(interned_strings_start), which the Zend core thinks contains the
>value that it alloc'd during zend_interned_strings_init().
>
>More details are in the bug.
>
>I've added a potential fix for the Zend folks to consider.  It's
>slightly less harsh than the workaround provided by Jan.  ;)

You fix is a lot more elegant! And I can confirm it works OK. See my comment at 
https://bugs.php.net/bug.php?id=65338

For Keith: could you try the new one at
https://dl.dropboxusercontent.com/u/8954372/php-5.5.1-nts-Win32-VC11-x86.zip

Jan

--
PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: 
http://www.php.net/unsub.php



This message (including any attachments) may contain confidential or otherwise 
privileged information and is intended only for the individual(s) to which it 
is addressed. If you are not the named addressee you should not disseminate, 
distribute or copy this e-mail. Please notify the sender immediately by e-mail 
if you have received this e-mail by mistake and delete this e-mail from your 
system. E-mail transmission cannot be guaranteed to be secured or error-free as 
information could be intercepted, corrupted, lost, destroyed, arrive late or 
incomplete, or contain viruses. The sender therefore does not accept liability 
for any errors or omissions in the contents of this message or that arise as a 
result of e-mail transmission. If verification is required please request a 
hard-copy version from the sender.

www.pridedallas.com



--- End Message ---
--- Begin Message ---
Keith Davis in php.windows (Fri, 26 Jul 2013 13:52:53 -0500):
>Jan, this version does not work (crashed.)

Crashed at startup or on closing? What is the date of php_wincache.dll?
Should be something like 2013-07-26 17:49. Filesize: 131584.

Maybe dropbox did not synchronize yet...

>I'm showing File Version of 1.3.5.0.

Yes, that is the version Eric has put on PECL now.

Jan

--- End Message ---
--- Begin Message ---
Ok, I copied both php5.dll and php_wincache.dll from the ones you compiled, 
Jan, with Eric's patch and it works!

https://dl.dropboxusercontent.com/u/8954372/php-5.5.1-nts-Win32-VC11-x86.zip

Updated both bug reports confirming this as well.



This message (including any attachments) may contain confidential or otherwise 
privileged information and is intended only for the individual(s) to which it 
is addressed. If you are not the named addressee you should not disseminate, 
distribute or copy this e-mail. Please notify the sender immediately by e-mail 
if you have received this e-mail by mistake and delete this e-mail from your 
system. E-mail transmission cannot be guaranteed to be secured or error-free as 
information could be intercepted, corrupted, lost, destroyed, arrive late or 
incomplete, or contain viruses. The sender therefore does not accept liability 
for any errors or omissions in the contents of this message or that arise as a 
result of e-mail transmission. If verification is required please request a 
hard-copy version from the sender.

www.pridedallas.com



--- End Message ---
--- Begin Message ---
Eric Stenson in php.windows (Thu, 25 Jul 2013 18:35:25 +0000):
>I've filed bug https://bugs.php.net/bug.php?id=65338 to track this
>issue.  The root cause of the AV is when more than one module hooks the
>interned strings, a "wrong" value will be left in
>CG(interned_strings_start), which the Zend core thinks contains the
>value that it alloc'd during zend_interned_strings_init().
>
>I've added a potential fix for the Zend folks to consider.  It's
>slightly less harsh than the workaround provided by Jan.  ;)

The problem is so obvious, that I am surprised it did not com to surface
earlier. And the patch is elegant: do not assume interned_strings_start
is still the same, but free only the memory that you owned at startup.

In fact, the patch should be backported to PHP 5.4 as well. I do not
have a use case for X86, but I ran into the same problem woth PHP 5.4
X64. I know this is no official version, but as an illustration of the
problem it still is useful.

Compare these two builds:
https://dl.dropboxusercontent.com/u/8954372/php-5.4.17-nts-Win32-VC9-x64.zip
https://dl.dropboxusercontent.com/u/8954372/php-5.4.17-nts-Win32-VC9-x64_patched.zip

Try the unpatched one first. Put this in your php.ini:

extension=php_wincache.dll
zend_extension=ext/php_opcache.dll

zend_opcache.memory_consumption=128
zend_opcache.interned_strings_buffer=8
zend_opcache.max_accelerated_files=4000
zend_opcache.revalidate_freq=60
zend_opcache.fast_shutdown=1
zend_opcache.enable_cli=1

wincache.ocenabled=0
wincache.fcenabled=0    
wincache.ucachesize=768
wincache.enablecli=1
session.savehandler=wincache

Then run from the commandline in your php-directory:
php-cgi.exe -m

php-cgi will crash after showing the loaded modules. Debugging with VC9
gave this result: http://x32.elijst.nl/zendfree.png
Quite another breakpoint as in the PHP 5.5 example, but with the same
cause: freeing memory you do not own.

In the patched build I backported Eric's patch for zend_string.c to PHP
5.4. Result: no crash anymore.

A last remark: i do not think the problem is Windows specific. This is
exectly the same problem, but with the combination of opcache and apc:
http://svn.php.net/viewvc?view=revision&revision=330859

Jan

--- End Message ---
--- Begin Message ---
The thing is these paths do not have any non ascii chars in them. Old 16b 
win311 apps are perfectly fine with such files, they just can't correctly show 
their name nor create a fresh file with non ascii name. And such behavior I was 
expecting from php.


    <?
    $FS = new \COM('Scripting.FileSystemObject', null, CP_UTF8);
    $FS->CreateTextFile("c:\\Ελλάδα.txt");
    $ShortPath = $FS->GetFile("c:\\Ελλάδα.txt")->ShortPath;
    echo $ShortPath;
    file_get_contents($ShortPath);
    ?>

error:
Warning: file_get_contents(C:\BFEE~1.TXT): failed to open stream: Invalid 
argument in C:\test.php on line 12

I think somewhere down the rabbit hole the function tries to recreate original 
path and then gets confused.

Is there any way around it ? Like creating a handle from a COM object, or a 
separate protocol like in file_get_contents("php://stdin"), or whatever to pass 
it to the fopen() so php won't see the offending name ?


--- End Message ---

Reply via email to