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

Symphony Notice: Undefined variable: useragent #24

Open
bauhouse opened this issue Mar 27, 2020 · 0 comments
Open

Symphony Notice: Undefined variable: useragent #24

bauhouse opened this issue Mar 27, 2020 · 0 comments

Comments

@bauhouse
Copy link
Member

Affected Symphony version(s) : 3.0.0
PHP version(s) : 7.3.7
MySQL version(s): 5.7.26 Homebrew
OS(es) : macOS Catalina 10.15.3

The Preferences page throws the following error when the Maintenance Mode extension is enabled for Symphony 3.0:

An error occurred in /Users/stephen/Sites/symphonycms/extensions/maintenance_mode/extension.driver.php around line 93

88         $label = Widget::Label(__('Useragent Whitelist'));
89         $whitelist = json_decode(Symphony::Configuration()->get('useragent_whitelist', 'maintenance_mode'));
90         if (is_array($whitelist) && !empty($whitelist)) {
91             $useragent = implode("\r\n",$whitelist);
92         }
93         $label->appendChild(Widget::Textarea('settings[maintenance_mode][useragent_whitelist]', 5, 50, General::sanitize($useragent)));
94         $group->appendChild($label);
95 
96         // Append help
97         $group->appendChild(new XMLElement('p', __('Any useragent that listed above will be granted access. This eliminates the need to allow a

The error goes away by modifying the conditional.

// Useragent White list
$label = Widget::Label(__('Useragent Whitelist'));
$whitelist = json_decode(Symphony::Configuration()->get('useragent_whitelist', 'maintenance_mode'));
if (is_array($whitelist) && !empty($whitelist)) {
    $useragent = implode("\r\n",$whitelist);
    $label->appendChild(Widget::Textarea('settings[maintenance_mode][useragent_whitelist]', 5, 50, General::sanitize($useragent)));
    $group->appendChild($label);
}
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

No branches or pull requests

1 participant