|  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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
42 + 1 = ?
Subscribe to this entry?

 [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: Mon Feb 26 09:01:26 2024 UTC