[wp-trac] [WordPress Trac] #33112: Suppress calls to ini_set in core

WordPress Trac noreply at wordpress.org
Fri Jul 24 15:49:17 UTC 2015


#33112: Suppress calls to ini_set in core
--------------------------+------------------------------
 Reporter:  mdwheele      |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  General       |     Version:  trunk
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by mdwheele):

 That's definitely reasonable as well. It depends on what core suggests.
 Since they have been using suppression operator for this exact use-case,
 33112.1.patch follows this convention.

 However, for completeness, do note that any function that is made a part
 of `/etc/php.ini#disable_functions` is still "callable", it will just
 result in a warning. Therefore, the following type of check would need to
 be put in place for all affected locations:

 {{{
 if( false === strpos(ini_get("disable_functions"), "ini_set") ) {  //
 Meaning that "ini_set" was NOT found in the disable functions list.
 }
 }}}

 The biggest wrench in this is that just as many shared hosts disable
 `ini_set`, they also disable `ini_get`.

 Unless there is some other way of doing this, I think suppression operator
 (while definitely a bad practice for other use-cases) may be an acceptable
 solution here.

 In PHP7, we will have the ability to catch PHP Warnings as exceptions and
 deal with this kind of thing in more interesting ways, but I almost
 hesitated even typing that out here as it doesn't really matter because
 BC.

 Thanks for the comment!

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


More information about the wp-trac mailing list