You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When certain unusual URI queries are passed to phpSmug, we sometimes receive the following error:
PHP Notice: Undefined offset: 1 in /vendor/lildude/phpsmug/lib/phpSmug/Client.php on line 139
This is caused when contiguous '&' characters appear in the query statement, effectively creating empty arguments, as seen here between arg1 and arg2:
...?arg1=value1&&arg2=value2
The PHP notice can be corrected by stripping out these empty arguments, by inserting the following at line 137 in phpsmug/lib/phpSmug/Client.php, just before the foreach loop: $pairs = array_diff($pairs,['']);
Here is the context:
# Cater for any args passed in via `?whatever=foo`
if (strpos($url, '?') !== false) {
$pairs = explode('&', explode('?', $url)[1]);
$pairs = array_diff($pairs,['']); // remove empty args caused by adjacent &s in $url
foreach ($pairs as $pair) {
list($key, $value) = explode('=', $pair);
$this->request_options['query'][$key] = $value;
}
}
I'm sorry I can't formally fork and unit test this right now, although this fix is working in my project.
The text was updated successfully, but these errors were encountered:
This issue has been automatically marked as stale because it has not had activity in 14 days. It will be closed in 2 days if no further activity occurs. Thank you for your contributions.
Hello,
When certain unusual URI queries are passed to phpSmug, we sometimes receive the following error:
This is caused when contiguous '&' characters appear in the query statement, effectively creating empty arguments, as seen here between arg1 and arg2:
The PHP notice can be corrected by stripping out these empty arguments, by inserting the following at line 137 in phpsmug/lib/phpSmug/Client.php, just before the
foreach
loop:$pairs = array_diff($pairs,['']);
Here is the context:
I'm sorry I can't formally fork and unit test this right now, although this fix is working in my project.
The text was updated successfully, but these errors were encountered: