|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45636 fileinfo ext duplicate strndup
Submitted: 2008-07-27 07:14 UTC Modified: 2008-08-06 17:51 UTC
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: Fedora at FamilleCollet dot com Assigned:
Status: Closed Package: Compile Failure
PHP Version: 5.3CVS-2008-07-27 (snap) OS: Linux (Fedora 9)
Private report: No CVE-ID: None
 [2008-07-27 07:14 UTC] Fedora at FamilleCollet dot com
Fileinfo extention is now enabled by default but doesn't compile because it use "strndup" with is provided both by the system and the source (softmagic.c)

Source code of softmagic.c contain a test arround is local defined fonction :

char * strndup(const char *, size_t);


But nothing set this macro.
I don't find anything in the .m4 files

Perhaps it should better use the zend_strndup ?

Reproduce code:

Expected result:
Build succed

Actual result:
/home/rpmbuild/BUILD/php5.3-200807270630/ext/fileinfo/libmagic/softmagic.c:305: error: expected identifier or '(' before '__extension__'
/home/rpmbuild/BUILD/php5.3-200807270630/ext/fileinfo/libmagic/softmagic.c:308: error: expected identifier or '(' before '__extension__'
make: *** [ext/fileinfo/libmagic/softmagic.lo] Error 1


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-07-27 09:13 UTC]
Compiles fine for me in Linux. What was the full configure line you used?
 [2008-07-27 15:26 UTC] Fedora at FamilleCollet dot com
First try with --enable-fileinfo=shared
Second try with --enable-fileinfo=shared,/usr

In fact, "file-devel" is installed, which provides and was used by PECL extension Fileinfo 1.0.4.

The bundled extension doesn't seem tu use the system library.

 [2008-07-27 15:30 UTC]
FYI: This extension only compiles with the bundled library. There is no way to use external libmagic anymore.

 [2008-07-27 15:59 UTC] Fedora at FamilleCollet dot com
ok,  thanks for the information about system lib.

So, error occur with bundled lib.
 [2008-07-29 21:03 UTC]
Assigned to the maintainer.
 [2008-08-06 14:43 UTC]
Committed in CVS, could you please verify that it works for you too now?
 [2008-08-06 17:05 UTC] Fedora at FamilleCollet dot com
Check with lastest snapshot (200808061630)

Build ok.

Thanks for the fix.

 [2008-08-06 17:51 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: Sat Apr 01 20:03:35 2023 UTC