Trying to get property of non-object.: Biz çok garip hatalar bazen bizim php logs haşhaş var
Bu tam bir hata $shortName if ifadesini aşağıdaki üye erişimi neden gibi görünüyor:
class MyLocaleWrapper extends SomeOtherClass {
…
protected static $system = NULL;
public static function getSystemLocale() {
if (self::$system === NULL) {
self::$system = new self();
debug(self::$system);
self::$system->rfcName = SYSTEM_LOCALE_RFCNAME;
self::$system->shortName = strtolower(Locale::getRegion(self::$system->rfcName));
if (self::$system->shortName == '') {
self::$system->shortName = strtolower(self::$system->rfcName);
}
…
# in another file:
class SomeOtherClass {
…
public function __construct() {
# Some documentation about features that have been
# removed from the constructor, but no real code in here.
return NULL;
}
…
# in yet another file:
MyLocaleWrapper::getSystemLocale();
Ben bir günlük dosyasına self::$system atacaksan, ben öyle olduğunu NULL - bkz doğru anahtar kelime ile inşa edildikten sonra new.
En ilginç kısmı bu dosya bizim sayfaya her isteği dahil, bu yüzden ~ saniyede 10 defa idam gets olduğunu. Ama bazen sadece herkesin kodunu (hatta sunucu) dokunmadan başarısız olur.
Başkasının hiç PHP böyle bir davranış yaşanmıştır?