-
-
Notifications
You must be signed in to change notification settings - Fork 824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix custom Home URL parsing #13031
Fix custom Home URL parsing #13031
Conversation
The list assignment will result in an E_NOTICE when the Home URL does not contain a query string, because the array returned by the explode() call will contain only one item.
(Standard links)
|
@colemanw I've extracted the duplicated code as suggested. I don't really like the name of the new extracted method, but I couldn't come up with anything better than that. Part of the reason, maybe, is because I don't fully understand why this processing is necessary in the first place. At first, I thought it was some kind of validation, but since I was not so sure I decided to go with the more generic |
Looks good. |
2c6ba7c
to
0f1c746
Compare
changed the method name from |
Jenkins re test this please |
Test Result (1 failure / +1) seems unrelated - will retry |
test this please |
Included in CiviCRM 5.8.0 Core PR: civicrm#13031
The only reason we needed the overridden file was to fix an error in CiviCRM Core. Since this has been now fixed in core, we don't need to file anymore. References: civicrm/civicrm-core#13031 compucorp/civicrm-core#28
Included in CiviCRM 5.8.0 Core PR: civicrm#13031
The only reason we needed the overridden file was to fix an error in CiviCRM Core. Since this has been now fixed in core, we don't need to file anymore. References: civicrm/civicrm-core#13031 compucorp/civicrm-core#28
Included in CiviCRM 5.8.0 Core PR: civicrm#13031
Overview
The code used to parse a custom Home URL in the
CRM_Core_BAO_Navigation::createNavigation()
would throw anE_NOTICE
if the URL did not contain a query string.Also, URL fragments would be removed from the parsed URL.
Before
Custom Home URLs without a query string would result in an
E_NOTICE
.Fragments in a custom URL would be removed.
After
No
E_NOTICE
is thrown when parsing a custom Home URL without a query string.Fragments are not removed from the custom URL.
Technical Details
The reason for the
E_NOTICE
was the usage ofexplode()
to extract the parts of the URL and then usinglist()
to assign the parts to variables. When the query string is not present,explode()
will return an array with one single element and the assignment will fail. This was fixed by using theparse_url()
function to query for the relevant parts of the URL.There was also a problem where the previous code would end up removing fragments from the URL. This has also been fixed using
parse_url()
to get the fragment.Finally, some minor cleanup was done in 2e42cb1. The
$contactId
param and the$config
variable were not used anywhere inside the method, so I removed them.Comments
Since this a quite simple fix, I thought it would be ok to not create a Gitlab ticket first. If the ticket is necessary, please let me know and I'll create it.