Changeset View
Changeset View
Standalone View
Standalone View
src/conduit/ConduitClient.php
Show First 20 Lines • Show All 342 Lines • ▼ Show 20 Lines | private static function encodeRequestDataForSignature( | ||||
return self::encodeRawDataForSignature($structure); | return self::encodeRawDataForSignature($structure); | ||||
} | } | ||||
public static function encodeRawDataForSignature($data) { | public static function encodeRawDataForSignature($data) { | ||||
$out = array(); | $out = array(); | ||||
if (is_array($data)) { | if (is_array($data)) { | ||||
if (!$data || (array_keys($data) == range(0, count($data) - 1))) { | if (phutil_is_natural_list($data)) { | ||||
epriestley: This accidentally fixed a bug, since PHP is a lovable trickster:
```
$ php -r 'echo (array… | |||||
$out[] = 'A'; | $out[] = 'A'; | ||||
$out[] = count($data); | $out[] = count($data); | ||||
$out[] = ':'; | $out[] = ':'; | ||||
foreach ($data as $value) { | foreach ($data as $value) { | ||||
$out[] = self::encodeRawDataForSignature($value); | $out[] = self::encodeRawDataForSignature($value); | ||||
} | } | ||||
} else { | } else { | ||||
ksort($data); | ksort($data); | ||||
Show All 36 Lines |
This accidentally fixed a bug, since PHP is a lovable trickster:
That is, this should have been ===.
This bug isn't a huge issue, but it does change the signature algorithm.