Hi all,
Another reminder, I'd like to roll RC1 on Monday. Everyone will be back
from OSCON and we can start the Unicode merge right afterwards.
Andi
On Fri, 05 Aug 2005 13:52:13 -0700
andi@zend.com (Andi Gutmans) wrote:
Hi all,
Another reminder, I'd like to roll RC1 on Monday. Everyone will
be back from OSCON and we can start the Unicode merge right
afterwards.
One thing I would like to solve in 5.1 is instanceof (or the
deprecation of is_a).
instanceof is useless much of the times as it raises a fatal error
as soon as the tested class does not exist. Since when tests raise
fatal error?
Sample script:
class test{}
$a = new test;
if ($a instanceof Foo) {
echo "not foo";
}
result:
Fatal error: Class 'Foo' not found in /home/pierre/cvs/builds/
php_head/instanceof.php on line 4
I can write a patch to "fix" it if we agree that the current
behavior is not correct.
Regards,
--Pierre
Hello,
I took a short look to the implementation.
instanceof_ex works as expected, no error display there. The
problem comes from the usage of class_name_reference in the parser.
class_name_reference calls zend_do_fetch_class, which raises this
error as no class is loaded.
Now I'm not sure about a clean solution, it's fine to raise a fatal
error when class_name_reference is used with new, but in the case
of instanceof, it does not make sense.
add a class_name_reference_silent? :)
--Pierre
Hi Pierre-Alain Joye, you wrote:
I can write a patch to "fix" it if we agree that the current
behavior is not correct.
While you're at it, could you continue on fixing the following:
(another evidence that the current "generic" behaviour is bad)
try {
// anything
} catch (NonExistantException $e) {
}
Fatal error: Class 'NonExistantException' not found
For reference:
http://marc.theaimsgroup.com/?l=php-dev&m=111887012528058&w=2
http://marc.theaimsgroup.com/?l=php-dev&m=109404375329280&w=2
http://marc.theaimsgroup.com/?l=php-dev&m=109218461900310&w=2
Regards,
Michael - < mike(@)php.net
Hello Michael,
Monday, August 8, 2005, 6:26:30 PM, you wrote:
Hi Pierre-Alain Joye, you wrote:
I can write a patch to "fix" it if we agree that the current
behavior is not correct.
While you're at it, could you continue on fixing the following:
(another evidence that the current "generic" behaviour is bad)
try {
// anything
} catch (NonExistantException $e) {
}
Fatal error: Class 'NonExistantException' not found
This is a very different topic. While "instanceof missingclass" can never
result to any problem the former violates hard coded requirements. Thus i
think dropping the message from instanceof is acceptable - but i am not
going to decide this so don't take my second thoughts on this one too
serious.
Best regards,
Marcus
On Mon, 08 Aug 2005 18:26:30 +0200
mike@php.net (Michael Wallner) wrote:
Hi Pierre-Alain Joye, you wrote:
I can write a patch to "fix" it if we agree that the current
behavior is not correct.While you're at it, could you continue on fixing the following:
(another evidence that the current "generic" behaviour is bad)try {
// anything
} catch (NonExistantException $e) {
}Fatal error: Class 'NonExistantException' not found
You try to declare (if it get catched) a non existent class. Not
really related to instanceof, it's like a new nonexistantclass;
--Pierre