Prado\Web\UI\TPageStateFormatter::unserialize PHP Метод

unserialize() публичный статический Метод

public static unserialize ( $page, $data ) : mixed
Результат mixed unserialized state data, null if data is corrupted
    public static function unserialize($page, $data)
    {
        $str = base64_decode($data);
        if ($str === '') {
            return null;
        }
        if ($str !== false) {
            $sm = $page->getApplication()->getSecurityManager();
            if ($page->getEnableStateEncryption()) {
                $str = $sm->decrypt($str);
            }
            if ($page->getEnableStateCompression() && extension_loaded('zlib')) {
                $str = @gzuncompress($str);
            }
            if ($page->getEnableStateValidation()) {
                if (($str = $sm->validateData($str)) !== false) {
                    return unserialize($str);
                }
            } else {
                return unserialize($str);
            }
        }
        return null;
    }

Usage Example

Пример #1
0
 /**
  * Loads page state from hidden fields.
  * @return mixed the restored state
  * @throws THttpException if page state is corrupted
  */
 public function load()
 {
     if (($data = TPageStateFormatter::unserialize($this->_page, $this->_page->getRequestClientState())) !== null) {
         return $data;
     } else {
         throw new THttpException(400, 'pagestatepersister_pagestate_corrupted');
     }
 }
All Usage Examples Of Prado\Web\UI\TPageStateFormatter::unserialize
TPageStateFormatter