php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #45215 php_gmp.dll uses exotic instructions
Submitted: 2008-06-09 14:29 UTC Modified: 2008-07-02 01:00 UTC
From: shaunspiller at gmail dot com Assigned:
Status: No Feedback Package: Documentation problem
PHP Version: 5.2.6 OS: Win32
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2008-06-09 14:29 UTC] shaunspiller at gmail dot com
Description:
------------
I'm using the latest precompiled Win32 binaries of PHP-5.2.6 (and have also tried PHP-5.1.6) and get a program crash with an #Undefined Opcode exception when loading php_gmp.dll.

I know what the problem is and I'm not sure if one would consider it a bug or not since it will only happen on very old machines, but I can't believe I'm the first person to have ever encountered this.

The instruction in php_gmp.dll which causes the crash is CMOVZ EDX, EAX. The conditional move instructions were only added with the Pentium Pro. Tough luck for me -- my computer literally blew up last week and I'm stuck temporarally with a Pentium MMX and a K6 laptop, neither of which support CMOVcc.

It's understandable that compiling for P6+ instructions might be a good tradeoff between performance and compatibility, but current versions of PHP are *stated* to work with even Windows 98 and up, and so are the precompiled binaries (other extensions seem to work just fine). I don't know how much CMOVcc is relied on in php_gmp.dll, and changing the build options to use generic I386+ might be undesirable, but the P6 instruction set requirement should at least be *mentioned* somewhere, and it isn't (not that I found).

Disappointing for me in either case, because recompiling the DLL is a little beyond what I can do on this old system right now. I would normally have just used BCMath instead, but I need the base-conversion stuff, which that doesn't have.

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

dl('php_gmp.dll');

echo 'hi!';

?>

Expected result:
----------------
hi!

Actual result:
--------------
Instant program crash. Windows provides the following info:

PHP executed an invalid instruction in
module PHP_GMP.DLL at 0187:01a760f4.
Registers:
EAX=01a7ced0 CS=0187 EIP=01a760f4 EFLGS=00010202
EBX=01a710e0 SS=018f ESP=00d3f904 EBP=01989c20
ECX=01a710c0 DS=018f ESI=0000001a FS=12c7
EDX=01a710b0 ES=018f EDI=01370ae0 GS=0000
Bytes at CS:EIP:
0f 44 d0 b8 60 cf a7 01 85 c9 0f 44 c8 85 db b8 
Stack dump:
1001a380 01a710a4 01a710b0 01a710c0 01a710e0 01a8c2f0 0000000c 01a76120 00000003 0000001a 01370ae0 01a8c2fc 00000013 00000002 00000003 0000001a 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-06-09 14:51 UTC] pajoye@php.net
"I'm using the latest precompiled Win32 binaries of PHP-5.2.6 (and have
also tried PHP-5.1.6) and get a program crash with an #Undefined Opcode
exception when loading php_gmp.dll."

Do you mean that you get the same issue with 5.1.6? I think yes as the gmp library has not been changed since 5.1.6.

About win9x support, which OS do you use? You may know that we plan to drop win9x support for 5.3+, only 2k+ will be supported.

About i386 support, especially with GMP there is a real improvement by using 686+, see the gmp website for a detailed list.

And finally good point about the documentation, we should document it asap.
 [2008-06-09 15:23 UTC] shaunspiller at gmail dot com
Thanks for the feedback. I can understand it's not reasonable to degrade the GMP binaries for such old systems. Documenting it would have saved me a lot of confusion though.

Yes I'm using Windows 98 SE at the moment, although hope to be back on Windows 2003 soon. Exactly the same problem with PHP versions 5.2.6 and 5.1.6.

Ideally, perhaps the GMP module should check on load to see if 686+ instructions are supported, and if not, fail to load gracefully by returning an error message to PHP, rather than just crashing the whole program. Is that possible?
 [2008-06-09 20:43 UTC] bjori@php.net
Reclassifying as documentation problem.
As of PHP 5.3.0 Windows9x support has been dropped.
 [2008-06-24 19:14 UTC] danbrown@php.net
I've updated the Windows part of the Installation section, but the original report mentions using 5.2.6 and 5.1.6, not PHP >= 5.3.0.
 [2008-07-02 01:00 UTC] doc-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 23:01:34 2024 UTC