diff --git a/wire/core/PWGIF.php b/wire/core/PWGIF.php index b74d5cc4..e2026dc9 100644 --- a/wire/core/PWGIF.php +++ b/wire/core/PWGIF.php @@ -42,7 +42,7 @@ class PWGIFLZW { } function LZWCommand(&$data, $bInit) { if($bInit) { - $this->SetCodeSize = ord($data{0}); + $this->SetCodeSize = ord($data[0]); $data = substr($data, 1); $this->CodeSize = $this->SetCodeSize + 1; $this->ClearCode = 1 << $this->SetCodeSize; @@ -147,11 +147,11 @@ class PWGIFLZW { } $this->Buf[0] = $this->Buf[$this->LastByte - 2]; $this->Buf[1] = $this->Buf[$this->LastByte - 1]; - $Count = ord($data{0}); + $Count = ord($data[0]); $data = substr($data, 1); if($Count) { for($i = 0; $i < $Count; $i++) { - $this->Buf[2 + $i] = ord($data{$i}); + $this->Buf[2 + $i] = ord($data[$i]); } $data = substr($data, $Count); } else { @@ -187,7 +187,7 @@ class PWGIFCOLORTABLE { return false; } if($this->extended) { - $this->m_arColors[] = (ord($rgb{2}) << 16) + (ord($rgb{1}) << 8) + ord($rgb{0}); + $this->m_arColors[] = (ord($rgb[2]) << 16) + (ord($rgb[1]) << 8) + ord($rgb[0]); } $this->m_nColors++; } @@ -310,7 +310,7 @@ class PWGIFIMAGEHEADER { if(!$this->m_nWidth || !$this->m_nHeight) { return false; } - $b = ord($lpData{8}); + $b = ord($lpData[8]); $this->m_bLocalClr = ($b & 0x80) ? true : false; $this->m_bInterlace = ($b & 0x40) ? true : false; $this->m_bSorted = ($b & 0x20) ? true : false; @@ -355,7 +355,7 @@ class PWGIFIMAGE { public function load($data, &$datLen) { $datLen = 0; while(true) { - $b = ord($data{0}); + $b = ord($data[0]); $data = substr($data, 1); $datLen++; switch($b) { @@ -399,7 +399,7 @@ class PWGIFIMAGE { } function skipExt(&$data, &$extLen) { $extLen = 0; - $b = ord($data{0}); + $b = ord($data[0]); $data = substr($data, 1); $extLen++; switch($b) { @@ -409,10 +409,10 @@ class PWGIFIMAGE { $this->m_bUser = ($b & 0x02) ? true : false; $this->m_bTrans = ($b & 0x01) ? true : false; $this->m_nDelay = $this->w2i(substr($data, 2, 2)); - $this->m_nTrans = ord($data{4}); + $this->m_nTrans = ord($data[4]); break; case 0xFE: // Comment - $this->m_lpComm = substr($data, 1, ord($data{0})); + $this->m_lpComm = substr($data, 1, ord($data[0])); break; case 0x01: // Plain text break; @@ -420,13 +420,13 @@ class PWGIFIMAGE { break; } // SKIP DEFAULT AS DEFS MAY CHANGE - $b = ord($data{0}); + $b = ord($data[0]); $data = substr($data, 1); $extLen++; while($b > 0) { $data = substr($data, $b); $extLen += $b; - $b = ord($data{0}); + $b = ord($data[0]); $data = substr($data, 1); $extLen++; } diff --git a/wire/core/PageTraversal.php b/wire/core/PageTraversal.php index 9906d15a..3829c156 100644 --- a/wire/core/PageTraversal.php +++ b/wire/core/PageTraversal.php @@ -429,12 +429,16 @@ class PageTraversal { } else { $row = reset($rows); - $result = $pages->getById(array($row['id']), array( - 'template' => $page->wire('templates')->get($row['templates_id']), - 'parent_id' => $row['parent_id'], - 'getOne' => true, - 'cache' => $page->loaderCache - )); + if($row && !empty($row['id'])) { + $result = $pages->getById(array($row['id']), array( + 'template' => $page->wire('templates')->get($row['templates_id']), + 'parent_id' => $row['parent_id'], + 'getOne' => true, + 'cache' => $page->loaderCache + )); + } else { + $result = $pages->newNullPage(); + } } return $result;