1
0
mirror of https://github.com/dg/dibi.git synced 2025-07-31 19:30:30 +02:00

DibiLazyStorage: empty string as property name throws exception; fixed in DibiDatabaseInfo too

This commit is contained in:
David Grudl
2010-08-03 13:40:47 +02:00
parent e50b1a0b5a
commit 914f7d3c26
2 changed files with 4 additions and 1 deletions

View File

@@ -533,7 +533,7 @@ class DibiColumnInfo extends DibiObject
if (self::$types === NULL) {
self::$types = new DibiLazyStorage(array(__CLASS__, 'detectType'));
}
return self::$types->{$this->info['nativetype']};
return $this->info['nativetype'] ? self::$types->{$this->info['nativetype']} : dibi::TEXT;
}

View File

@@ -59,6 +59,9 @@ final class DibiLazyStorage extends DibiLazyStorageBase
if (is_array($nm)) { // preg_replace_callback support
$nm = $nm[1];
}
if ($nm == '') {
throw new InvalidStateException('Missing identifier name.');
}
return $this->$nm = call_user_func($this->getCallback(), $nm);
}