Skip to content

Commit 00f1ff1

Browse files
dunglasbon
authored and
bon
committed
fix: handle the GNU specific version of strerror_r
Close phpGH-11882
1 parent 7f2bd59 commit 00f1ff1

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ PHP NEWS
1515
. Fixed bug GH-11854 (DateTime:createFromFormat stopped parsing datetime with
1616
extra space). (nielsdos, Derick)
1717

18+
- Core:
19+
. Fixed strerror_r detection at configuration time. (Kévin Dunglas)
20+
1821
- DOM:
1922
. Fix DOMEntity field getter bugs. (nielsdos)
2023
. Fix incorrect attribute existence check in DOMElement::setAttributeNodeNS.

Zend/zend.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1646,9 +1646,15 @@ ZEND_API ZEND_COLD ZEND_NORETURN void zend_error_noreturn(int type, const char *
16461646

16471647
ZEND_API ZEND_COLD ZEND_NORETURN void zend_strerror_noreturn(int type, int errn, const char *message)
16481648
{
1649-
#ifdef HAVE_STR_ERROR_R
1650-
char buf[1024];
1651-
strerror_r(errn, buf, sizeof(buf));
1649+
#ifdef HAVE_STRERROR_R
1650+
char b[1024];
1651+
1652+
# ifdef STRERROR_R_CHAR_P
1653+
char *buf = strerror_r(errn, b, sizeof(b));
1654+
# else
1655+
strerror_r(errn, b, sizeof(b));
1656+
char *buf = b;
1657+
# endif
16521658
#else
16531659
char *buf = strerror(errn);
16541660
#endif

0 commit comments

Comments
 (0)