php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48575 Darwin / OS X should use dlopen() et al
Submitted: 2009-06-17 00:53 UTC Modified: 2009-08-06 01:33 UTC
From: php at group dot apple dot com Assigned: scottmac (profile)
Status: Closed Package: Compile Failure
PHP Version: 5.3.0RC3 OS: Mac OS X
Private report: No CVE-ID: None
 [2009-06-17 00:53 UTC] php at group dot apple dot com
Description:
------------
There is a flaw in the logic in the low-level Zend pieces regarding Mac 
OS X's ability to use dlopen() and its cousins. When available, those 
standard APIs should _always_ be used in lieu of the deprecated dyld 
functions.

In effect, the #ifdef logic in zend.h should be reversed to use 
HAVE_MACH_O_DYLD_H only if HAVE_DLFCN_H is undefined. However, that 
change caused confusion elsewhere, so the patch below is a skanky 
workaround without applying broader modifications to the Zend core. 
Ideally, Zend should do the right thing and preferably drop support for 
those old versions of OS X which needed the dyld APIs; that would 
obviate the need for this patch.

I am writing the bug here because zend.com doesn't have a similar 
facility and this appears to be an embedded use of their toolkit.

Reproduce code:
---------------
--- php-5.3.0/acconfig.h	2009-06-10 11:23:33.000000000 -0700
+++ php/acconfig.h	2009-06-16 17:10:25.000000000 -0700
@@ -120,6 +120,15 @@
 #endif
 
 /*
+ * Don't use <mach-o/dyld.h> on Mac OS X / Darwin if dl*() functions are available.
+ * Because this header is processed multiple times during compilation (thanks to lack of
+ * #ifdef protectors), this logic had to move here.
+ */
+#if defined(HAVE_DLFCN_H) && defined(HAVE_MACH_O_DYLD_H)
+#/* This symbol must be allowed to be cleared. */ undef HAVE_MACH_O_DYLD_H
+#endif
+
+/*
  * Local variables:
  * tab-width: 4
  * c-basic-offset: 4
--- php-5.3.0RC3/main/php_config.h.in	2009-06-10 11:23:36.000000000 -0700
+++ php/main/php_config.h.in	2009-06-16 17:10:25.000000000 -0700
@@ -2948,6 +2948,15 @@
 #endif
 
 /*
+ * Don't use <mach-o/dyld.h> on Mac OS X / Darwin if dl*() functions are available.
+ * Because this header is processed multiple times during compilation (thanks to lack of
+ * #ifdef protectors), this logic had to move here.
+ */
+#if defined(HAVE_DLFCN_H) && defined(HAVE_MACH_O_DYLD_H)
+#/* This symbol must be allowed to be cleared. */ undef HAVE_MACH_O_DYLD_H
+#endif
+
+/*
  * Local variables:
  * tab-width: 4
  * c-basic-offset: 4




Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-06-17 01:58 UTC] scottmac@php.net
Do you have any details about what the older versions of OSX are that required the use of the dyld API?

On a sidenote, are you testing this on Snow Leopard? We don't currently have an install of this available to test on, things might be broken there.
 [2009-06-17 07:13 UTC] php at group dot apple dot com
Quoting from:
http://developer.apple.com/documentation/DeveloperTools/Reference/Mach
OReference
/Reference/reference.html

"These [dlopen() et al] are the recommended functions to use to 
interact with 
the dynamic loader. These functions work in Mac OS X v10.3 and v10.4. 
However, 
in Mac OS X v10.4 they are more efficient than other image-loading 
functions. 
These functions are declared in /usr/include/dlfcn.h."

10.3 was released on 24 October 2003; 10.2 was released on 24 August 
2002, so 
dropping support entirely means no longer supporting seven year old 
software.

This applies to both Leopard and Snow Leopard. And it builds just fine 
on Snow 
Leopard. :-)
 [2009-06-18 16:03 UTC] scottmac@php.net
We've got a patch now, will go into PHP 6 and we'll check for 

Is there a technical contact at Apple available for some of our other questions?

We've tried contacting Apple before for help without success and the result was blogged about http://www.macvicar.net/blog/2009/02/apples-relationship-with-php.html


 [2009-08-06 01:33 UTC] svn@php.net
Automatic comment from SVN on behalf of scottmac
Revision: http://svn.php.net/viewvc/?view=revision&revision=286859
Log: Fix bug #48575 - Use dlopen() just like all the other *nixes instead of OSX specific code.
 [2009-08-06 01:33 UTC] scottmac@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 09:01:27 2024 UTC