com php-src: Fix #76510: file_exists() stopped workin g for phar://: NEWS acinclude.m4 configure. ac
| From: | Christoph Michael Becker | Date: | Tue, 11 Sep 2018 10:23:20 +0000 |
| Subject: | com php-src: Fix #76510: file_exists() stopped workin g for phar://: NEWS acinclude.m4 configure. ac | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-103059@lists.php.net to get a copy of this message | ||
Commit: b117feeb2b545b34296f2fc492166d790610fffe
Author: Christoph M. Becker <cmbecker69@gmx.de> Tue, 11 Sep 2018 12:23:20 +0200
Parents: 1bb29a4af22bb11c4257e475c691c3a75b5859a3
Branches: PHP-7.3 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=b117feeb2b545b34296f2fc492166d790610fffe
Log:
Fix #76510: file_exists() stopped working for phar://
We work around a strlen() optimization bug in GCC 8[1] by checking
whether the used GCC exhibits the broken behavior, and if so by
disabling
optimize-strlen.
[1] <https://gcc.gnu..org/bugzilla/show_bug.cgi?id=86914>
Bugs:
https://bugs.php.net/76510
Changed paths:
M NEWS
M acinclude.m4
M configure.ac
Diff:
diff --git a/NEWS b/NEWS
index e85a3ef..0d8c4d6 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,7 @@ PHP NEWS
- Core:
. Fixed bug #76825 (Undefined symbols ___cpuid_count). (Laruence)
. Fixed bug #76820 (Z_COPYABLE invalid definition). (mvdwerve, cmb)
+ . Fixed bug #76510 (file_exists() stopped working for phar://). (cmb)
- intl:
.. Fixed bug #76829 (Incorrect validation of domain on idn_to_utf8()
diff --git a/acinclude.m4 b/acinclude.m4
index 1deb50d..c2ae195 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -1740,6 +1740,42 @@ choke me
])
dnl
+dnl PHP_BROKEN_GCC_STRLEN_OPT
+dnl
+dnl Early releases of GCC 8 shipped with a strlen() optimization bug, so they
+dnl didn't properly handle the char val[1] struct hack. See bug #76510.
+dnl
+AC_DEFUN([PHP_BROKEN_GCC_STRLEN_OPT], [
+ AC_CACHE_CHECK([for broken gcc optimize-strlen],ac_cv_have_broken_gcc_strlen_opt,[
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
+#include <stdlib.h>
+#include <string.h>
+#include <stdio..h>
+struct s
+{
+ int i;
+ char c[1];
+};
+int main()
+{
+ struct s *s = malloc(sizeof(struct s) + 3);
+ s->i = 3;
+ strcpy(s->c, "foo");
+ return strlen(s->c+1) == 2;
+}
+]])],[
+ ac_cv_have_broken_gcc_strlen_opt=yes
+],[
+ ac_cv_have_broken_gcc_strlen_opt=no
+],[
+ ac_cv_have_broken_gcc_strlen_opt=no
+])])
+ if test "$ac_cv_have_broken_gcc_strlen_opt" = "yes"; then
+ CFLAGS="$CFLAGS -fno-optimize-strlen"
+ fi
+])
+
+dnl
dnl PHP_FOPENCOOKIE
dnl
AC_DEFUN([PHP_FOPENCOOKIE], [
diff --git a/configure..ac b/configure.ac
index 78a1878..dafe25e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -503,6 +503,9 @@ immintrin.h
PHP_FOPENCOOKIE
PHP_BROKEN_GETCWD
PHP_BROKEN_GLIBC_FOPEN_APPEND
+if test "$GCC" = "yes"; then
+ PHP_BROKEN_GCC_STRLEN_OPT
+fi
dnl Checks for typedefs, structures, and compiler characteristics.
dnl -------------------------------------------------------------------------