Re: 5.4 regression: non-existent sub-sub keys now have values

From: Date: Thu, 24 Nov 2011 10:40:09 +0000
Subject: Re: 5.4 regression: non-existent sub-sub keys now have values
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15  Groups: php.internals 
Request: Send a blank email to internals+get-56565@lists.php.net to get a copy of this message
On Thu, Nov 24, 2011 at 11:05 AM, <devis@lucato.it> wrote: > On 24 November 2011 01:38, Stas Malyshev <smalyshev@sugarcrm.com> wrote: > > Hi! > > > >> But neither is introducing a potential bomb of the kind that the 'date' > >> saga > >> created. The problem this change IS causing is likely to hit many live > >> sites > > > > The claim that many live sites actually regularly use string multiple > string > > offsets to distinguish strings from arrays sounds implausible to me. > > > > > Hi, > > I hadn't the opportunity to install php 5.4 to test this, so I was > wondering if someone could test how would this code behave ? > > ########### > if ( > !isset( $widget_options['dashboard_incoming_links'] ) > || !isset( $widget_options['dashboard_incoming_links']['home'] ) > || $widget_options['dashboard_incoming_links']['home'] != > get_option('home') ) > ########### > > Is that correct saying that if the first condition is false the second > will always be true ? > > Note: that's a piece of Wordpress > > hi. you can also test it http://codepad.viper-7.com/ if you don't want/can't have a build from source. What does get_option('home') return? From a quick glance, I think that you are safe, except if you get a string instead of an array(either for $widget_options or $widget_options['dashboard_incoming_links']), and the first character of that string is a slash and your get_option('home') returns a slash also. in which case your code will behave as it would get a correct array having $widget_options['dashboard_incoming_links']['home'] = '/' -- Ferenc Kovács @Tyr43l - http://tyrael.hu

« previous php.internals (#56565) next »