Skip to content
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

Sometime, GeolocationHint can be an array and not directly a string - fix for php8 #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vbonamy
Copy link
Member

@vbonamy vbonamy commented Sep 5, 2024

Après un passage en php8, notre esup-wayf ne remontait plus d'établissements pour les SP proposés à EduGain.

Il se trouve que dans les SPs EduGain certains ont un GeolocationHint qui remonte en tant que tableau (à un élément) et pas directemet une chaine de caractères.

La fonction preg_match devait s'en accommoder en php7, ce n'est plus le cas en php8.

Ce PR permet de contourrner ce problème

templates.php Outdated
@@ -321,6 +321,11 @@ function printOptionElement($IDProviders, $key, $selectedIDP){
}

function geoDataAttributes($GeolocationHint) {
// Sometime, $GeolocationHint cans be an array and not directly a string
if(is_array($GeolocationHint)) {
echo $GeolocationHint;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove "echo" ?

@vbonamy vbonamy force-pushed the fix-geolocation-array-php8 branch from cab699c to ee14fc2 Compare September 5, 2024 11:51
templates.php Outdated
@@ -321,6 +321,10 @@ function printOptionElement($IDProviders, $key, $selectedIDP){
}

function geoDataAttributes($GeolocationHint) {
// Sometime, $GeolocationHint cans be an array and not directly a string
if(is_array($GeolocationHint)) {
$GeolocationHint = array_pop(array_reverse($GeolocationHint));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Y'a une raison de ne pas faire simplement :

$GeolocationHint = $GeolocationHint[0];

?

@vbonamy vbonamy force-pushed the fix-geolocation-array-php8 branch from ee14fc2 to 5a96356 Compare September 6, 2024 07:03
@vbonamy
Copy link
Member Author

vbonamy commented Sep 6, 2024

Après ces 2 push force je confirme que c'est toujours ok.
Merci @prigaux pour cette revue de code \o/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants