Version Notes
1.9.2.2
Download this release
Release Info
Developer | Magento Core Team |
Extension | Lib_Unserialize |
Version | 1.9.2.2 |
Comparing to | |
See all releases |
Version 1.9.2.2
- lib/Unserialize/Parser.php +61 -0
- lib/Unserialize/Reader/Arr.php +122 -0
- lib/Unserialize/Reader/ArrKey.php +84 -0
- lib/Unserialize/Reader/ArrValue.php +100 -0
- lib/Unserialize/Reader/Bool.php +66 -0
- lib/Unserialize/Reader/Dbl.php +66 -0
- lib/Unserialize/Reader/Int.php +66 -0
- lib/Unserialize/Reader/Str.php +93 -0
- package.xml +18 -0
lib/Unserialize/Parser.php
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magento.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magento.com for more information.
|
20 |
+
*
|
21 |
+
* @category Unserialize
|
22 |
+
* @package Unserialize_Parser
|
23 |
+
* @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Class Unserialize_Parser
|
29 |
+
*/
|
30 |
+
class Unserialize_Parser
|
31 |
+
{
|
32 |
+
const TYPE_STRING = 's';
|
33 |
+
const TYPE_INT = 'i';
|
34 |
+
const TYPE_DOUBLE = 'd';
|
35 |
+
const TYPE_ARRAY = 'a';
|
36 |
+
const TYPE_BOOL = 'b';
|
37 |
+
|
38 |
+
const SYMBOL_QUOTE = '"';
|
39 |
+
const SYMBOL_SEMICOLON = ';';
|
40 |
+
const SYMBOL_COLON = ':';
|
41 |
+
|
42 |
+
/**
|
43 |
+
* @param $str
|
44 |
+
* @return array|null
|
45 |
+
* @throws Exception
|
46 |
+
*/
|
47 |
+
public function unserialize($str)
|
48 |
+
{
|
49 |
+
$reader = new Unserialize_Reader_Arr();
|
50 |
+
$prevChar = null;
|
51 |
+
for ($i = 0; $i < strlen($str); $i++) {
|
52 |
+
$char = $str[$i];
|
53 |
+
$arr = $reader->read($char, $prevChar);
|
54 |
+
if (!is_null($arr)) {
|
55 |
+
return $arr;
|
56 |
+
}
|
57 |
+
$prevChar = $char;
|
58 |
+
}
|
59 |
+
throw new Exception('Error during unserialization');
|
60 |
+
}
|
61 |
+
}
|
lib/Unserialize/Reader/Arr.php
ADDED
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magento.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magento.com for more information.
|
20 |
+
*
|
21 |
+
* @category Unserialize
|
22 |
+
* @package Unserialize_Reader
|
23 |
+
* @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Class Unserialize_Reader_Arr
|
29 |
+
*/
|
30 |
+
class Unserialize_Reader_Arr
|
31 |
+
{
|
32 |
+
/**
|
33 |
+
* @var array
|
34 |
+
*/
|
35 |
+
protected $_result = null;
|
36 |
+
|
37 |
+
/**
|
38 |
+
* @var string|int
|
39 |
+
*/
|
40 |
+
protected $_length = '';
|
41 |
+
|
42 |
+
/**
|
43 |
+
* @var int|null
|
44 |
+
*/
|
45 |
+
protected $_status = null;
|
46 |
+
|
47 |
+
/**
|
48 |
+
* @var object
|
49 |
+
*/
|
50 |
+
protected $_reader = null;
|
51 |
+
|
52 |
+
const READING_LENGTH = 1;
|
53 |
+
const FINISHED_LENGTH = 2;
|
54 |
+
const READING_KEY = 3;
|
55 |
+
const READING_VALUE = 4;
|
56 |
+
const FINISHED_ARR = 5;
|
57 |
+
|
58 |
+
/**
|
59 |
+
* @param $char
|
60 |
+
* @param $prevChar
|
61 |
+
* @return array|null
|
62 |
+
* @throws Exception
|
63 |
+
*/
|
64 |
+
public function read($char, $prevChar)
|
65 |
+
{
|
66 |
+
$this->_result = !is_null($this->_result) ? $this->_result : array();
|
67 |
+
|
68 |
+
if (is_null($this->_status) && $prevChar == Unserialize_Parser::SYMBOL_COLON) {
|
69 |
+
$this->_length .= $char;
|
70 |
+
$this->_status = self::READING_LENGTH;
|
71 |
+
return null;
|
72 |
+
}
|
73 |
+
|
74 |
+
if ($this->_status == self::READING_LENGTH) {
|
75 |
+
if ($char == Unserialize_Parser::SYMBOL_COLON) {
|
76 |
+
$this->_length = (int)$this->_length;
|
77 |
+
if ($this->_length == 0) {
|
78 |
+
$this->_status = self::FINISHED_ARR;
|
79 |
+
return null;
|
80 |
+
}
|
81 |
+
$this->_status = self::FINISHED_LENGTH;
|
82 |
+
} else {
|
83 |
+
$this->_length .= $char;
|
84 |
+
}
|
85 |
+
}
|
86 |
+
|
87 |
+
if ($this->_status == self::FINISHED_LENGTH && $prevChar == '{') {
|
88 |
+
$this->_reader = new Unserialize_Reader_ArrKey();
|
89 |
+
$this->_status = self::READING_KEY;
|
90 |
+
}
|
91 |
+
|
92 |
+
if ($this->_status == self::READING_KEY) {
|
93 |
+
$key = $this->_reader->read($char, $prevChar);
|
94 |
+
if (!is_null($key)) {
|
95 |
+
$this->_status = self::READING_VALUE;
|
96 |
+
$this->_reader = new Unserialize_Reader_ArrValue($key);
|
97 |
+
return null;
|
98 |
+
}
|
99 |
+
}
|
100 |
+
|
101 |
+
if ($this->_status == self::READING_VALUE) {
|
102 |
+
$value = $this->_reader->read($char, $prevChar);
|
103 |
+
if (!is_null($value)) {
|
104 |
+
$this->_result[$this->_reader->key] = $value;
|
105 |
+
if (count($this->_result) < $this->_length) {
|
106 |
+
$this->_reader = new Unserialize_Reader_ArrKey();
|
107 |
+
$this->_status = self::READING_KEY;
|
108 |
+
return null;
|
109 |
+
} else {
|
110 |
+
$this->_status = self::FINISHED_ARR;
|
111 |
+
return null;
|
112 |
+
}
|
113 |
+
}
|
114 |
+
}
|
115 |
+
|
116 |
+
if ($this->_status == self::FINISHED_ARR) {
|
117 |
+
if ($char == '}') {
|
118 |
+
return $this->_result;
|
119 |
+
}
|
120 |
+
}
|
121 |
+
}
|
122 |
+
}
|
lib/Unserialize/Reader/ArrKey.php
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magento.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magento.com for more information.
|
20 |
+
*
|
21 |
+
* @category Unserialize
|
22 |
+
* @package Unserialize_Reader
|
23 |
+
* @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Class Unserialize_Reader_ArrKey
|
29 |
+
*/
|
30 |
+
class Unserialize_Reader_ArrKey
|
31 |
+
{
|
32 |
+
/**
|
33 |
+
* @var int
|
34 |
+
*/
|
35 |
+
protected $_status;
|
36 |
+
|
37 |
+
/**
|
38 |
+
* @object
|
39 |
+
*/
|
40 |
+
protected $_reader;
|
41 |
+
|
42 |
+
const NOT_STARTED = 1;
|
43 |
+
const READING_KEY = 2;
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Construct
|
47 |
+
*/
|
48 |
+
public function __construct()
|
49 |
+
{
|
50 |
+
$this->_status = self::NOT_STARTED;
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* @param string $char
|
55 |
+
* @param string $prevChar
|
56 |
+
* @return mixed|null
|
57 |
+
* @throws Exception
|
58 |
+
*/
|
59 |
+
public function read($char, $prevChar)
|
60 |
+
{
|
61 |
+
if ($this->_status == self::NOT_STARTED) {
|
62 |
+
switch ($char) {
|
63 |
+
case Unserialize_Parser::TYPE_STRING:
|
64 |
+
$this->_reader = new Unserialize_Reader_Str();
|
65 |
+
$this->_status = self::READING_KEY;
|
66 |
+
break;
|
67 |
+
case Unserialize_Parser::TYPE_INT:
|
68 |
+
$this->_reader = new Unserialize_Reader_Int();
|
69 |
+
$this->_status = self::READING_KEY;
|
70 |
+
break;
|
71 |
+
default:
|
72 |
+
throw new Exception('Unsupported data type ' . $char);
|
73 |
+
}
|
74 |
+
}
|
75 |
+
|
76 |
+
if ($this->_status == self::READING_KEY) {
|
77 |
+
$key = $this->_reader->read($char, $prevChar);
|
78 |
+
if (!is_null($key)) {
|
79 |
+
return $key;
|
80 |
+
}
|
81 |
+
}
|
82 |
+
return null;
|
83 |
+
}
|
84 |
+
}
|
lib/Unserialize/Reader/ArrValue.php
ADDED
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magento.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magento.com for more information.
|
20 |
+
*
|
21 |
+
* @category Unserialize
|
22 |
+
* @package Unserialize_Reader
|
23 |
+
* @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Class Unserialize_Reader_ArrValue
|
29 |
+
*/
|
30 |
+
class Unserialize_Reader_ArrValue
|
31 |
+
{
|
32 |
+
|
33 |
+
/**
|
34 |
+
* @var
|
35 |
+
*/
|
36 |
+
public $key;
|
37 |
+
|
38 |
+
/**
|
39 |
+
* @var int
|
40 |
+
*/
|
41 |
+
protected $_status;
|
42 |
+
|
43 |
+
/**
|
44 |
+
* @object
|
45 |
+
*/
|
46 |
+
protected $_reader;
|
47 |
+
|
48 |
+
const NOT_STARTED = 1;
|
49 |
+
const READING_VALUE = 2;
|
50 |
+
|
51 |
+
public function __construct($key)
|
52 |
+
{
|
53 |
+
$this->_status = self::NOT_STARTED;
|
54 |
+
$this->key = $key;
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* @param string $char
|
59 |
+
* @param string $prevChar
|
60 |
+
* @return mixed|null
|
61 |
+
* @throws Exception
|
62 |
+
*/
|
63 |
+
public function read($char, $prevChar)
|
64 |
+
{
|
65 |
+
if ($this->_status == self::NOT_STARTED) {
|
66 |
+
switch ($char) {
|
67 |
+
case Unserialize_Parser::TYPE_STRING:
|
68 |
+
$this->_reader = new Unserialize_Reader_Str();
|
69 |
+
$this->_status = self::READING_VALUE;
|
70 |
+
break;
|
71 |
+
case Unserialize_Parser::TYPE_ARRAY:
|
72 |
+
$this->_reader = new Unserialize_Reader_Arr();
|
73 |
+
$this->_status = self::READING_VALUE;
|
74 |
+
break;
|
75 |
+
case Unserialize_Parser::TYPE_INT:
|
76 |
+
$this->_reader = new Unserialize_Reader_Int();
|
77 |
+
$this->_status = self::READING_VALUE;
|
78 |
+
break;
|
79 |
+
case Unserialize_Parser::TYPE_BOOL:
|
80 |
+
$this->_reader = new Unserialize_Reader_Bool();
|
81 |
+
$this->_status = self::READING_VALUE;
|
82 |
+
break;
|
83 |
+
case Unserialize_Parser::TYPE_DOUBLE:
|
84 |
+
$this->_reader = new Unserialize_Reader_Dbl();
|
85 |
+
$this->_status = self::READING_VALUE;
|
86 |
+
break;
|
87 |
+
default:
|
88 |
+
throw new Exception('Unsupported data type ' . $char);
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
if ($this->_status == self::READING_VALUE) {
|
93 |
+
$value = $this->_reader->read($char, $prevChar);
|
94 |
+
if (!is_null($value)) {
|
95 |
+
return $value;
|
96 |
+
}
|
97 |
+
}
|
98 |
+
return null;
|
99 |
+
}
|
100 |
+
}
|
lib/Unserialize/Reader/Bool.php
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magento.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magento.com for more information.
|
20 |
+
*
|
21 |
+
* @category Unserialize
|
22 |
+
* @package Unserialize_Reader
|
23 |
+
* @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Class Unserialize_Reader_Int
|
29 |
+
*/
|
30 |
+
class Unserialize_Reader_Bool
|
31 |
+
{
|
32 |
+
/**
|
33 |
+
* @var int
|
34 |
+
*/
|
35 |
+
protected $_status;
|
36 |
+
|
37 |
+
/**
|
38 |
+
* @var string|int
|
39 |
+
*/
|
40 |
+
protected $_value;
|
41 |
+
|
42 |
+
const READING_VALUE = 1;
|
43 |
+
|
44 |
+
/**
|
45 |
+
* @param string $char
|
46 |
+
* @param string $prevChar
|
47 |
+
* @return int|null
|
48 |
+
*/
|
49 |
+
public function read($char, $prevChar)
|
50 |
+
{
|
51 |
+
if ($prevChar == Unserialize_Parser::SYMBOL_COLON) {
|
52 |
+
$this->_value .= $char;
|
53 |
+
$this->_status = self::READING_VALUE;
|
54 |
+
return null;
|
55 |
+
}
|
56 |
+
|
57 |
+
if ($this->_status == self::READING_VALUE) {
|
58 |
+
if ($char !== Unserialize_Parser::SYMBOL_SEMICOLON) {
|
59 |
+
$this->_value .= $char;
|
60 |
+
} else {
|
61 |
+
return (bool)$this->_value;
|
62 |
+
}
|
63 |
+
}
|
64 |
+
return null;
|
65 |
+
}
|
66 |
+
}
|
lib/Unserialize/Reader/Dbl.php
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magento.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magento.com for more information.
|
20 |
+
*
|
21 |
+
* @category Unserialize
|
22 |
+
* @package Unserialize_Reader
|
23 |
+
* @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Class Unserialize_Reader_Dbl
|
29 |
+
*/
|
30 |
+
class Unserialize_Reader_Dbl
|
31 |
+
{
|
32 |
+
/**
|
33 |
+
* @var int
|
34 |
+
*/
|
35 |
+
protected $_status;
|
36 |
+
|
37 |
+
/**
|
38 |
+
* @var string|int
|
39 |
+
*/
|
40 |
+
protected $_value;
|
41 |
+
|
42 |
+
const READING_VALUE = 1;
|
43 |
+
|
44 |
+
/**
|
45 |
+
* @param string $char
|
46 |
+
* @param string $prevChar
|
47 |
+
* @return float|null
|
48 |
+
*/
|
49 |
+
public function read($char, $prevChar)
|
50 |
+
{
|
51 |
+
if ($prevChar == Unserialize_Parser::SYMBOL_COLON) {
|
52 |
+
$this->_value .= $char;
|
53 |
+
$this->_status = self::READING_VALUE;
|
54 |
+
return null;
|
55 |
+
}
|
56 |
+
|
57 |
+
if ($this->_status == self::READING_VALUE) {
|
58 |
+
if ($char !== Unserialize_Parser::SYMBOL_SEMICOLON) {
|
59 |
+
$this->_value .= $char;
|
60 |
+
} else {
|
61 |
+
return (float)$this->_value;
|
62 |
+
}
|
63 |
+
}
|
64 |
+
return null;
|
65 |
+
}
|
66 |
+
}
|
lib/Unserialize/Reader/Int.php
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magento.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magento.com for more information.
|
20 |
+
*
|
21 |
+
* @category Unserialize
|
22 |
+
* @package Unserialize_Reader
|
23 |
+
* @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Class Unserialize_Reader_Int
|
29 |
+
*/
|
30 |
+
class Unserialize_Reader_Int
|
31 |
+
{
|
32 |
+
/**
|
33 |
+
* @var int
|
34 |
+
*/
|
35 |
+
protected $_status;
|
36 |
+
|
37 |
+
/**
|
38 |
+
* @var string|int
|
39 |
+
*/
|
40 |
+
protected $_value;
|
41 |
+
|
42 |
+
const READING_VALUE = 1;
|
43 |
+
|
44 |
+
/**
|
45 |
+
* @param string $char
|
46 |
+
* @param string $prevChar
|
47 |
+
* @return int|null
|
48 |
+
*/
|
49 |
+
public function read($char, $prevChar)
|
50 |
+
{
|
51 |
+
if ($prevChar == Unserialize_Parser::SYMBOL_COLON) {
|
52 |
+
$this->_value .= $char;
|
53 |
+
$this->_status = self::READING_VALUE;
|
54 |
+
return null;
|
55 |
+
}
|
56 |
+
|
57 |
+
if ($this->_status == self::READING_VALUE) {
|
58 |
+
if ($char !== Unserialize_Parser::SYMBOL_SEMICOLON) {
|
59 |
+
$this->_value .= $char;
|
60 |
+
} else {
|
61 |
+
return (int)$this->_value;
|
62 |
+
}
|
63 |
+
}
|
64 |
+
return null;
|
65 |
+
}
|
66 |
+
}
|
lib/Unserialize/Reader/Str.php
ADDED
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magento.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magento.com for more information.
|
20 |
+
*
|
21 |
+
* @category Unserialize
|
22 |
+
* @package Unserialize_Reader
|
23 |
+
* @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Class Unserialize_Reader_Str
|
29 |
+
*/
|
30 |
+
class Unserialize_Reader_Str
|
31 |
+
{
|
32 |
+
/**
|
33 |
+
* @var int|null
|
34 |
+
*/
|
35 |
+
protected $_status = null;
|
36 |
+
|
37 |
+
/**
|
38 |
+
* @var int|string
|
39 |
+
*/
|
40 |
+
protected $_length;
|
41 |
+
|
42 |
+
/**
|
43 |
+
* @var string
|
44 |
+
*/
|
45 |
+
protected $_value;
|
46 |
+
|
47 |
+
const READING_LENGTH = 1;
|
48 |
+
const FINISHED_LENGTH = 2;
|
49 |
+
const READING_VALUE = 3;
|
50 |
+
|
51 |
+
/**
|
52 |
+
* @param string $char
|
53 |
+
* @param string $prevChar
|
54 |
+
* @return null|string
|
55 |
+
*/
|
56 |
+
public function read($char, $prevChar)
|
57 |
+
{
|
58 |
+
|
59 |
+
if (is_null($this->_status) && $prevChar == Unserialize_Parser::SYMBOL_COLON) {
|
60 |
+
$this->_status = self::READING_LENGTH;
|
61 |
+
}
|
62 |
+
|
63 |
+
if ($this->_status == self::READING_LENGTH) {
|
64 |
+
if ($char != Unserialize_Parser::SYMBOL_COLON) {
|
65 |
+
$this->_length .= $char;
|
66 |
+
} else {
|
67 |
+
$this->_length = (int)$this->_length;
|
68 |
+
$this->_status = self::FINISHED_LENGTH;
|
69 |
+
}
|
70 |
+
}
|
71 |
+
|
72 |
+
if ($this->_status == self::FINISHED_LENGTH) {
|
73 |
+
if ($char == Unserialize_Parser::SYMBOL_QUOTE) {
|
74 |
+
$this->_status = self::READING_VALUE;
|
75 |
+
return null;
|
76 |
+
}
|
77 |
+
}
|
78 |
+
|
79 |
+
if ($this->_status == self::READING_VALUE) {
|
80 |
+
if (strlen($this->_value) < $this->_length) {
|
81 |
+
$this->_value .= $char;
|
82 |
+
return null;
|
83 |
+
}
|
84 |
+
|
85 |
+
if (strlen($this->_value) == $this->_length) {
|
86 |
+
if ($char == Unserialize_Parser::SYMBOL_SEMICOLON && $prevChar == Unserialize_Parser::SYMBOL_QUOTE) {
|
87 |
+
return (string)$this->_value;
|
88 |
+
}
|
89 |
+
}
|
90 |
+
}
|
91 |
+
return null;
|
92 |
+
}
|
93 |
+
}
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Lib_Unserialize</name>
|
4 |
+
<version>1.9.2.2</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">Magento Core Edition</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Magento Library</summary>
|
10 |
+
<description>Magento Library</description>
|
11 |
+
<notes>1.9.2.2</notes>
|
12 |
+
<authors><author><name>Magento Core Team</name><user>core</user><email>core@magentocommerce.com</email></author></authors>
|
13 |
+
<date>2015-10-27</date>
|
14 |
+
<time>13:46:56</time>
|
15 |
+
<contents><target name="magelib"><dir name="Unserialize"><file name="Parser.php" hash="7835b3655ea5b783451276a9446b2843"/><dir name="Reader"><file name="Arr.php" hash="3f06ce392f46e52c45cf9bd5ac2f43f4"/><file name="ArrKey.php" hash="226d8c46536217932fb24a1523b88923"/><file name="ArrValue.php" hash="eee99ce7d0335308fed8c12c9002cf07"/><file name="Bool.php" hash="c90a70f55b17252c5879b7ebed0496d9"/><file name="Dbl.php" hash="4140ef1d60de478a7db78e8b1ec8b933"/><file name="Int.php" hash="a44f11eaf40b5e4ab95ed2044b434bc4"/><file name="Str.php" hash="6055df0311d20fb8343665022885adf5"/></dir></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|