|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-08-12 07:27 UTC] alex dot demidovich at gmail dot com
[2017-04-01 19:22 UTC] tpunt@php.net
-Status: Open
+Status: Wont fix
[2017-04-01 19:22 UTC] tpunt@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 17:00:01 2025 UTC |
Description: ------------ 1. comparing to the 'stdClass' class name is done incorrectly. the word 'stdclass' instead of 'stdClass' is used. 2. Serializer doesn't not support the externalizable classes (AMF3 Specs). I made a patch fixing the problems, described above Reproduce code: --------------- Index: amfext/amf.c =================================================================== RCS file: /repository/pecl/amfext/amf.c,v retrieving revision 1.4 diff -u -p -r1.4 amf.c --- amfext/amf.c 23 Jul 2008 20:23:03 -0000 1.4 +++ amfext/amf.c 12 Aug 2008 09:15:10 -0000 @@ -100,7 +100,7 @@ enum AMF0Codes { AMF0_NUMBER, AMF0_BOOLE enum AMF3Codes { AMF3_UNDEFINED,AMF3_NULL,AMF3_FALSE,AMF3_TRUE,AMF3_INTEGER,AMF3_NUMBER,AMF3_STRING,AMF3_XML, AMF3_DATE, AMF3_ARRAY,AMF3_OBJECT, AMF3_XMLSTRING,AMF3_BYTEARRAY}; /** return values for callbacks */ -enum AMFCallbackResult { AMFC_RAW, AMFC_XML, AMFC_OBJECT, AMFC_TYPEDOBJECT, AMFC_ANY, AMFC_ARRAY,AMFC_NONE,AMFC_BYTEARRAY}; +enum AMFCallbackResult { AMFC_RAW, AMFC_XML, AMFC_OBJECT, AMFC_TYPEDOBJECT, AMFC_ANY, AMFC_ARRAY,AMFC_NONE,AMFC_BYTEARRAY, AMFC_EXTERNAL}; /** flags passed to amf_encode and amf_decode */ enum AMFFlags { AMF_AMF3 = 1, AMF_BIGENDIAN=2,AMF_ASSOC=4,AMF_POST_DECODE = 8,AMF_AS_STRING_BUILDER = 16, AMF_TRANSLATE_CHARSET = 32,AMF_TRANSLATE_CHARSET_FAST = 32|64}; @@ -1178,7 +1178,7 @@ static void amf3_serialize_object(amf_se return; } - if(strcmp(className, "stdclass") == 0) /* never for resource */ + if(strcmp(className, "stdClass") == 0) /* never for resource */ amf3_serialize_object_default(buf, Z_OBJPROP_PP(struc), "",0,var_hash TSRMLS_CC); else { @@ -1278,7 +1278,16 @@ static void amf3_serialize_object(amf_se php_error_docref(NULL TSRMLS_CC, E_NOTICE, "amf encoding callback. AMFC_TYPEDOBJECT requires an object or an array"); } break; - case AMFC_ANY: amf3_serialize_var(buf, resultValue, var_hash TSRMLS_CC); break; + case AMFC_ANY: + amf3_serialize_var(buf, resultValue, var_hash TSRMLS_CC); break; + + case AMFC_EXTERNAL: + // all three lower bits have to be 1 + amf3_write_objecthead(buf, 7 AMFTSRMLS_CC); + amf3_write_string(buf, className,classNameLen,AMF_STRING_AS_TEXT,var_hash TSRMLS_CC); + amf3_serialize_var(buf, resultValue, var_hash TSRMLS_CC); + break; + case AMFC_NONE: amf_write_byte(buf,AMF3_UNDEFINED); break; case AMFC_BYTEARRAY: if(Z_TYPE_PP(resultValue) == IS_STRING) @@ -1387,7 +1396,7 @@ static void amf0_serialize_object(amf_se return; } - if(strcmp(className, "stdclass") == 0) + if(strcmp(className, "stdClass") == 0) { amf_write_byte(buf,AMF0_OBJECT); amf0_serialize_objectdata(buf, Z_OBJPROP_PP(struc), 0, var_hash TSRMLS_CC);