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

Undefined property View::$geocache in common_tpl_funcs.php due to invalid URL #2434

Open
stefopl opened this issue Nov 14, 2024 · 1 comment

Comments

@stefopl
Copy link
Collaborator

stefopl commented Nov 14, 2024

An ErrorException is triggered when attempting to access the cache edit page under the following conditions:

  • the user is not the cache owner,
  • the cache does not exist,
  • or the /viewcache.php address is accessed without parameters.
ErrorException: [/srv/ocpl/lib/common_tpl_funcs.php(182) : eval()'d code:742] Undefined property: src\Utils\View\View::$geocache
#0 /srv/ocpl/lib/common_tpl_funcs.php(182) : eval()'d code(742): src\Utils\Debug\ErrorHandler::handleError()
#1 /srv/ocpl/lib/common_tpl_funcs.php(182): eval()
#2 /srv/ocpl/editcache.php(1174): tpl_BuildTemplate()
#3 {main}

opencaching-pl/editcache.php

Lines 1161 to 1175 in d0cb7b5

tpl_set_var('wp_ge', htmlspecialchars($wp_ge, ENT_COMPAT, 'UTF-8'));
tpl_set_var('reset', tr('reset'));
tpl_set_var('submit', $submit);
}
//TODO: not the owner
}
//TODO: cache not exist
unset($dbc);
$view->loadJQuery();
//make the template and send it out
tpl_set_tplname('editcache');
tpl_BuildTemplate();

Replacing TODO: with $view->redirect('/') will prevent loading the editcache.tpl.php template, but is the redirect enough? Or should there be an additional message for the user to inform them about the issue?

I think the problem occurs when the user manually manipulates the URL.

@stefopl stefopl changed the title ErrorException: Undefined property src\Utils\View\View::$geocache in /lib/common_tpl_funcs.php due to invalid URL Undefined property View::$geocache in common_tpl_funcs.php due to invalid URL Nov 14, 2024
@deg-pl
Copy link
Member

deg-pl commented Nov 14, 2024

I think redirect is enough.

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

2 participants