[wp-trac] [WordPress Trac] #41498: Why are global functions not wrapped in function_exists?

WordPress Trac noreply at wordpress.org
Fri Jan 18 17:31:49 UTC 2019


#41498: Why are global functions not wrapped in function_exists?
-----------------------------+------------------------------
 Reporter:  doecode          |       Owner:  (none)
     Type:  feature request  |      Status:  new
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  I18N             |     Version:
 Severity:  normal           |  Resolution:
 Keywords:                   |     Focuses:
-----------------------------+------------------------------

Comment (by jonasemde):

 ''Shouldn't Laravel wrap it in function_exists() as well?''

 They do this already for all global helper functions included "__()":
 https://github.com/laravel/framework/blob/5.7/src/Illuminate/Foundation/helpers.php

 In cases, Laravel is loaded before WordPress inside a composer project an
 exception is thrown by WordPress.

 A  function_exists() wrap should solve this issue and not cause any issues
 on existing sites. Developers are more flexible with this approach.

 The same is true for other integrations like:
 https://modernmodules.com/plugins/magento-2-wordpress-integration-plugin/

 To get this plugin to work you need to hack the /wp-includes/l10n.php file
 as well. This could be handled a lot cleaner if a function_exists() check
 is performed.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/41498#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list