@@ -74,7 +74,7 @@ static bool phongo_binary_init_from_hash(phongo_binary_t* intern, HashTable* pro
7474 return false;
7575}
7676
77- static HashTable * phongo_binary_get_properties_hash (zend_object * object , bool is_temp )
77+ static HashTable * phongo_binary_get_properties_hash (zend_object * object , bool is_temp , bool is_debug )
7878{
7979 phongo_binary_t * intern ;
8080 HashTable * props ;
@@ -90,7 +90,12 @@ static HashTable* phongo_binary_get_properties_hash(zend_object* object, bool is
9090 {
9191 zval data , type ;
9292
93- ZVAL_STRINGL (& data , intern -> data , intern -> data_len );
93+ if (is_debug ) {
94+ ZVAL_NEW_STR (& data , php_base64_encode ((unsigned char * ) intern -> data , intern -> data_len ));
95+ } else {
96+ ZVAL_STRINGL (& data , intern -> data , intern -> data_len );
97+ }
98+
9499 zend_hash_str_update (props , "data" , sizeof ("data" ) - 1 , & data );
95100
96101 ZVAL_LONG (& type , intern -> type );
@@ -197,7 +202,7 @@ static PHP_METHOD(MongoDB_BSON_Binary, __serialize)
197202{
198203 PHONGO_PARSE_PARAMETERS_NONE ();
199204
200- RETURN_ARR (phongo_binary_get_properties_hash (Z_OBJ_P (getThis ()), true));
205+ RETURN_ARR (phongo_binary_get_properties_hash (Z_OBJ_P (getThis ()), true, false ));
201206}
202207
203208static PHP_METHOD (MongoDB_BSON_Binary , __unserialize )
@@ -284,7 +289,7 @@ static int phongo_binary_compare_objects(zval* o1, zval* o2)
284289static HashTable * phongo_binary_get_debug_info (zend_object * object , int * is_temp )
285290{
286291 * is_temp = 1 ;
287- HashTable * props = phongo_binary_get_properties_hash (object , true);
292+ HashTable * props = phongo_binary_get_properties_hash (object , true, true );
288293
289294 phongo_binary_t * intern = Z_OBJ_BINARY (object );
290295
@@ -317,7 +322,7 @@ static HashTable* phongo_binary_get_debug_info(zend_object* object, int* is_temp
317322
318323static HashTable * phongo_binary_get_properties (zend_object * object )
319324{
320- return phongo_binary_get_properties_hash (object , false);
325+ return phongo_binary_get_properties_hash (object , false, false );
321326}
322327
323328void phongo_binary_init_ce (INIT_FUNC_ARGS )
0 commit comments