Skip to content

Commit aaae9c6

Browse files
committed
Merge branch 'PHP-7.3'
* PHP-7.3: Fix #76510: file_exists() stopped working for phar://
2 parents 034b7ff + b117fee commit aaae9c6

2 files changed

Lines changed: 39 additions & 0 deletions

File tree

acinclude.m4

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1739,6 +1739,42 @@ choke me
17391739
fi
17401740
])
17411741

1742+
dnl
1743+
dnl PHP_BROKEN_GCC_STRLEN_OPT
1744+
dnl
1745+
dnl Early releases of GCC 8 shipped with a strlen() optimization bug, so they
1746+
dnl didn't properly handle the `char val[1]` struct hack. See bug #76510.
1747+
dnl
1748+
AC_DEFUN([PHP_BROKEN_GCC_STRLEN_OPT], [
1749+
AC_CACHE_CHECK([for broken gcc optimize-strlen],ac_cv_have_broken_gcc_strlen_opt,[
1750+
AC_RUN_IFELSE([AC_LANG_SOURCE([[
1751+
#include <stdlib.h>
1752+
#include <string.h>
1753+
#include <stdio.h>
1754+
struct s
1755+
{
1756+
int i;
1757+
char c[1];
1758+
};
1759+
int main()
1760+
{
1761+
struct s *s = malloc(sizeof(struct s) + 3);
1762+
s->i = 3;
1763+
strcpy(s->c, "foo");
1764+
return strlen(s->c+1) == 2;
1765+
}
1766+
]])],[
1767+
ac_cv_have_broken_gcc_strlen_opt=yes
1768+
],[
1769+
ac_cv_have_broken_gcc_strlen_opt=no
1770+
],[
1771+
ac_cv_have_broken_gcc_strlen_opt=no
1772+
])])
1773+
if test "$ac_cv_have_broken_gcc_strlen_opt" = "yes"; then
1774+
CFLAGS="$CFLAGS -fno-optimize-strlen"
1775+
fi
1776+
])
1777+
17421778
dnl
17431779
dnl PHP_FOPENCOOKIE
17441780
dnl

configure.ac

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,9 @@ immintrin.h
500500
PHP_FOPENCOOKIE
501501
PHP_BROKEN_GETCWD
502502
PHP_BROKEN_GLIBC_FOPEN_APPEND
503+
if test "$GCC" = "yes"; then
504+
PHP_BROKEN_GCC_STRLEN_OPT
505+
fi
503506

504507
dnl Checks for typedefs, structures, and compiler characteristics.
505508
dnl -------------------------------------------------------------------------

0 commit comments

Comments
 (0)