Page MenuHomePhabricator

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

Authored by epriestley on Feb 7 2019, 12:34 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Mar 16, 10:49 AM
Unknown Object (File)
Fri, Mar 1, 4:41 AM
Unknown Object (File)
Feb 21 2024, 12:45 PM
Unknown Object (File)
Feb 8 2024, 6:05 PM
Unknown Object (File)
Feb 3 2024, 9:14 PM
Unknown Object (File)
Feb 3 2024, 9:14 PM
Unknown Object (File)
Feb 3 2024, 9:14 PM
Unknown Object (File)
Jan 22 2024, 9:09 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
Branch
hook3
Lint
Lint Errors
SeverityLocationCodeMessage
Errorsrc/utils/utils.php:1332XHP45PHP Compatibility
Errorsrc/utils/utils.php:1332XHP45PHP Compatibility
Unit
Tests Passed
Build Status
Buildable 21868
Build 29847: Run Core Tests
Build 29846: arc lint + arc unit

Event Timeline

This revision is now accepted and ready to land.Feb 7 2019, 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


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

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

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

image.png (327×348 px, 19 KB)

>>> 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