ID:               42629
 Updated by:       [EMAIL PROTECTED]
 Reported By:      jdolecek at NetBSD dot org
 Status:           Assigned
 Bug Type:         Dynamic loading
 Operating System: Mac OS X 10.4.10
 PHP Version:      5.2.4
 Assigned To:      kalowsky
 New Comment:

See also bug #42630


Previous Comments:
------------------------------------------------------------------------

[2007-09-13 10:12:07] [EMAIL PROTECTED]

Assigned to our MacOSX expert. :)

------------------------------------------------------------------------

[2007-09-12 16:45:22] [EMAIL PROTECTED]

When this code was originally written, PDO didn't exist and as such the
choice to use the PRIVATE option was made to keep the namespace the
least polluted possible.  Having not tested the patch, the changes make
sense and probably should be applied provided they don't cause any
adverse affects to other files included.

------------------------------------------------------------------------

[2007-09-11 20:05:20] jdolecek at NetBSD dot org

Description:
------------
Some PHP extensions expect to have symbols from other PHP extensions
available. This is the case for PDO drivers (which use symbols from PDO
extension) and XSL (which uses symbols from DOM extension).

Extensions are loaded with dlopen(..., RTLD_GLOBAL) on platforms with
dlopen() (i.e. most unices). On Mac OS X, NSLinkModule() is used instead
of dlopen(), but with 'private' option, which hides symbols of
dynamically loaded extensions from other dynamically loaded code.

Due to this symbol hiding, PDO and DOM needed to be compiled into base
PHP binary, otherwise the dependant extension couldn't be dynamically
loaded since expected symbols are not found. PDO configure script even
intentionally silently disables compilation of dynamically loaded PDO
module on MacOSX/Darwin because of this.

Following patch makes it possible to load also PDO and DOM dynamically
on Mac OS X and thus PHP extensions work all the same way as on other
UNIX systems:

--- Zend/zend_extensions.c.orig 2007-09-11 22:00:50.000000000 +0200
+++ Zend/zend_extensions.c
@@ -243,7 +243,7 @@ void *zend_mh_bundle_load(char* bundle_p
                return NULL;
        }

-       bundle_handle = NSLinkModule(bundle_image, bundle_path,
NSLINKMODULE_OPTION_PRIVATE);
+       bundle_handle = NSLinkModule(bundle_image, bundle_path,
NSLINKMODULE_OPTION_NONE);
        NSDestroyObjectFileImage(bundle_image);

        /* call the init function of the bundle */








Reproduce code:
---------------
Compile PDO (after fix to configure script) as dynamic extensions, as
well as pdo_mysq, and add into php.ini lines:

extension=pdo.so
extension=pdo_mysql.so

then run:

php -m | grep -i pdo

Expected result:
----------------
PDO
pdo_mysql


Actual result:
--------------
dyld: lazy symbol binding failed: Symbol not found:
_php_pdo_declare_long_constant
  Referenced from: /Users/Shared/pkg/lib/php/20040412/pdo_mysql.so
  Expected in: flat namespace

dyld: Symbol not found: _php_pdo_declare_long_constant
  Referenced from: /Users/Shared/pkg/lib/php/20040412/pdo_mysql.so
  Expected in: flat namespace

Trace/BPT trap



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=42629&edit=1

Reply via email to