|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #55172 Compile fails on sprintf.lo
Submitted: 2011-07-10 21:16 UTC Modified: 2021-06-20 04:22 UTC
Avg. Score:4.7 ± 0.5
Reproduced:6 of 6 (100.0%)
Same Version:3 (50.0%)
Same OS:4 (66.7%)
From: josh at joshbutts dot com Assigned: cmb (profile)
Status: No Feedback Package: Compile Failure
PHP Version: 5.3.6 OS: MacOS 10.7
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: josh at joshbutts dot com
New email:
PHP Version: OS:


 [2011-07-10 21:16 UTC] josh at joshbutts dot com
When downloading the source tarball for 5.3.6, a vanilla ./configure followed by a make fails. 

gcc info:

Expected result:
No error

Actual result:
/Users/josh/php-5.3.6/main/spprintf.c:186: error: static declaration of ‘strnlen’ follows non-static declaration
/usr/include/string.h:143: error: previous declaration of ‘strnlen’ was here
make: *** [main/spprintf.lo] Error 1


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-07-10 23:02 UTC] josh at joshbutts dot com
Wonder if this might be a problem with detecting the presence of strnlen().

Commenting this in main/sprintf.c fixes the problem:
static size_t strnlen(const char *s, size_t maxlen) {
	char *r = memchr(s, '\0', maxlen);
	return r ? r-s : maxlen;
 [2011-07-23 19:29 UTC] info at richard5 dot net
Found the same error. However when I used a Mac that had a clean install of OSX 
10.7 aka Lion and Xcode 4.1 I had no problem. 
This error only occurred on an machine that I upgraded to Lion.
 [2021-06-10 12:40 UTC]
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2021-06-10 12:40 UTC]
Is that still an issue with any of the actively supported PHP

[1] <>
 [2021-06-20 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Mar 03 08:01:29 2024 UTC