[drupal-devel] bug in xmlrpc_value_calculate_type() for empty arrays

Axel Kollmorgen axel at kollmorgen.net
Sat Oct 15 13:56:46 UTC 2005


while trying to post to Drupal via blogapi/ecto 1.8.2, i discovered a 
bug in xmlrpc_value_calculate_type() that makes posting impossible. it 
happens here:

case 'array':
   return range(0, count($xmlrpc_value->data) - 1) === 
array_keys($xmlrpc_value->data) ? 'array' : 'struct';

for empty arrays, this returns 'struct' while it should return 'array'. 
because:

$xmlrpc_value->data: array ()
range(0, count($xmlrpc_value->data) - 1): array (0, -1)
array_keys($xmlrpc_value->data): array ()

latter 2 apparently aren't identical. i'm a little uninspired at the 
moment, especially regarding this range() construct, and thought i post 
this here before i post a bug report and give it a try myself. maybe 
someone else (who wrote this? :)) is faster than me.

a nice weekend everyone!

-- 
ax

[Maris's gardener Yoshi passed away]   Dr. Niles Crane: He had a heart 
attack when he was out trimming Maris's elaborate hedge maze. The 
paramedics never had a chance.




More information about the drupal-devel mailing list