[PHP-BUG] Bug #74293 [NEW]: Order of extensions loaded in php.ini affects function calls

[email protected] ("yukiw at simba dot com")
Newsgroups php.bugs
Message-ID <[email protected]>
From:             yukiw at simba dot com
Operating system: Darwin
PHP version:      7.1.3
Package:          Dynamic loading
Bug Type:         Bug
Bug description:Order of extensions loaded in php.ini affects function calls

Description:
------------
This only happens in Mac (I've tested it on Sierra and Al Capital, but
I'm not sure if older Mac OS versions have this problem. But Windows and
Linux (Ubuntu and CentOS) don't seem to have this problem.

I have two extensions and they have a few common function names. When I
use these extensions in Windows or Linux, the order in which I put them
in php.ini doesn't matter. However, when I use the extensions on Mac,
the function that is in the first loaded extension is always called. For
example, I have extension A and B. When I'm using API's from B, I would
expect the function in B to be called. However, if I loaded A before B
in php.ini, the function of the same name in A is called.

For now I have managed to have a workaround for it by changing the
function names / putting them into their own namespace. However, I am
concerned that what if some other extension that's not created by me
also have the same function names as the ones in my extensions and some
user load that extension before mine.

Expected result:
----------------
I expect to see the order of which I load the extensions do not affect
which function of the common name is called.

Actual result:
--------------
The function of the extension that is loaded first is executed.

-- 
Edit bug report at https://bugs.php.net/bug.php?id=74293&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=74293&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=74293&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=74293&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=74293&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=74293&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=74293&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=74293&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=74293&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=74293&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=74293&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=74293&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=74293&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=74293&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74293&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=74293&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=74293&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=74293&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=74293&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=74293&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=74293&r=mysqlcfg
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.