Hi internals,
I realized we could not retrieve php_json_serializable_ce from other
extension module. JsonSerializeable interface is easy to serialize with
json_encode
. So I want to adding getter function.
The patch can be found here:
https://github.com/chobie/php-src/compare/adding-jsonserializeable-ce-getter
I want to have feedback on the idea.
Thanks,
Shuhei
Hi internals,
I realized we could not retrieve php_json_serializable_ce from other
extension module. JsonSerializeable interface is easy to serialize with
json_encode
. So I want to adding getter function.The patch can be found here:
https://github.com/chobie/php-src/compare/adding-jsonserializeable-ce-getter
I want to have feedback on the idea.
The code has an "extern zend_class_entry *php_json_serializable_ce;" right
above that line. Shouldn't that be enough?
Nikita
Yea, but my php binary doesn't export php_json_serializable_ce. Did I
missed something?
nm /Users/chobie/.phpenv/versions/5.5-zts-debug/bin/php | grep
php_json_serializable_ce
0000000100c00460 s _php_json_serializable_ce
2013/9/8 Nikita Popov nikita.ppv@gmail.com
Hi internals,
I realized we could not retrieve php_json_serializable_ce from other
extension module. JsonSerializeable interface is easy to serialize with
json_encode
. So I want to adding getter function.The patch can be found here:
https://github.com/chobie/php-src/compare/adding-jsonserializeable-ce-getter
I want to have feedback on the idea.
The code has an "extern zend_class_entry *php_json_serializable_ce;" right
above that line. Shouldn't that be enough?Nikita
The code has an "extern zend_class_entry *php_json_serializable_ce;" right
above that line. Shouldn't that be enough?
that only affects code in the same linker run (executable binary or .so)
as weak the linker to hide symbols. For stuff that should work in other
extensions one has to mark them as ZEND_API in the engine or PHPAPI in
core stuff, or a custom EXTENSIONNAME_API (see different
ext/foo/php_foo.h headers)
johannes
2013/9/8 Johannes Schlüter johannes@schlueters.de
that only affects code in the same linker run (executable binary or .so)
as weak the linker to hide symbols. For stuff that should work in other
extensions one has to mark them as ZEND_API in the engine or PHPAPI in
core stuff, or a custom EXTENSIONNAME_API (see different
ext/foo/php_foo.h headers)
Thanks pointing it! I marked php_json_serialize_ce to PHP_JSON_API then it
seems it can resolve.
https://github.com/chobie/php-src/commit/80023e80102c6ef6b0248b30ecf68b52d6ef8831
Let me assumed Protobuf extension (not PECL proposed yet) can implement
JsonSerializeable interface internally.
It's very easy to encode protobuf message as json. and, User-land code is
able to implement JsonSerialize.
It should be possible also other extensions, I think it's natural.
This is my first time to suggest feature request. What should I do next?
I have chobieeee@php.net account but maybe I don't have wiki karma.
Thanks,