1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 01:39:24 +02:00
Oinktube/objects/cboden/ratchet/src/Ratchet/Session/Serialize/PhpBinaryHandler.php
DanielnetoDotCom 730f4893f2 Adding socket support
-- When upload a video to a certain category, this video will be part of a user group automatically
-- one category can add your video in more than one user group
-- Allow user add some extra info in JSON format, for example bank info and other thing
-- This is based on users_extra_info table 
-- add full text search https://github.com/WWBN/AVideo/issues/4343
2021-01-14 14:24:07 -03:00

33 lines
917 B
PHP

<?php
namespace Ratchet\Session\Serialize;
class PhpBinaryHandler implements HandlerInterface {
/**
* {@inheritdoc}
*/
function serialize(array $data) {
throw new \RuntimeException("Serialize PhpHandler:serialize code not written yet, write me!");
}
/**
* {@inheritdoc}
* @link http://ca2.php.net/manual/en/function.session-decode.php#108037 Code from this comment on php.net
*/
public function unserialize($raw) {
$returnData = array();
$offset = 0;
while ($offset < strlen($raw)) {
$num = ord($raw[$offset]);
$offset += 1;
$varname = substr($raw, $offset, $num);
$offset += $num;
$data = unserialize(substr($raw, $offset));
$returnData[$varname] = $data;
$offset += strlen(serialize($data));
}
return $returnData;
}
}