From: Michael Wallner Date: Tue, 21 Dec 2021 07:56:15 +0000 (+0100) Subject: encode the return value ofg serializables as clob X-Git-Tag: v0.1.0~60 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=2ac597859f524df372ccd421143bebcb2647e681;hp=2a37e54dbc0c6cb355bb715565fb108328250f01;p=awesomized%2Fext-ion encode the return value ofg serializables as clob strings are supposed to be UTF-8 and serialiables cannot return ion\LOB objects --- diff --git a/ion_private.h b/ion_private.h index 6743cc6..3f13897 100644 --- a/ion_private.h +++ b/ion_private.h @@ -1378,7 +1378,7 @@ static inline void php_ion_serialize_object_iface(php_ion_serializer *ser, zend_ ION_STRING is; ION_CHECK(ion_writer_add_annotation_symbol(ser->writer, &PHP_ION_SYMBOL_SERIALIZEABLE)); ION_CHECK(ion_writer_add_annotation(ser->writer, ion_string_from_zend(&is, zobject->ce->name))); - ION_CHECK(ion_writer_write_string(ser->writer, ion_string_assign_cstr(&is, (char *) buf, len))); + ION_CHECK(ion_writer_write_clob(ser->writer, buf, len)); efree(buf); } else if (!EG(exception)){ zend_throw_exception_ex(spl_ce_UnexpectedValueException, IERR_INTERNAL_ERROR, diff --git a/tests/serialize/serializable.phpt b/tests/serialize/serializable.phpt index efb9f27..0a700de 100644 --- a/tests/serialize/serializable.phpt +++ b/tests/serialize/serializable.phpt @@ -59,7 +59,7 @@ Deprecated: test implements the Serializable interface, which is deprecated. Imp Deprecated: recursive implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in %sserialize/serializable.php on line %d -[S::test::"foobar",r::1] +[S::test::{{"foobar"}},r::1] array(2) refcount(2){ [0]=> object(test)#%d (1) refcount(2){ @@ -83,7 +83,7 @@ object(recursive)#%d (2) { NULL } } -S::recursive::"node:S::recursive::\"leaf\"" +S::recursive::{{"node:S::recursive::{{\"leaf\"}}"}} object(recursive)#%d (2) refcount(1){ ["id":"recursive":private]=> string(4) "node" refcount(1)