Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

php 7.1.3 gettype(-1) returns "double" instead of "integer" when built with clang #890

Closed
vdb opened this issue Mar 31, 2017 · 16 comments
Closed
Labels
bug report Something is not working properly help wanted Help is wanted in order to solve the issue php Issue is about PHP related stuff

Comments

@vdb
Copy link

vdb commented Mar 31, 2017

Android package php 7.1.3. Command php -r "echo gettype(-1);" returns ''double", should be "integer". This breaks programs that rely on correct type value. I've checked php7.1.3 amd64 package on ubuntu and return value is "integer" as expected.

@vishalbiswas
Copy link
Contributor

For me, it returns integer as expected

@Grimler91
Copy link
Member

It works as expected on my arm device. Which arch are you using?

@vdb
Copy link
Author

vdb commented Mar 31, 2017

uname -a:
Linux localhost 3.18.20-ge45c102 #1 SMP PREEMT aarch64 Android

@vdb
Copy link
Author

vdb commented Mar 31, 2017

CPU: Qualcomm Snapdragon 430 MSM8937

@mawatech
Copy link
Contributor

Same for me:

$ uname -a
Linux localhost 3.18.19+ #1 SMP PREEMPT Tue Dec 6 15:46:33 CST 2016 aarch64 Android
$ php -r "echo gettype(-1);"
double$
$

@fornwall
Copy link
Member

Hm, so it seems to be a problem at least for 64-bit arm, and working on 32-bit arm.

@fornwall fornwall added bug report Something is not working properly help wanted Help is wanted in order to solve the issue labels Mar 31, 2017
@Neo-Oli
Copy link
Member

Neo-Oli commented May 11, 2017

That's really annoying. It means that functions like substr($str,-1); don't work, which breaks a hell of a lot of programs.

@Neo-Oli
Copy link
Member

Neo-Oli commented May 11, 2017

I tried running Ubuntu on aarch64 (using proot on termux) with version 7.0.15 and it works as expected returning integer. I compiled the same version of php for termux and the issue remains. So either it's a termux specific issue or debian/ubuntu have a fix in their arm64 package.

@its-pointless
Copy link
Contributor

its-pointless commented May 11, 2017

compiling with gcc fixes this on arm64
as in build.sh add line TERMUX_PKG_CLANG=no

@Neo-Oli
Copy link
Member

Neo-Oli commented May 12, 2017

I tried building it with gcc, and it does indeed fix the problem.

@its-pointless
Copy link
Contributor

The tricky bit now is getting a test case or something so the ndk guys can fix it.
https://github.com/android-ndk/ndk etc ...

@fornwall
Copy link
Member

Wow, building with clang causes this? Interesting!

@fornwall
Copy link
Member

The 7.1.5 update of the php package is built with gcc and should have the problem fixed.

We still need to find the reason why the problem occurs when built with clang as gcc is planned to be removed from the NDK, but we can build with gcc for now to have a working package, and await further updated PHP and NDK versions to see if they fix the problem.

@fornwall fornwall changed the title php 7.1.3 gettype(-1) returns "double" instead of "integer" php 7.1.3 gettype(-1) returns "double" instead of "integer" when built with clang May 13, 2017
@Neo-Oli Neo-Oli added the php Issue is about PHP related stuff label Jun 8, 2017
@fornwall
Copy link
Member

Just tried again with PHP v7.1.6 and clang from NDK r15 - still same problem.

@its-pointless
Copy link
Contributor

Time to post issue on ndk ?

@fornwall
Copy link
Member

This turned out to be a bug in php (inline aarch64 assembly) fixed in php/php-src@8c86792.

This fix has been backported to the newly released 7.1.7 version of the php package, which is now built with clang.

nikic referenced this issue in php/php-src Dec 1, 2017
Register operands are required in this context.
@ghost ghost locked and limited conversation to collaborators Oct 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug report Something is not working properly help wanted Help is wanted in order to solve the issue php Issue is about PHP related stuff
Projects
None yet
Development

No branches or pull requests

7 participants