[drupal-devel] bug in xmlrpc_value_calculate_type() for empty arrays
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.
Heh. See http://drupal.org/node/28464
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.
On 15.10.2005 16:48, John VanDyk wrote:
Heh. See http://drupal.org/node/28464
thats not it - it happens w/ latest HEAD and 4.6 (and 4.5?). it's not the ===, but the range() that returns array (0, -1) for empty arrays where it should return array (). or a different check alltogether. -- ax A woman either loves or hates; she knows no medium. - Publilius
On 15.10.2005 15:55, Axel Kollmorgen wrote:
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.
patch @ http://drupal.org/node/34214 . i'd appreciate reviews (and application :)). thanks! -- ax Eventually, I think Chicago will be the most beautiful great city left in the world - Frank Lloyd Wright (1939)
participants (2)
-
Axel Kollmorgen -
John VanDyk