Re: cvs: pear(MDB_1) /MDB MDB.php

From: Date: Wed, 21 Jan 2004 18:42:32 +0000
Subject: Re: cvs: pear(MDB_1) /MDB MDB.php
References: 1  Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-15843@lists.php.net to get a copy of this message
On Wed, Jan 21, 2004 at 12:01:36PM -0000, Lukas Smith wrote: > lsmith Wed Jan 21 07:01:36 2004 EDT > > Modified files: (Branch: MDB_1) > /pear/MDB MDB.php > Log: > - php5 fix for MDB::isError() - improved (tm) ... > - return(is_object($value) > - && (strtolower(get_class($value)) == 'mdb_error' > - || strtolower(is_subclass_of($value, 'mdb_error'))) > + return (is_object($value) > + && (is_a($value, 'mdb_error') || is_a($value, > 'MDB_Error')) The is_object() test is redundant (is_a() will verify that its first argument is an object), and is_a() already does a case-insensitive test. The following code produces identical output under both PHP 4.3 and PHP5: class Foo {} $f = new Foo(); if (is_a($f, 'foo')) echo "foo\n"; if (is_a($f, 'Foo')) echo "Foo\n"; Given all that, your return statement above can be written as simply: return (is_a($value, 'MDB_Error')); -- Jon Parise (jon@php.net) :: The PHP Project (http://www.php.net/)

« previous php.pear.cvs (#15843) next »