Re: What is wrong with this code?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Gary . wrote:
On 4/28/10, Thijs Lensselink wrote:
Gary . wrote:
class Pg_Error
{
    private static $errors =
        array(INTEGRITY_CONST_UNIQUE => 'uniqueness constraint violated');

Shouldn't this be:

array(self::INTEGRITY_CONST_UNIQUE => 'uniqueness constraint violated');

Yes, or something very like it. See Message-ID:
<y2la35643581004280018i22b3de1ag1a836e7229378b77@xxxxxxxxxxxxxx>

That message is about defining the class constant. Which is done.
But later on it is called as a normal constant. Not a class constant

Besides the fact that it should throw a notice. It also makes sure
Pg_Error::$errors looks a bit different then expected

array(1) {
 ["INTEGRITY_CONST_UNIQUE"]=>
 string(30) "uniqueness constraint violated"
}

This makes Pg_Error::getMessage(23505) always return string(0)"" which equals false....

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux