|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47831 Compile warning for strnlen() in main/spprintf.c (missing #define _GNU_SOURCE)
Submitted: 2009-03-29 20:00 UTC Modified: 2009-03-30 19:59 UTC
From: rainer dot jung at kippdata dot de Assigned:
Status: Closed Package: Compile Warning
PHP Version: 5.2.9 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: rainer dot jung at kippdata dot de
New email:
PHP Version: OS:


 [2009-03-29 20:00 UTC] rainer dot jung at kippdata dot de
PHP 5.2.9 does auto detection for strnlen(). On Linux the detection results in strnlen() availability.

The function is only available, when _GNU_SOURCE is defined though. File main/spprintf.c uses it without _GNU_SOURCE in PHP 5.2.9.

This is due to an incomplete backport from MAIN and 5.3.


and compare with


--- main/spprintf.c      2009-02-04 16:03:12.000000000 +0100
+++ main/spprintf.c      2009-03-29 21:58:10.000000000 +0200
@@ -76,6 +76,7 @@
  * SIO stdio-replacement strx_* functions by Panos Tsirigotis
  * <> for xinetd.
+#define _GNU_SOURCE
 #include "php.h"

 #include <stddef.h>


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-03-30 19:59 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Tue Dec 05 09:01:27 2023 UTC