|  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: 2011-07-10 23:02 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:
Status: Open Package: Compile Failure
PHP Version: 5.3.6 OS: MacOS 10.7
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [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.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu May 06 04:01:23 2021 UTC