|
21 | 21 | #include "zend_compile.h"
|
22 | 22 | #include "zend_vm.h"
|
23 | 23 | #include "zend_interfaces.h"
|
| 24 | +#include "zend_attributes.h" |
24 | 25 |
|
25 | 26 | #include "php.h"
|
26 | 27 | #ifdef ZEND_WIN32
|
@@ -158,22 +159,22 @@ static int zend_file_cache_flock(int fd, int type)
|
158 | 159 | } \
|
159 | 160 | } while (0)
|
160 | 161 |
|
161 |
| -#define SERIALIZE_ATTRIBUTES(attr) do { \ |
162 |
| - if ((attr) && !IS_SERIALIZED(attr)) { \ |
| 162 | +#define SERIALIZE_ATTRIBUTES(attributes) do { \ |
| 163 | + if ((attributes) && !IS_SERIALIZED(attributes)) { \ |
163 | 164 | HashTable *ht; \
|
164 |
| - SERIALIZE_PTR(attr); \ |
165 |
| - ht = (attr); \ |
| 165 | + SERIALIZE_PTR(attributes); \ |
| 166 | + ht = (attributes); \ |
166 | 167 | UNSERIALIZE_PTR(ht); \
|
167 |
| - zend_file_cache_serialize_hash(ht, script, info, buf, zend_file_cache_serialize_zval); \ |
| 168 | + zend_file_cache_serialize_hash(ht, script, info, buf, zend_file_cache_serialize_attribute); \ |
168 | 169 | } \
|
169 | 170 | } while (0)
|
170 | 171 |
|
171 |
| -#define UNSERIALIZE_ATTRIBUTES(attr) do { \ |
172 |
| - if ((attr) && !IS_UNSERIALIZED(attr)) { \ |
| 172 | +#define UNSERIALIZE_ATTRIBUTES(attributes) do { \ |
| 173 | + if ((attributes) && !IS_UNSERIALIZED(attributes)) { \ |
173 | 174 | HashTable *ht; \
|
174 |
| - UNSERIALIZE_PTR(attr); \ |
175 |
| - ht = (attr); \ |
176 |
| - zend_file_cache_unserialize_hash(ht, script, buf, zend_file_cache_unserialize_zval, ZVAL_PTR_DTOR); \ |
| 175 | + UNSERIALIZE_PTR(attributes); \ |
| 176 | + ht = (attributes); \ |
| 177 | + zend_file_cache_unserialize_hash(ht, script, buf, zend_file_cache_unserialize_attribute, NULL); \ |
177 | 178 | } \
|
178 | 179 | } while (0)
|
179 | 180 |
|
@@ -390,6 +391,33 @@ static void zend_file_cache_serialize_zval(zval *zv,
|
390 | 391 | }
|
391 | 392 | }
|
392 | 393 |
|
| 394 | +static void zend_file_cache_serialize_attribute(zval *zv, |
| 395 | + zend_persistent_script *script, |
| 396 | + zend_file_cache_metainfo *info, |
| 397 | + void *buf) |
| 398 | +{ |
| 399 | + if (!IS_SERIALIZED(Z_PTR_P(zv))) { |
| 400 | + zend_attribute *attr = Z_PTR_P(zv); |
| 401 | + uint32_t i; |
| 402 | + |
| 403 | + SERIALIZE_PTR(Z_PTR_P(zv)); |
| 404 | + attr = Z_PTR_P(zv); |
| 405 | + UNSERIALIZE_PTR(attr); |
| 406 | + |
| 407 | + if (!IS_SERIALIZED(attr->name)) { |
| 408 | + SERIALIZE_STR(attr->name); |
| 409 | + } |
| 410 | + |
| 411 | + if (!IS_SERIALIZED(attr->lcname)) { |
| 412 | + SERIALIZE_STR(attr->lcname); |
| 413 | + } |
| 414 | + |
| 415 | + for (i = 0; i < attr->argc; i++) { |
| 416 | + zend_file_cache_serialize_zval(&attr->argv[i], script, info, buf); |
| 417 | + } |
| 418 | + } |
| 419 | +} |
| 420 | + |
393 | 421 | static void zend_file_cache_serialize_type(
|
394 | 422 | zend_type *type, zend_persistent_script *script, zend_file_cache_metainfo *info, void *buf)
|
395 | 423 | {
|
@@ -613,7 +641,6 @@ static void zend_file_cache_serialize_prop_info(zval *zv,
|
613 | 641 | SERIALIZE_STR(prop->doc_comment);
|
614 | 642 | }
|
615 | 643 | SERIALIZE_ATTRIBUTES(prop->attributes);
|
616 |
| - |
617 | 644 | zend_file_cache_serialize_type(&prop->type, script, info, buf);
|
618 | 645 | }
|
619 | 646 | }
|
@@ -1118,6 +1145,29 @@ static void zend_file_cache_unserialize_zval(zval *zv,
|
1118 | 1145 | }
|
1119 | 1146 | }
|
1120 | 1147 |
|
| 1148 | +static void zend_file_cache_unserialize_attribute(zval *zv, zend_persistent_script *script, void *buf) |
| 1149 | +{ |
| 1150 | + if (!IS_UNSERIALIZED(Z_PTR_P(zv))) { |
| 1151 | + zend_attribute *attr; |
| 1152 | + uint32_t i; |
| 1153 | + |
| 1154 | + UNSERIALIZE_PTR(Z_PTR_P(zv)); |
| 1155 | + attr = Z_PTR_P(zv); |
| 1156 | + |
| 1157 | + if (!IS_UNSERIALIZED(attr->name)) { |
| 1158 | + UNSERIALIZE_STR(attr->name); |
| 1159 | + } |
| 1160 | + |
| 1161 | + if (!IS_UNSERIALIZED(attr->lcname)) { |
| 1162 | + UNSERIALIZE_STR(attr->lcname); |
| 1163 | + } |
| 1164 | + |
| 1165 | + for (i = 0; i < attr->argc; i++) { |
| 1166 | + zend_file_cache_unserialize_zval(&attr->argv[i], script, buf); |
| 1167 | + } |
| 1168 | + } |
| 1169 | +} |
| 1170 | + |
1121 | 1171 | static void zend_file_cache_unserialize_type(
|
1122 | 1172 | zend_type *type, zend_persistent_script *script, void *buf)
|
1123 | 1173 | {
|
|
0 commit comments