|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40343 compile with --with-tidy fails
Submitted: 2007-02-03 16:04 UTC Modified: 2007-02-07 03:07 UTC
From: php dot user at jeremy dot smallinfinity dot net Assigned:
Status: Closed Package: Tidy (PECL)
PHP Version: 5.2.0 OS: Mac OS X 10.4.8
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: php dot user at jeremy dot smallinfinity dot net
New email:
PHP Version: OS:


 [2007-02-03 16:04 UTC] php dot user at jeremy dot smallinfinity dot net
RE Bug #36164 which describes the problem perfectly and to which I would have added this comment had I been permitted to:

If I'm not mistaken, the problem is a name clash between main/php_compat.h and /usr/include/tidy/tidy.h and I don't see why it is the tidy developers who are responsible for this.

Specifically, ext/tidy/tidy.c first includes main/php_config.php (via main/php.h -> main/php_compat.h),
which provides the definition

#define ulong unsigned long 

Then ext/tidy/tidy.c includes /usr/include/tidy/platform.h via /usr/include/tidy/tidy.h.  But platform.h has the lines

#if defined(HPUX_OS) || defined(CYGWIN_OS) || defined(MAC_OS) || defined(BSD_BASED_OS) || defined(_WIN32)
typedef unsigned long ulong;

At least for the specified OS's, which includes Mac OS, this combination of the #define in the php.h header with the typedef in the tidy.h header results in the nonsensical "typedef unsigned long unsigned long" which results in the reported (Bug #36164) compilation error.

IMHO, and with all due respect to tony2001, the tidy developers would be well within their rights to assert that they are not responsible for a name clash with PHP, even if the simplest work around is to incorporate a "!defined(ulong) && (...)" in the above excerpt from tidy.h.  Indeed, if PHP is using tidy, and is creating the name clash, is not PHP responsible for this?

Would it be possible to simply rearrange the #include's in tidy.c, so that tidy.h precedes php.h, and also surround the "#define ulong..." in php_config.h with an

#if !defined(__PLATFORM_H__) || !(defined(HPUX_OS) || defined(CYGWIN_OS) || defined(MAC_OS) || defined(BSD_BASED_OS) || defined(_WIN32))

as (I think) this would prevent the name clash?  Or perhaps there is an even better solution?


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-02-06 12:06 UTC]
patch applied to tidy sources. Please checkout tidy from cvs ( and it should work.
 [2007-02-07 03:07 UTC] php dot user at jeremy dot smallinfinity dot net
Yes; it works perfectly!  Thank you.

[Indeed, ext/tidy/tests/004, 6, 8, 10 and 12.phpt now pass instead of failing with incorrect column numbers as they did when I commented out the "typedef" in platform.h.] :)

Thanks again!

-- Jeremy
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Wed Nov 30 11:05:54 2022 UTC