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

Fix config.php array error #300

Merged
merged 1 commit into from
Nov 25, 2024
Merged

Fix config.php array error #300

merged 1 commit into from
Nov 25, 2024

Conversation

markmetcalfe
Copy link
Member

@markmetcalfe markmetcalfe commented Nov 25, 2024

Was getting the following error with the example config.php syntax in PHP 8.3 - I thought I had tested it but I think mutagen wasn't syncing properly, so I was testing against an older config.php without realising

Warning: Undefined array key "HTTP_X_FORWARDED_HOST" in /var/www/totara/src/integration/config.php on line 143
Warning: Undefined array key "HTTP_X_ORIGINAL_HOST" in /var/www/totara/src/integration/config.php on line 144

Couldn't get the foreach loop to make sense with the ?: notation, so I've just set it back to using if statements. I've verified that this setup works with PHP 5.3 and 8.3, and that ngrok still works.

@markmetcalfe markmetcalfe changed the base branch from master to develop November 25, 2024 04:24
@markmetcalfe markmetcalfe changed the base branch from develop to master November 25, 2024 04:24
@markmetcalfe markmetcalfe marked this pull request as ready for review November 25, 2024 04:32
@markmetcalfe markmetcalfe changed the base branch from master to develop November 25, 2024 21:24

// Depending on the Ngrok version its hostname is stored in different server vars
$ngrok_server_vars = array(
$_SERVER['HTTP_X_FORWARDED_HOST'] ?: '',
Copy link
Member

Choose a reason for hiding this comment

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

I think the easiest fix is just to change ?: to ??

Copy link
Member

Choose a reason for hiding this comment

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

?? works for me, no additional changes needed.

Personally I prefer the array over the regex

Copy link
Member Author

Choose a reason for hiding this comment

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

?? doesn't work in PHP 5.3 is the thing

Copy link
Member

Choose a reason for hiding this comment

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

right, forgot about this dinosaur ;)


// Depending on the Ngrok version its hostname is stored in different server vars
$ngrok_server_vars = array(
$_SERVER['HTTP_X_FORWARDED_HOST'] ?: '',
Copy link
Member

Choose a reason for hiding this comment

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

right, forgot about this dinosaur ;)

@derschatta derschatta merged commit 246f2ec into develop Nov 25, 2024
1 check passed
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