Comments (7)
are you able to provide a small reproduce script?
from msgpack-php.
I am trying to ;). I have 5.5.5 and 5.5.6 compiled. Will update when I find a way to trigger it again.
from msgpack-php.
mkdir issue_49
cd issue_49
wget https://pecl.php.net/get/msgpack-0.5.{5,6}.tgz
for v in 5 6
do
tar -xvzf msgpack-0.5.$v.tgz
cd msgpack-0.5.$v
phpize
./configure
make
cd ..
php -n -dextension=msgpack-0.5.$v/modules/msgpack.so\
-r 'echo msgpack_pack([["item"=>["obj"=>(object)["y" => "YYYYYYY"],"str" =>["x" => "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"]]]]);'\
> msgpack$v
done
php -n -dextension=msgpack-0.5.5/modules/msgpack.so\
-r "msgpack_unpack(file_get_contents("msgpack6"));"
Enjoy :).
from msgpack-php.
In some cases I also get a message about bad msgpack structure.
For example... ["item"=>["str" =>["x" => "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"]]] gives:
Warning: msgpack Parse error in Command line code on line 1
from msgpack-php.
It's the str8, you added encode support in the last revision. This shaves a byte for strings < 256.
# cat msgpack5 | xxd
0000000: 9181 a469 7465 6d82 a36f 626a 82c0 a873 ...item..obj...s
0000010: 7464 436c 6173 73a1 79a7 5959 5959 5959 tdClass.y.YYYYYY
0000020: 59a3 7374 7281 a178 da00 3658 5858 5858 Y.str..x..6XXXXX
0000030: 5858 5858 5858 5858 5858 5858 5858 5858 XXXXXXXXXXXXXXXX
0000040: 5858 5858 5858 5858 5858 5858 5858 5858 XXXXXXXXXXXXXXXX
0000050: 5858 5858 5858 5858 5858 5858 5858 5858 XXXXXXXXXXXXXXXX
0000060: 58 X
# cat msgpack6 | xxd
0000000: 9181 a469 7465 6d82 a36f 626a 82c0 a873 ...item..obj...s
0000010: 7464 436c 6173 73a1 79a7 5959 5959 5959 tdClass.y.YYYYYY
0000020: 59a3 7374 7281 a178 d936 5858 5858 5858 Y.str..x.6XXXXXX
0000030: 5858 5858 5858 5858 5858 5858 5858 5858 XXXXXXXXXXXXXXXX
0000040: 5858 5858 5858 5858 5858 5858 5858 5858 XXXXXXXXXXXXXXXX
0000050: 5858 5858 5858 5858 5858 5858 5858 5858 XXXXXXXXXXXXXXXX
da (str16) to d9 (str8)
So 0.5.5 compatibility is broken but also it should not really segfault either :(.
When making such a change I really think it would be a good idea to attribute it to a less minor version component.
That is, 5.5.6 should be 5.6.0.
from msgpack-php.
Hey @laruence when looking at implementing this I think I have two options. I need to add a conditional on https://github.com/msgpack/msgpack-php/blob/master/msgpack/pack_template.h#L733 I have two ideas on how I could accomplish this. Either way I have to edit this 'upstream' header file. (I would like to avoid this, but it seems like other implementations are doing the same thing?)
I could either make msgpack_pack_user a struct that contains the zend_string and a boolean use_str8_serialization
OR
just put a call to MSGPACK_G(use_str8_serialization)
Also what do you think of the STD_PHP_INI_BOOLEAN name use_str8_serialization
from msgpack-php.
Hey!
The msgpack spec calls for a compatibility mode so serialization doesn't create data that older deserializers can't handle.
You can see that in action here
@joeyhub
So the segfault is no good, but there isn't anything we can do in the old versions. I will however check and make sure that this segfault doesn't occur for any other 'first bytes'!
@mattheworiordan
Just a heads up this is done! Looking at the issue you posted you hopefully should be unblocked, but also super happy to tackle anything you throw my way :)
thanks.
from msgpack-php.
Related Issues (20)
- Recursion encoded as NULL
- 034.phpt fails HOT 1
- Consider making MessagePackUnpacker cloneable
- Memory Consumption Problem in 2.1.0 HOT 1
- msgpack (un)pack error HOT 11
- try to compile from source by zts-phpize HOT 2
- php_add_session_var: symbol not found HOT 1
- More and more memory, there seems to be a leak HOT 1
- PHP 8 recursion
- my code is printed ,but out to show the garbled code, why? HOT 2
- How to get in touch about a security issue? HOT 2
- Support PHP 8.1's ZEND_ACC_NOT_SERIALIZABLE flag on zend_class_entries
- uint32 numbers are incorrectly serialized on Windows HOT 1
- PHP 8.2 - msgpack_check_ht_is_map assertion error in ZEND_HASH_FOREACH_BUCKET
- PHP 8.2: msgpack_unpack: Support deprecation of dynamic properties, forbid dynamic properties in `readonly` classes HOT 1
- MsgPack TS non TS fail HOT 5
- Compilation error reported HOT 3
- Question: release 2.2.0
- Serializing/Unserializing Enum
- Windows DLL available to download
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from msgpack-php.