Bug #55475 [Asn]: is_a() triggers autoloader
Edit report at https://bugs.php.net/bug.php?id=55475&edit=1 ID: 55475 Updated by: ala...@php.net Reported by:mads at gartneriet dot dk Summary:is_a() triggers autoloader Status: Assigned Type: Bug Package:Scripting Engine problem PHP Version:5.3.7 Assigned To:dmitry Block user comment: N Private report: N CVE-ID: 2011-3379 New Comment: Any comments on 5.4.* It seems like applying the 5.3 fix to 5.4 is the only option here, as there is no 'reasonable' way to flag the previous behavior as E_DEPRECIATED that works well as both forward and backward compatible. Previous Comments: [2011-09-27 18:36:55] paj...@php.net Add CVE # [2011-09-27 09:35:31] ala...@php.net Automatic comment from SVN on behalf of alan_k Revision: http://svn.php.net/viewvc/?view=revision&revision=317382 Log: document fix for #55475 in NEWS [2011-09-26 19:57:09] paj...@php.net that's what I meant. [2011-09-26 19:54:23] henri at nerv dot fi CVE already requested with A LOT of conversation: http://www.openwall.com/lists/oss-security/2011/09/24/2 [2011-09-26 19:45:05] paj...@php.net @cipri Please contact secur...@php.net prior to request a CVE, to avoid double requests or confusing information. or mark a bug as security issue so we will catch it (and the sec guys of the linux distro as well) :) The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=55475 -- Edit this bug report at https://bugs.php.net/bug.php?id=55475&edit=1
Bug #55475 [Asn]: is_a() triggers autoloader
Edit report at https://bugs.php.net/bug.php?id=55475&edit=1 ID: 55475 Updated by: paj...@php.net Reported by:mads at gartneriet dot dk Summary:is_a() triggers autoloader Status: Assigned Type: Bug Package:Scripting Engine problem PHP Version:5.3.7 Assigned To:dmitry Block user comment: N Private report: N -CVE-ID: +CVE-ID: 2011-3379 New Comment: Add CVE # Previous Comments: [2011-09-27 09:35:31] ala...@php.net Automatic comment from SVN on behalf of alan_k Revision: http://svn.php.net/viewvc/?view=revision&revision=317382 Log: document fix for #55475 in NEWS [2011-09-26 19:57:09] paj...@php.net that's what I meant. [2011-09-26 19:54:23] henri at nerv dot fi CVE already requested with A LOT of conversation: http://www.openwall.com/lists/oss-security/2011/09/24/2 [2011-09-26 19:45:05] paj...@php.net @cipri Please contact secur...@php.net prior to request a CVE, to avoid double requests or confusing information. or mark a bug as security issue so we will catch it (and the sec guys of the linux distro as well) :) [2011-09-26 19:38:53] togos00 at gmail dot com Even if the new behavior is not a bug, per se, it is definitely surprising. is_a( $string, $className ) returning true would imply that $string is an instance of $className, which obviously it is not, as it is a string and not even an object. Having a separate function such as is_subclass_of( $className1, $className2 ) has the dual benefits of being more intuitive and not breaking old code. The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=55475 -- Edit this bug report at https://bugs.php.net/bug.php?id=55475&edit=1
Bug #55475 [Asn]: is_a() triggers autoloader
Edit report at https://bugs.php.net/bug.php?id=55475&edit=1 ID: 55475 Updated by: paj...@php.net Reported by:mads at gartneriet dot dk Summary:is_a() triggers autoloader Status: Assigned Type: Bug Package:Scripting Engine problem PHP Version:5.3.7 Assigned To:dmitry Block user comment: N Private report: N New Comment: that's what I meant. Previous Comments: [2011-09-26 19:54:23] henri at nerv dot fi CVE already requested with A LOT of conversation: http://www.openwall.com/lists/oss-security/2011/09/24/2 [2011-09-26 19:45:05] paj...@php.net @cipri Please contact secur...@php.net prior to request a CVE, to avoid double requests or confusing information. or mark a bug as security issue so we will catch it (and the sec guys of the linux distro as well) :) [2011-09-26 19:38:53] togos00 at gmail dot com Even if the new behavior is not a bug, per se, it is definitely surprising. is_a( $string, $className ) returning true would imply that $string is an instance of $className, which obviously it is not, as it is a string and not even an object. Having a separate function such as is_subclass_of( $className1, $className2 ) has the dual benefits of being more intuitive and not breaking old code. [2011-09-25 09:32:25] ala...@php.net The following patch has been added/updated: Patch Name: is_a_with_warning.txt Revision: 1316943145 URL: https://bugs.php.net/patch-display.php?bug=55475&patch=is_a_with_warning.txt&revision=1316943145 [2011-09-24 13:13:44] ci...@php.net Yes, I contacted the CVE yesterday to request a CVE-ID and I'll update it here as soon as I receive one. The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=55475 -- Edit this bug report at https://bugs.php.net/bug.php?id=55475&edit=1
Bug #55475 [Asn]: is_a() triggers autoloader
Edit report at https://bugs.php.net/bug.php?id=55475&edit=1 ID: 55475 Updated by: paj...@php.net Reported by:mads at gartneriet dot dk Summary:is_a() triggers autoloader Status: Assigned Type: Bug Package:Scripting Engine problem PHP Version:5.3.7 Assigned To:dmitry Block user comment: N Private report: N New Comment: @cipri Please contact secur...@php.net prior to request a CVE, to avoid double requests or confusing information. or mark a bug as security issue so we will catch it (and the sec guys of the linux distro as well) :) Previous Comments: [2011-09-26 19:38:53] togos00 at gmail dot com Even if the new behavior is not a bug, per se, it is definitely surprising. is_a( $string, $className ) returning true would imply that $string is an instance of $className, which obviously it is not, as it is a string and not even an object. Having a separate function such as is_subclass_of( $className1, $className2 ) has the dual benefits of being more intuitive and not breaking old code. [2011-09-25 09:32:25] ala...@php.net The following patch has been added/updated: Patch Name: is_a_with_warning.txt Revision: 1316943145 URL: https://bugs.php.net/patch-display.php?bug=55475&patch=is_a_with_warning.txt&revision=1316943145 [2011-09-24 13:13:44] ci...@php.net Yes, I contacted the CVE yesterday to request a CVE-ID and I'll update it here as soon as I receive one. [2011-09-24 09:22:04] henri at nerv dot fi Has someone requested CVE-identifier for this issue? I can do it if not. [2011-09-23 09:51:51] ras...@php.net Automatic comment from SVN on behalf of rasmus Revision: http://svn.php.net/viewvc/?view=revision&revision=317183 Log: Re-committing Alan's is_a revert/fix for bug #55475 Dmitry had done so earlier, but reverted pending discussion. It is completely clear that this should never have been changed in the 5.3 branch in the first place giving the number of things that broke because of it. The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=55475 -- Edit this bug report at https://bugs.php.net/bug.php?id=55475&edit=1
Bug #55475 [Asn]: is_a() triggers autoloader
Edit report at https://bugs.php.net/bug.php?id=55475&edit=1 ID: 55475 Updated by: ci...@php.net Reported by:mads at gartneriet dot dk Summary:is_a() triggers autoloader Status: Assigned Type: Bug Package:Scripting Engine problem PHP Version:5.3.7 Assigned To:dmitry Block user comment: N Private report: N New Comment: Yes, I contacted the CVE yesterday to request a CVE-ID and I'll update it here as soon as I receive one. Previous Comments: [2011-09-24 09:22:04] henri at nerv dot fi Has someone requested CVE-identifier for this issue? I can do it if not. [2011-09-23 09:51:51] ras...@php.net Automatic comment from SVN on behalf of rasmus Revision: http://svn.php.net/viewvc/?view=revision&revision=317183 Log: Re-committing Alan's is_a revert/fix for bug #55475 Dmitry had done so earlier, but reverted pending discussion. It is completely clear that this should never have been changed in the 5.3 branch in the first place giving the number of things that broke because of it. [2011-09-22 23:31:43] ala...@php.net The following patch has been added/updated: Patch Name: Is_a_with_allow_string_argument_v3 Revision: 1316734303 URL: https://bugs.php.net/patch-display.php?bug=55475&patch=Is_a_with_allow_string_argument_v3&revision=1316734303 [2011-09-22 23:26:20] ala...@php.net The following patch has been added/updated: Patch Name: Is_a_with_allow_string_argument_v2 Revision: 1316733980 URL: https://bugs.php.net/patch-display.php?bug=55475&patch=Is_a_with_allow_string_argument_v2&revision=1316733980 [2011-09-22 23:24:08] ala...@php.net The following patch has been added/updated: Patch Name: Is_a_with_allow_string_argument Revision: 1316733848 URL: https://bugs.php.net/patch-display.php?bug=55475&patch=Is_a_with_allow_string_argument&revision=1316733848 The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=55475 -- Edit this bug report at https://bugs.php.net/bug.php?id=55475&edit=1
Bug #55475 [Asn]: is_a() triggers autoloader
Edit report at https://bugs.php.net/bug.php?id=55475&edit=1 ID: 55475 Updated by: ala...@php.net Reported by:mads at gartneriet dot dk Summary:is_a() triggers autoloader Status: Assigned Type: Bug Package:Scripting Engine problem PHP Version:5.3.7 Assigned To:dmitry Block user comment: N Private report: N New Comment: Attached now is a patch that fixes this by adding is_class_of Which behaves the same as is_subclass_of, (autoload/ accepts strings) It also fixes the documentation on is_subclass_of and reverts the behaviour of is_a Note: the is_a change is now a security bug as sending url's to is_a may trigger remote code execution now. Note: I'm not sure you can classify a 2-3 developers comments as the "common decision" there where objections to the original change from core developers, this patch gives everybody what they want Previous Comments: [2011-09-20 21:25:58] ala...@php.net The following patch has been added/updated: Patch Name: is_class_of.txt Revision: 1316553958 URL: https://bugs.php.net/patch-display.php?bug=55475&patch=is_class_of.txt&revision=1316553958 [2011-09-15 11:00:29] dmi...@php.net Reverted before the common decision. [2011-09-15 10:59:23] dmi...@php.net Automatic comment from SVN on behalf of dmitry Revision: http://svn.php.net/viewvc/?view=revision&revision=316811 Log: Reverted the fix for #55475 (is_a() triggers autoloader) before the common decision [2011-09-15 10:00:16] dmi...@php.net I've committed the revert.is_a.behaviour.to.ignoring.strings.diff by alan at akbkhome dot com into 5.3. 5.4 is going to support string argument. [2011-09-15 09:58:17] dmi...@php.net Automatic comment from SVN on behalf of dmitry Revision: http://svn.php.net/viewvc/?view=revision&revision=316810 Log: Fixed bug #55475 (is_a() triggers autoloader). (alan at akbkhome dot com) The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=55475 -- Edit this bug report at https://bugs.php.net/bug.php?id=55475&edit=1
Bug #55475 [Asn]: is_a() triggers autoloader
Edit report at https://bugs.php.net/bug.php?id=55475&edit=1 ID: 55475 User updated by:mads at gartneriet dot dk Reported by:mads at gartneriet dot dk Summary:is_a() triggers autoloader Status: Assigned Type: Bug Package:Scripting Engine problem PHP Version:5.3.7 Assigned To:dmitry Block user comment: N Private report: N New Comment: DB_DataObject uses is_a() to check if a variable is both an object and an instance of a particular object. PEAR::isError() does too. This just gives warnings in my code, and I could of course easily fix these two places in my local pear-code. But then it will bite me the next time I upgrade those packages from PEAR. Previous Comments: [2011-08-22 21:46:19] col...@php.net What code? Do you have some example? [2011-08-22 19:17:28] mads at gartneriet dot dk Maybe not a bug, but it is behaving different ind 5.3.7 than in the previous versions, which makes some of the code from PEAR that i use, give errors. [2011-08-22 18:36:59] s...@php.net This is not a bug. If first argument is a string, it is interpreted as a class name and autoloader is called for it. Actually, IIRC, one the reasons why is_a was un-deprecated is that it can work with strings. [2011-08-22 15:46:05] johan...@php.net is_a()'s first argument is documented to be an object. If called with a string, following the documentation, I would actually expect a "Warning: is_a() expects parameter 1 to be object, string given" and return NULL. That aside and looking at the actual behavior: Previously is_a() could be used to check whether the parameter is an object AND of a specific type in one go. This can't be done anymore. In $a = "test"; is_a($a, "foo"); test might be an existing class and might be of type foo. Now people have to do is_object() && is_a(). I don't like having such behavior change in bug fix versions as I don't like going back and forth which is annoying for documentation and confusing for users. I would love to keep it out of 5.3.8 to have that as low risk quick release for the hash issue. Which means a rollback to the old way is even harder to do. (two versions with the new behavior out) [2011-08-22 14:49:31] col...@php.net Well, we have 3 options here: 1) keep it like it is since 5.3.7 2) reverting it to how it worked before 5.3.7 3) change it even more to not use autoload, so that it neither works like <5.3.6 nor 5.3.7 Apparently through your proposed fix you're advocating for (3). If so, I can't see how it would improve the situation in any way. Personally, given that the BC change is minimal, and that we're only adding functionality, (1) seems fine. Correct code existing before 5.3.6 will work just fine anyway. The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=55475 -- Edit this bug report at https://bugs.php.net/bug.php?id=55475&edit=1
Bug #55475 [Asn]: is_a() triggers autoloader
Edit report at https://bugs.php.net/bug.php?id=55475&edit=1 ID: 55475 Updated by: col...@php.net Reported by:mads at gartneriet dot dk Summary:is_a() triggers autoloader Status: Assigned Type: Bug Package:Scripting Engine problem PHP Version:5.3.7 Assigned To:dmitry Block user comment: N Private report: N New Comment: What code? Do you have some example? Previous Comments: [2011-08-22 19:17:28] mads at gartneriet dot dk Maybe not a bug, but it is behaving different ind 5.3.7 than in the previous versions, which makes some of the code from PEAR that i use, give errors. [2011-08-22 18:36:59] s...@php.net This is not a bug. If first argument is a string, it is interpreted as a class name and autoloader is called for it. Actually, IIRC, one the reasons why is_a was un-deprecated is that it can work with strings. [2011-08-22 15:46:05] johan...@php.net is_a()'s first argument is documented to be an object. If called with a string, following the documentation, I would actually expect a "Warning: is_a() expects parameter 1 to be object, string given" and return NULL. That aside and looking at the actual behavior: Previously is_a() could be used to check whether the parameter is an object AND of a specific type in one go. This can't be done anymore. In $a = "test"; is_a($a, "foo"); test might be an existing class and might be of type foo. Now people have to do is_object() && is_a(). I don't like having such behavior change in bug fix versions as I don't like going back and forth which is annoying for documentation and confusing for users. I would love to keep it out of 5.3.8 to have that as low risk quick release for the hash issue. Which means a rollback to the old way is even harder to do. (two versions with the new behavior out) [2011-08-22 14:49:31] col...@php.net Well, we have 3 options here: 1) keep it like it is since 5.3.7 2) reverting it to how it worked before 5.3.7 3) change it even more to not use autoload, so that it neither works like <5.3.6 nor 5.3.7 Apparently through your proposed fix you're advocating for (3). If so, I can't see how it would improve the situation in any way. Personally, given that the BC change is minimal, and that we're only adding functionality, (1) seems fine. Correct code existing before 5.3.6 will work just fine anyway. [2011-08-22 14:44:18] ka...@php.net ... the behaviour I'm talking about is obvious the return value and the fact that the autoloader now is called. The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=55475 -- Edit this bug report at https://bugs.php.net/bug.php?id=55475&edit=1
Bug #55475 [Asn]: is_a() triggers autoloader
Edit report at https://bugs.php.net/bug.php?id=55475&edit=1 ID: 55475 User updated by:mads at gartneriet dot dk Reported by:mads at gartneriet dot dk Summary:is_a() triggers autoloader Status: Assigned Type: Bug Package:Scripting Engine problem PHP Version:5.3.7 Assigned To:dmitry Block user comment: N Private report: N New Comment: Maybe not a bug, but it is behaving different ind 5.3.7 than in the previous versions, which makes some of the code from PEAR that i use, give errors. Previous Comments: [2011-08-22 18:36:59] s...@php.net This is not a bug. If first argument is a string, it is interpreted as a class name and autoloader is called for it. Actually, IIRC, one the reasons why is_a was un-deprecated is that it can work with strings. [2011-08-22 15:46:05] johan...@php.net is_a()'s first argument is documented to be an object. If called with a string, following the documentation, I would actually expect a "Warning: is_a() expects parameter 1 to be object, string given" and return NULL. That aside and looking at the actual behavior: Previously is_a() could be used to check whether the parameter is an object AND of a specific type in one go. This can't be done anymore. In $a = "test"; is_a($a, "foo"); test might be an existing class and might be of type foo. Now people have to do is_object() && is_a(). I don't like having such behavior change in bug fix versions as I don't like going back and forth which is annoying for documentation and confusing for users. I would love to keep it out of 5.3.8 to have that as low risk quick release for the hash issue. Which means a rollback to the old way is even harder to do. (two versions with the new behavior out) [2011-08-22 14:49:31] col...@php.net Well, we have 3 options here: 1) keep it like it is since 5.3.7 2) reverting it to how it worked before 5.3.7 3) change it even more to not use autoload, so that it neither works like <5.3.6 nor 5.3.7 Apparently through your proposed fix you're advocating for (3). If so, I can't see how it would improve the situation in any way. Personally, given that the BC change is minimal, and that we're only adding functionality, (1) seems fine. Correct code existing before 5.3.6 will work just fine anyway. [2011-08-22 14:44:18] ka...@php.net ... the behaviour I'm talking about is obvious the return value and the fact that the autoloader now is called. [2011-08-22 14:40:46] ka...@php.net I'm talking about the usual procedure we have about changing behaviour, a function suddenly returns the oppersite of what it used to in the middle of a stable series is very unlike to do, even for PHP. I knnow it went from not working to working, but I don't on the fact that such a commonly used function will change behaviour like that. What we should do is to make a big fat warning in the migration guide for 5.3.x -> 5.4.x about it, and in the manual. It would be the same if we changed substr() to be case insensitive in the middle of a release series, lets just not venture in such dark corners. The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=55475 -- Edit this bug report at https://bugs.php.net/bug.php?id=55475&edit=1
Bug #55475 [Asn]: is_a() triggers autoloader
Edit report at https://bugs.php.net/bug.php?id=55475&edit=1 ID: 55475 Updated by: s...@php.net Reported by:mads at gartneriet dot dk Summary:is_a() triggers autoloader Status: Assigned Type: Bug Package:Scripting Engine problem PHP Version:5.3.7 Assigned To:dmitry Block user comment: N Private report: N New Comment: This is not a bug. If first argument is a string, it is interpreted as a class name and autoloader is called for it. Actually, IIRC, one the reasons why is_a was un-deprecated is that it can work with strings. Previous Comments: [2011-08-22 15:46:05] johan...@php.net is_a()'s first argument is documented to be an object. If called with a string, following the documentation, I would actually expect a "Warning: is_a() expects parameter 1 to be object, string given" and return NULL. That aside and looking at the actual behavior: Previously is_a() could be used to check whether the parameter is an object AND of a specific type in one go. This can't be done anymore. In $a = "test"; is_a($a, "foo"); test might be an existing class and might be of type foo. Now people have to do is_object() && is_a(). I don't like having such behavior change in bug fix versions as I don't like going back and forth which is annoying for documentation and confusing for users. I would love to keep it out of 5.3.8 to have that as low risk quick release for the hash issue. Which means a rollback to the old way is even harder to do. (two versions with the new behavior out) [2011-08-22 14:49:31] col...@php.net Well, we have 3 options here: 1) keep it like it is since 5.3.7 2) reverting it to how it worked before 5.3.7 3) change it even more to not use autoload, so that it neither works like <5.3.6 nor 5.3.7 Apparently through your proposed fix you're advocating for (3). If so, I can't see how it would improve the situation in any way. Personally, given that the BC change is minimal, and that we're only adding functionality, (1) seems fine. Correct code existing before 5.3.6 will work just fine anyway. [2011-08-22 14:44:18] ka...@php.net ... the behaviour I'm talking about is obvious the return value and the fact that the autoloader now is called. [2011-08-22 14:40:46] ka...@php.net I'm talking about the usual procedure we have about changing behaviour, a function suddenly returns the oppersite of what it used to in the middle of a stable series is very unlike to do, even for PHP. I knnow it went from not working to working, but I don't on the fact that such a commonly used function will change behaviour like that. What we should do is to make a big fat warning in the migration guide for 5.3.x -> 5.4.x about it, and in the manual. It would be the same if we changed substr() to be case insensitive in the middle of a release series, lets just not venture in such dark corners. [2011-08-22 14:27:31] col...@php.net But what BC break are you talking about exactly? It went from not-working (returning always false for strings as first argument) to working with autoload. The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=55475 -- Edit this bug report at https://bugs.php.net/bug.php?id=55475&edit=1
Bug #55475 [Asn]: is_a() triggers autoloader
Edit report at https://bugs.php.net/bug.php?id=55475&edit=1 ID: 55475 Updated by: johan...@php.net Reported by:mads at gartneriet dot dk Summary:is_a() triggers autoloader Status: Assigned Type: Bug Package:Scripting Engine problem PHP Version:5.3.7 Assigned To:dmitry Block user comment: N Private report: N New Comment: is_a()'s first argument is documented to be an object. If called with a string, following the documentation, I would actually expect a "Warning: is_a() expects parameter 1 to be object, string given" and return NULL. That aside and looking at the actual behavior: Previously is_a() could be used to check whether the parameter is an object AND of a specific type in one go. This can't be done anymore. In $a = "test"; is_a($a, "foo"); test might be an existing class and might be of type foo. Now people have to do is_object() && is_a(). I don't like having such behavior change in bug fix versions as I don't like going back and forth which is annoying for documentation and confusing for users. I would love to keep it out of 5.3.8 to have that as low risk quick release for the hash issue. Which means a rollback to the old way is even harder to do. (two versions with the new behavior out) Previous Comments: [2011-08-22 14:49:31] col...@php.net Well, we have 3 options here: 1) keep it like it is since 5.3.7 2) reverting it to how it worked before 5.3.7 3) change it even more to not use autoload, so that it neither works like <5.3.6 nor 5.3.7 Apparently through your proposed fix you're advocating for (3). If so, I can't see how it would improve the situation in any way. Personally, given that the BC change is minimal, and that we're only adding functionality, (1) seems fine. Correct code existing before 5.3.6 will work just fine anyway. [2011-08-22 14:44:18] ka...@php.net ... the behaviour I'm talking about is obvious the return value and the fact that the autoloader now is called. [2011-08-22 14:40:46] ka...@php.net I'm talking about the usual procedure we have about changing behaviour, a function suddenly returns the oppersite of what it used to in the middle of a stable series is very unlike to do, even for PHP. I knnow it went from not working to working, but I don't on the fact that such a commonly used function will change behaviour like that. What we should do is to make a big fat warning in the migration guide for 5.3.x -> 5.4.x about it, and in the manual. It would be the same if we changed substr() to be case insensitive in the middle of a release series, lets just not venture in such dark corners. [2011-08-22 14:27:31] col...@php.net But what BC break are you talking about exactly? It went from not-working (returning always false for strings as first argument) to working with autoload. [2011-08-22 13:41:16] ka...@php.net I'm not arguing that the new behaviour is wrong, I believe it is the desired too but I don't agree to break BC in the middle of a stable release series nor as much as I would like to myself to achieve the right behaviour. The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=55475 -- Edit this bug report at https://bugs.php.net/bug.php?id=55475&edit=1
Bug #55475 [Asn]: is_a() triggers autoloader
Edit report at https://bugs.php.net/bug.php?id=55475&edit=1 ID: 55475 Updated by: col...@php.net Reported by:mads at gartneriet dot dk Summary:is_a() triggers autoloader Status: Assigned Type: Bug Package:Scripting Engine problem PHP Version:5.3.7 Assigned To:dmitry Block user comment: N Private report: N New Comment: Well, we have 3 options here: 1) keep it like it is since 5.3.7 2) reverting it to how it worked before 5.3.7 3) change it even more to not use autoload, so that it neither works like <5.3.6 nor 5.3.7 Apparently through your proposed fix you're advocating for (3). If so, I can't see how it would improve the situation in any way. Personally, given that the BC change is minimal, and that we're only adding functionality, (1) seems fine. Correct code existing before 5.3.6 will work just fine anyway. Previous Comments: [2011-08-22 14:44:18] ka...@php.net ... the behaviour I'm talking about is obvious the return value and the fact that the autoloader now is called. [2011-08-22 14:40:46] ka...@php.net I'm talking about the usual procedure we have about changing behaviour, a function suddenly returns the oppersite of what it used to in the middle of a stable series is very unlike to do, even for PHP. I knnow it went from not working to working, but I don't on the fact that such a commonly used function will change behaviour like that. What we should do is to make a big fat warning in the migration guide for 5.3.x -> 5.4.x about it, and in the manual. It would be the same if we changed substr() to be case insensitive in the middle of a release series, lets just not venture in such dark corners. [2011-08-22 14:27:31] col...@php.net But what BC break are you talking about exactly? It went from not-working (returning always false for strings as first argument) to working with autoload. [2011-08-22 13:41:16] ka...@php.net I'm not arguing that the new behaviour is wrong, I believe it is the desired too but I don't agree to break BC in the middle of a stable release series nor as much as I would like to myself to achieve the right behaviour. [2011-08-22 13:31:21] col...@php.net It seems correct to me as well to trigger autoload in this case. It does and always did so for is_subclass_of(), I don't see any reason for a condition of "subclasses_only" to yes or no trigger the autoload. The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=55475 -- Edit this bug report at https://bugs.php.net/bug.php?id=55475&edit=1
Bug #55475 [Asn]: is_a() triggers autoloader
Edit report at https://bugs.php.net/bug.php?id=55475&edit=1 ID: 55475 Updated by: ka...@php.net Reported by:mads at gartneriet dot dk Summary:is_a() triggers autoloader Status: Assigned Type: Bug Package:Scripting Engine problem PHP Version:5.3.7 Assigned To:dmitry Block user comment: N Private report: N New Comment: ... the behaviour I'm talking about is obvious the return value and the fact that the autoloader now is called. Previous Comments: [2011-08-22 14:40:46] ka...@php.net I'm talking about the usual procedure we have about changing behaviour, a function suddenly returns the oppersite of what it used to in the middle of a stable series is very unlike to do, even for PHP. I knnow it went from not working to working, but I don't on the fact that such a commonly used function will change behaviour like that. What we should do is to make a big fat warning in the migration guide for 5.3.x -> 5.4.x about it, and in the manual. It would be the same if we changed substr() to be case insensitive in the middle of a release series, lets just not venture in such dark corners. [2011-08-22 14:27:31] col...@php.net But what BC break are you talking about exactly? It went from not-working (returning always false for strings as first argument) to working with autoload. [2011-08-22 13:41:16] ka...@php.net I'm not arguing that the new behaviour is wrong, I believe it is the desired too but I don't agree to break BC in the middle of a stable release series nor as much as I would like to myself to achieve the right behaviour. [2011-08-22 13:31:21] col...@php.net It seems correct to me as well to trigger autoload in this case. It does and always did so for is_subclass_of(), I don't see any reason for a condition of "subclasses_only" to yes or no trigger the autoload. [2011-08-22 11:00:28] dmi...@php.net Before the patch, is_a() didn't accept string as the first argument at all, so it always returned "false" and never triggered __autoload(). The proposed patch didn't revert to original behavior. It just disables autoloading and may lead to wrong result. class a {} class b extends a {} var_dump(is_a("b", "a")); // it was false before 5.3.7, now it's true I would say that the old behaviour was wrong, especially because "instanceof" and is_subclass_of() already implemented support for string arguments. The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=55475 -- Edit this bug report at https://bugs.php.net/bug.php?id=55475&edit=1
Bug #55475 [Asn]: is_a() triggers autoloader
Edit report at https://bugs.php.net/bug.php?id=55475&edit=1 ID: 55475 Updated by: ka...@php.net Reported by:mads at gartneriet dot dk Summary:is_a() triggers autoloader Status: Assigned Type: Bug Package:Scripting Engine problem PHP Version:5.3.7 Assigned To:dmitry Block user comment: N Private report: N New Comment: I'm talking about the usual procedure we have about changing behaviour, a function suddenly returns the oppersite of what it used to in the middle of a stable series is very unlike to do, even for PHP. I knnow it went from not working to working, but I don't on the fact that such a commonly used function will change behaviour like that. What we should do is to make a big fat warning in the migration guide for 5.3.x -> 5.4.x about it, and in the manual. It would be the same if we changed substr() to be case insensitive in the middle of a release series, lets just not venture in such dark corners. Previous Comments: [2011-08-22 14:27:31] col...@php.net But what BC break are you talking about exactly? It went from not-working (returning always false for strings as first argument) to working with autoload. [2011-08-22 13:41:16] ka...@php.net I'm not arguing that the new behaviour is wrong, I believe it is the desired too but I don't agree to break BC in the middle of a stable release series nor as much as I would like to myself to achieve the right behaviour. [2011-08-22 13:31:21] col...@php.net It seems correct to me as well to trigger autoload in this case. It does and always did so for is_subclass_of(), I don't see any reason for a condition of "subclasses_only" to yes or no trigger the autoload. [2011-08-22 11:00:28] dmi...@php.net Before the patch, is_a() didn't accept string as the first argument at all, so it always returned "false" and never triggered __autoload(). The proposed patch didn't revert to original behavior. It just disables autoloading and may lead to wrong result. class a {} class b extends a {} var_dump(is_a("b", "a")); // it was false before 5.3.7, now it's true I would say that the old behaviour was wrong, especially because "instanceof" and is_subclass_of() already implemented support for string arguments. [2011-08-22 10:30:19] ka...@php.net The following patch has been added/updated: Patch Name: bug55475 Revision: 1314009019 URL: https://bugs.php.net/patch-display.php?bug=55475&patch=bug55475&revision=1314009019 The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=55475 -- Edit this bug report at https://bugs.php.net/bug.php?id=55475&edit=1
Bug #55475 [Asn]: is_a() triggers autoloader
Edit report at https://bugs.php.net/bug.php?id=55475&edit=1 ID: 55475 Updated by: col...@php.net Reported by:mads at gartneriet dot dk Summary:is_a() triggers autoloader Status: Assigned Type: Bug Package:Scripting Engine problem PHP Version:5.3.7 Assigned To:dmitry Block user comment: N Private report: N New Comment: But what BC break are you talking about exactly? It went from not-working (returning always false for strings as first argument) to working with autoload. Previous Comments: [2011-08-22 13:41:16] ka...@php.net I'm not arguing that the new behaviour is wrong, I believe it is the desired too but I don't agree to break BC in the middle of a stable release series nor as much as I would like to myself to achieve the right behaviour. [2011-08-22 13:31:21] col...@php.net It seems correct to me as well to trigger autoload in this case. It does and always did so for is_subclass_of(), I don't see any reason for a condition of "subclasses_only" to yes or no trigger the autoload. [2011-08-22 11:00:28] dmi...@php.net Before the patch, is_a() didn't accept string as the first argument at all, so it always returned "false" and never triggered __autoload(). The proposed patch didn't revert to original behavior. It just disables autoloading and may lead to wrong result. class a {} class b extends a {} var_dump(is_a("b", "a")); // it was false before 5.3.7, now it's true I would say that the old behaviour was wrong, especially because "instanceof" and is_subclass_of() already implemented support for string arguments. [2011-08-22 10:30:19] ka...@php.net The following patch has been added/updated: Patch Name: bug55475 Revision: 1314009019 URL: https://bugs.php.net/patch-display.php?bug=55475&patch=bug55475&revision=1314009019 [2011-08-22 10:29:51] ka...@php.net Zeev, although the functionality might appear as it should be then we should not make sudden changes like that in the middle of a stable branch, we should patch up 5.3 and keep the behaviour in 5.4 if its indeed intended atleast to comply with previous versions. The fix for 5.3 is simple, attached The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=55475 -- Edit this bug report at https://bugs.php.net/bug.php?id=55475&edit=1
Bug #55475 [Asn]: is_a() triggers autoloader
Edit report at https://bugs.php.net/bug.php?id=55475&edit=1 ID: 55475 Updated by: ka...@php.net Reported by:mads at gartneriet dot dk Summary:is_a() triggers autoloader Status: Assigned Type: Bug Package:Scripting Engine problem PHP Version:5.3.7 Assigned To:dmitry Block user comment: N Private report: N New Comment: I'm not arguing that the new behaviour is wrong, I believe it is the desired too but I don't agree to break BC in the middle of a stable release series nor as much as I would like to myself to achieve the right behaviour. Previous Comments: [2011-08-22 13:31:21] col...@php.net It seems correct to me as well to trigger autoload in this case. It does and always did so for is_subclass_of(), I don't see any reason for a condition of "subclasses_only" to yes or no trigger the autoload. [2011-08-22 11:00:28] dmi...@php.net Before the patch, is_a() didn't accept string as the first argument at all, so it always returned "false" and never triggered __autoload(). The proposed patch didn't revert to original behavior. It just disables autoloading and may lead to wrong result. class a {} class b extends a {} var_dump(is_a("b", "a")); // it was false before 5.3.7, now it's true I would say that the old behaviour was wrong, especially because "instanceof" and is_subclass_of() already implemented support for string arguments. [2011-08-22 10:30:19] ka...@php.net The following patch has been added/updated: Patch Name: bug55475 Revision: 1314009019 URL: https://bugs.php.net/patch-display.php?bug=55475&patch=bug55475&revision=1314009019 [2011-08-22 10:29:51] ka...@php.net Zeev, although the functionality might appear as it should be then we should not make sudden changes like that in the middle of a stable branch, we should patch up 5.3 and keep the behaviour in 5.4 if its indeed intended atleast to comply with previous versions. The fix for 5.3 is simple, attached [2011-08-22 10:12:48] z...@php.net Discussed with Dmitry, the current functionality appears to be correct. is_a('foo', 'bar') *can* be true even if class foo isn't loaded, and we'll only know that if we try to load 'foo'. This is different from is_a($obj, 'non_existent_class'), which we can resolve as 'false' in case non_existent_class isn't loaded without trying to load it (there can't be an instance of a class that doesn't exist). The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=55475 -- Edit this bug report at https://bugs.php.net/bug.php?id=55475&edit=1
Bug #55475 [Asn]: is_a() triggers autoloader
Edit report at https://bugs.php.net/bug.php?id=55475&edit=1 ID: 55475 Updated by: col...@php.net Reported by:mads at gartneriet dot dk Summary:is_a() triggers autoloader Status: Assigned Type: Bug Package:Scripting Engine problem PHP Version:5.3.7 Assigned To:dmitry Block user comment: N Private report: N New Comment: It seems correct to me as well to trigger autoload in this case. It does and always did so for is_subclass_of(), I don't see any reason for a condition of "subclasses_only" to yes or no trigger the autoload. Previous Comments: [2011-08-22 11:00:28] dmi...@php.net Before the patch, is_a() didn't accept string as the first argument at all, so it always returned "false" and never triggered __autoload(). The proposed patch didn't revert to original behavior. It just disables autoloading and may lead to wrong result. class a {} class b extends a {} var_dump(is_a("b", "a")); // it was false before 5.3.7, now it's true I would say that the old behaviour was wrong, especially because "instanceof" and is_subclass_of() already implemented support for string arguments. [2011-08-22 10:30:19] ka...@php.net The following patch has been added/updated: Patch Name: bug55475 Revision: 1314009019 URL: https://bugs.php.net/patch-display.php?bug=55475&patch=bug55475&revision=1314009019 [2011-08-22 10:29:51] ka...@php.net Zeev, although the functionality might appear as it should be then we should not make sudden changes like that in the middle of a stable branch, we should patch up 5.3 and keep the behaviour in 5.4 if its indeed intended atleast to comply with previous versions. The fix for 5.3 is simple, attached [2011-08-22 10:12:48] z...@php.net Discussed with Dmitry, the current functionality appears to be correct. is_a('foo', 'bar') *can* be true even if class foo isn't loaded, and we'll only know that if we try to load 'foo'. This is different from is_a($obj, 'non_existent_class'), which we can resolve as 'false' in case non_existent_class isn't loaded without trying to load it (there can't be an instance of a class that doesn't exist). [2011-08-22 09:15:23] col...@php.net 1) The underlying implementation is shared between is_a and is_subclass_of. 2) Previously, strings as first argument was not permitted by is_a but was for is_subclass_of, 3) is_subclass_of always triggered autoload in such cases. 4) Following a fix from Dmitry, the underlying implementation now allows a string as first argument for is_a as well. Conclusion: it is now consistent, but if you wrongly used is_a with a string before, it now triggers autoload because it actually accepts it. The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=55475 -- Edit this bug report at https://bugs.php.net/bug.php?id=55475&edit=1
Bug #55475 [Asn]: is_a() triggers autoloader
Edit report at https://bugs.php.net/bug.php?id=55475&edit=1 ID: 55475 Updated by: dmi...@php.net Reported by:mads at gartneriet dot dk Summary:is_a() triggers autoloader Status: Assigned Type: Bug Package:Scripting Engine problem PHP Version:5.3.7 Assigned To:dmitry Block user comment: N Private report: N New Comment: Before the patch, is_a() didn't accept string as the first argument at all, so it always returned "false" and never triggered __autoload(). The proposed patch didn't revert to original behavior. It just disables autoloading and may lead to wrong result. class a {} class b extends a {} var_dump(is_a("b", "a")); // it was false before 5.3.7, now it's true I would say that the old behaviour was wrong, especially because "instanceof" and is_subclass_of() already implemented support for string arguments. Previous Comments: [2011-08-22 10:30:19] ka...@php.net The following patch has been added/updated: Patch Name: bug55475 Revision: 1314009019 URL: https://bugs.php.net/patch-display.php?bug=55475&patch=bug55475&revision=1314009019 [2011-08-22 10:29:51] ka...@php.net Zeev, although the functionality might appear as it should be then we should not make sudden changes like that in the middle of a stable branch, we should patch up 5.3 and keep the behaviour in 5.4 if its indeed intended atleast to comply with previous versions. The fix for 5.3 is simple, attached [2011-08-22 10:12:48] z...@php.net Discussed with Dmitry, the current functionality appears to be correct. is_a('foo', 'bar') *can* be true even if class foo isn't loaded, and we'll only know that if we try to load 'foo'. This is different from is_a($obj, 'non_existent_class'), which we can resolve as 'false' in case non_existent_class isn't loaded without trying to load it (there can't be an instance of a class that doesn't exist). [2011-08-22 09:15:23] col...@php.net 1) The underlying implementation is shared between is_a and is_subclass_of. 2) Previously, strings as first argument was not permitted by is_a but was for is_subclass_of, 3) is_subclass_of always triggered autoload in such cases. 4) Following a fix from Dmitry, the underlying implementation now allows a string as first argument for is_a as well. Conclusion: it is now consistent, but if you wrongly used is_a with a string before, it now triggers autoload because it actually accepts it. [2011-08-22 08:57:32] konstantin dot leboev at gmail dot com I guess it's not a bug. The first argument can be a class name, what will be loaded only on calling this function. The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=55475 -- Edit this bug report at https://bugs.php.net/bug.php?id=55475&edit=1
Bug #55475 [Asn]: is_a() triggers autoloader
Edit report at https://bugs.php.net/bug.php?id=55475&edit=1 ID: 55475 Updated by: ka...@php.net Reported by:mads at gartneriet dot dk Summary:is_a() triggers autoloader Status: Assigned Type: Bug Package:Scripting Engine problem PHP Version:5.3.7 Assigned To:dmitry Block user comment: N Private report: N New Comment: Zeev, although the functionality might appear as it should be then we should not make sudden changes like that in the middle of a stable branch, we should patch up 5.3 and keep the behaviour in 5.4 if its indeed intended atleast to comply with previous versions. The fix for 5.3 is simple, attached Previous Comments: [2011-08-22 10:12:48] z...@php.net Discussed with Dmitry, the current functionality appears to be correct. is_a('foo', 'bar') *can* be true even if class foo isn't loaded, and we'll only know that if we try to load 'foo'. This is different from is_a($obj, 'non_existent_class'), which we can resolve as 'false' in case non_existent_class isn't loaded without trying to load it (there can't be an instance of a class that doesn't exist). [2011-08-22 09:15:23] col...@php.net 1) The underlying implementation is shared between is_a and is_subclass_of. 2) Previously, strings as first argument was not permitted by is_a but was for is_subclass_of, 3) is_subclass_of always triggered autoload in such cases. 4) Following a fix from Dmitry, the underlying implementation now allows a string as first argument for is_a as well. Conclusion: it is now consistent, but if you wrongly used is_a with a string before, it now triggers autoload because it actually accepts it. [2011-08-22 08:57:32] konstantin dot leboev at gmail dot com I guess it's not a bug. The first argument can be a class name, what will be loaded only on calling this function. [2011-08-22 08:19:04] paj...@php.net Related to change for the #53727 fix. http://svn.php.net/viewvc/php/php- src/branches/PHP_5_3/Zend/zend_builtin_functions.c?r1=307522&r2=312904 Assigned to Dmitry [2011-08-22 08:16:02] mads at gartneriet dot dk Description: When calling is_a() with a first argument that is not an object, then __autoload() is triggered: Test script: --- Expected result: bool(false) bool(false) Actual result: -- Would load: test bool(false) bool(false) -- Edit this bug report at https://bugs.php.net/bug.php?id=55475&edit=1
Bug #55475 [Asn]: is_a() triggers autoloader
Edit report at https://bugs.php.net/bug.php?id=55475&edit=1 ID: 55475 Updated by: col...@php.net Reported by:mads at gartneriet dot dk Summary:is_a() triggers autoloader Status: Assigned Type: Bug Package:Scripting Engine problem PHP Version:5.3.7 Assigned To:dmitry Block user comment: N Private report: N New Comment: 1) The underlying implementation is shared between is_a and is_subclass_of. 2) Previously, strings as first argument was not permitted by is_a but was for is_subclass_of, 3) is_subclass_of always triggered autoload in such cases. 4) Following a fix from Dmitry, the underlying implementation now allows a string as first argument for is_a as well. Conclusion: it is now consistent, but if you wrongly used is_a with a string before, it now triggers autoload because it actually accepts it. Previous Comments: [2011-08-22 08:57:32] konstantin dot leboev at gmail dot com I guess it's not a bug. The first argument can be a class name, what will be loaded only on calling this function. [2011-08-22 08:19:04] paj...@php.net Related to change for the #53727 fix. http://svn.php.net/viewvc/php/php- src/branches/PHP_5_3/Zend/zend_builtin_functions.c?r1=307522&r2=312904 Assigned to Dmitry [2011-08-22 08:16:02] mads at gartneriet dot dk Description: When calling is_a() with a first argument that is not an object, then __autoload() is triggered: Test script: --- Expected result: bool(false) bool(false) Actual result: -- Would load: test bool(false) bool(false) -- Edit this bug report at https://bugs.php.net/bug.php?id=55475&edit=1