Re: is_a fix for 5.4 and HEAD

From: Date: Fri, 14 Oct 2011 02:12:52 +0000
Subject: Re: is_a fix for 5.4 and HEAD
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-55802@lists.php.net to get a copy of this message
On Friday, October 14, 2011 08:06 AM, Rasmus Lerdorf wrote:
On 10/13/2011 04:54 PM, Alan Knowles wrote:
On Thursday, October 13, 2011 11:23 PM, Stas Malyshev wrote:
On 10/13/11 12:39 AM, Alan Knowles wrote:
Can someone apply this to HEAD and PHP_5_4, or let me have karma. https://bugs.php.net/patch-display.php?bug_id=55475&patch=final_patch_for_5_4_and_HEAD&revision=latest Thanks Alan
+/* {{{ proto bool is_subclass_of(mixed object_or_string, string class_name [, bool allow_string=true]) +/* {{{ proto bool is_a(mixed object_or_string, string class_name [, bool allow_string=false]) This is quite strange - two almost identical functions with completely different default semantics.
Yes, and if you can think of a way to depreciate them now so that it does not break BC and could be changed later, please feel free, but I've looked at it quite a bit and could not find any other way.
Argh! Pet-peeve, it's deprecate. Depreciate means something completely different. Agh to much accounting recently ;)
I agree that it is slightly messy, but we have painted ourselves into a bit of a corner with the 5.3 mess. Stas, the whole point here is that changing the is_a() default in 5.3 caused huge problems, including security ones, so setting allow_string to false by default fixes that BC break in 5.3. Considering the huge amount of code hit by this I think we should keep that default in 5.4. Alan, does is_subclass_of() actually need the allow_string flag at all? It has always been documented take a mixed and hit the autoloader, so why would we need an option to disable the string? I don't think I've used is_subclass_of for years, the flag is a knock on effect from sharing the same code, and may be useful in some edge cases (if somebody wanted to use subclass_of with user input.. ), since that bit does not affect me, I do not mind either way.
To disable for subclass of it is quite trivial, I can get a full patch ready (including updated tests) if we go that way. if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, only_subclass ? "zs" : "zs|b", &obj, &class_name, &class_name_len, &allow_string) == FAILURE) { Regards Alan
-Rasmus


« previous php.internals (#55802) next »