Request b64 decoding causes DB error
In Zotlabs/Module/Channel.php line 162 and elsewhere in hubzilla there is base64 decoding of REQUEST[mid]
if (strpos($mid, 'b64.') === 0)
$mid = @base64url_decode(substr($mid, 4));
Which causes DB error on certain mid. Here is the log with SQL Character not in repertoire (Invalid byte sequence) error (two times from different places. At the beginning is added log message showing original mid.
The problem is that in mid after base64 encoded part there is ?f=?f=?f= ... /?cat= ... which is in the above command b64 decoded too and subsequently escaped causes DB error.
The decoding should be done only for the b64 part and the part after first '?' apparently should not be sent to DB query
With this code the error disappears:
$mid = @base64url_decode(substr($mid, 4, strpos($mid,'?') - 4));
This is on more places in Hubzilla, the second error in log is by another DB Query.