-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
Code of Conduct
- I agree to follow this project's Code of Conduct.
Submission validity
- This is not a personal support request, that should be posted on discussions community.
- I checked current issues and this request isn't a duplicate of an existing issue, opened or closed.
Self troubleshooting
- I've read the documentation and made sure to follow it.
- I've read the troubleshooting first steps and frequent issues guides.
Version
1.9.2
Description
A fatal error can happen when YOURLS tries to convert the title to UTF-8 using an invalid <meta charset="" /> value.
Expectation
Retry charset conversion without the source encoding (i.e. guess from the input), or if all else fails skip the title.
Reproduction steps
- Log into YOURLS admin
- Enter
https://search.spokanehomeguy.com/search/detail/202195346?s%5Bpage%5D=1&s%5Blocations%5D%5B0%5D%5Bcity%5D=Spokane&s%5Blocations%5D%5B0%5D%5Bstate%5D=WAto be shortened- Optionally specify a custom keyword
- YOURLS fails to shorten the link; the "Shorten The URL" button spins forever, and a server error from
admin-ajax.phpappears in the browser debug console.
Note: If the example site above fixes its incorrect markup, this can be reproduced by instead trying to shorten a test page somewhere that contains both a <title> and an invalid <meta charset> tag in its header, such as:
<meta charset="utf=8">Context
Discussed in https://github.com/orgs/YOURLS/discussions/3707
Originally posted by og-shg January 18, 2024
If I shorten this URL
https://search.spokanehomeguy.com/search/detail/202195346?s[page]=1&s[locations][0][city]=Spokane&s[locations][0][state]=WA
The script spins and spins and does not produce an output.
If I remove the "s"
http://search.spokanehomeguy.com/search/detail/202195346?s[page]=1&s[locations][0][city]=Spokane&s[locations][0][state]=WA
It shortens just fine.
How can I fix this without constantly adjusting the input?
Error Log:
[18-Jan-2024 22:48:28 UTC] PHP Fatal error: Uncaught ValueError: mb_convert_encoding(): Argument #3 ($from_encoding) contains invalid encoding "utf" in /home/fbvvkrxo4bco/public_html/includes/functions.php:933
Stack trace:
#0 /home/fbvvkrxo4bco/public_html/includes/functions.php(933): mb_convert_encoding()
#1 /home/fbvvkrxo4bco/public_html/includes/functions-shorturls.php(97): yourls_get_remote_title()
#2 /home/fbvvkrxo4bco/public_html/admin/admin-ajax.php(21): yourls_add_new_link()
#3 {main}
thrown in /home/fbvvkrxo4bco/public_html/includes/functions.php on line 933