php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62352 AMQP Message body is not binary safe in PHP Land
Submitted: 2012-06-18 15:49 UTC Modified: 2012-06-19 19:24 UTC
From: jpauli@php.net Assigned: jpauli (profile)
Status: Closed Package: amqp (PECL)
PHP Version: 5.3.14 OS: *
Private report: No CVE-ID: None
 [2012-06-18 15:49 UTC] jpauli@php.net
Description:
------------
AMQPEnveloppe#body is not binary safe, so it cant contain NULL byte, which is 
embarrassing when you deal with PHP serialization format which may contain NULL 
bytes aka : a serialized object

Test script:
---------------
<?php

class Foo { private $bar="bar"; }

$c = new AMQPConnection(/* params */);
$c->connect();
$channel = new AMQPChannel($c);

$ex = new AMQPExchange($channel);
$ex->setName('test');
$ex->publish(serialize(new Foo), 'test');

$q = new AMQPQueue($channel);
$q->setName('test');
var_dump($q->get());

Expected result:
----------------
string(39) "O:3:"Foo":1:{s:8:"Foobar";s:3:"bar";}"

Actual result:
--------------
The result gets truncated at the first NULL byte met, thus the unserialize() will 
fail.

string(18) "O:3:"Foo":1:{s:8:""

Patches

Make-enveloppe-body-binary-safe (last revision 2012-06-18 15:50 UTC by jpauli@php.net)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-06-18 15:50 UTC] jpauli@php.net
The following patch has been added/updated:

Patch Name: Make-enveloppe-body-binary-safe
Revision:   1340034653
URL:        https://bugs.php.net/patch-display.php?bug=62352&patch=Make-enveloppe-body-binary-safe&revision=1340034653
 [2012-06-18 23:06 UTC] felipe@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: jpauli
 [2012-06-19 10:13 UTC] jpauli@php.net
Related to #62352
 [2012-06-19 19:24 UTC] pdezwart@php.net
Automatic comment from SVN on behalf of pdezwart
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=326257
Log: Bug #62352  AMQP Message body is not binary safe in PHP Land
 [2012-06-19 19:24 UTC] pdezwart@php.net
-Status: Assigned +Status: Closed
 [2012-06-19 19:24 UTC] pdezwart@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.

Fixed in trunk @ r326257. Thanks!
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Jul 25 14:01:23 2021 UTC