@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fail more gracefully passing an array to AphrontRequest::getStr()

Summary:
It is possible to construct URIs with array parameters which end up in AphrontRequest::getStr() which previously just casted the passed value to a string via a `(string`) prefix.
This leads to an ugly `EXCEPTION: (RuntimeException) Array to string conversion`.

Instead, fail more gracefully with `(Exception) Value passed to "phutil_string_cast()" is an array; arrays can not be sensibly cast to strings.`

Closes T16102

Test Plan: Unclear.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T16102

Differential Revision: https://we.phorge.it/D26077

+1 -1
+1 -1
src/aphront/AphrontRequest.php
··· 211 211 */ 212 212 public function getStr($name, $default = null) { 213 213 if (isset($this->requestData[$name])) { 214 - $str = (string)$this->requestData[$name]; 214 + $str = phutil_string_cast($this->requestData[$name]); 215 215 // Normalize newline craziness. 216 216 $str = str_replace( 217 217 array("\r\n", "\r"),