Page MenuHomePhabricator

Explicitly fail if `phutil_build_http_querystring()` is passed a map of nonscalars
ClosedPublic

Authored by epriestley on Thu, Feb 7, 12:34 AM.

Details

Summary

See D20114. Somewhat (un-?) surprisingly, http_build_query() accepts an arbitrarily deeply-nested mess of arrays and encodes them in a PHP-specific way.

We generally don't want this to happen, so fail explicitly when it does.

Test Plan

Published a story on master (without D20114) with feed.http-hooks enabled, got a more helpful/explicit error.

Diff Detail

Repository
rPHU libphutil
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

epriestley created this revision.Thu, Feb 7, 12:34 AM
epriestley requested review of this revision.Thu, Feb 7, 12:34 AM
amckinley accepted this revision.Thu, Feb 7, 8:25 PM
This revision is now accepted and ready to land.Thu, Feb 7, 8:25 PM
This revision was automatically updated to reflect the committed changes.

This broke some custom fields. Specifically, this custom field results in Phabricator fataling:

{
  "test": {
    "name": "Test",
    "type": "users",
    "search": true
  }
}

The error message is:

>>> UNRECOVERABLE FATAL ERROR <<<

Method PhutilURI::__toString() must not throw an exception, caught Exception: HTTP query parameter (with key &quot;parameters&quot;) is not a scalar. Parameters must all be scalars.

/usr/local/src/phabricator/src/applications/typeahead/datasource/PhabricatorTypeaheadDatasource.php:0


┻━┻ ︵ ¯\_(ツ)_/¯ ︵ ┻━┻
mbi added a subscriber: mbi.Mon, Feb 11, 9:18 AM

This broke some custom fields. Specifically, this custom field results in Phabricator fataling:
[...]

"Land Revision" button is also broken, returns identical error...

>>> UNRECOVERABLE FATAL ERROR <<<

Method PhutilURI::__toString() must not throw an exception

/etc/phabricator/phabricator/src/applications/typeahead/datasource/PhabricatorTypeaheadDatasource.php:0


┻━┻ ︵ ¯\_(ツ)_/¯ ︵ ┻━┻

Please report bugs to Discourse, not by making comments on changes or commits. If you believe you know which change caused a problem, you can link to it from your bug report on Discourse. It's easy for us to keep track of threads, and hard to keep track of random comments on already-closed changes. Thanks!

Please report bugs to Discourse, not by making comments on changes or commits. If you believe you know which change caused a problem, you can link to it from your bug report on Discourse. It's easy for us to keep track of threads, and hard to keep track of random comments on already-closed changes. Thanks!

Fair enough