Skip to content
This repository has been archived by the owner on Dec 1, 2023. It is now read-only.

Login widget causes "Notice: compact(): Undefined variable: options" for anonymous users #956

Open
kiamlaluno opened this issue Oct 20, 2020 · 3 comments

Comments

@kiamlaluno
Copy link

Problem

When I access my Pagekit site as anonymous user, I get an Whoops, looks like something went wrong. error in an unstyled page. After I enable the debug mode, I see the following backtrace.

  1. in login.php line 25
  2. at ErrorHandler->handleError('8', 'compact(): Undefined variable: options', '/home/cu1oo7s7/public_html/app/system/modules/user/widgets/login.php', '25', array('widget' => object(Widget), 'app' => object(Application), 'user' => object(User), 'redirect' => '@page/1', 'last_username' => null))
  3. at compact('widget', 'options', 'user', 'last_username', 'redirect') in login.php line 25
  4. at ModuleManager->{closure}(object(Widget))
  5. at call_user_func(object(Closure), object(Widget)) in Type.php line 15
  6. at Type->render(object(Widget)) in PositionHelper.php line 104
  7. at PositionHelper->getWidgets('sidebar') in PositionHelper.php line 42
  8. at PositionHelper->exists('sidebar') in template.php line 76
  9. at require('/home/cu1oo7s7/public_html/packages/pagekit/theme-one/views/template.php') in PhpEngine.php line 50
  10. at PhpEngine->evaluate(null, null) in PhpEngine.php line 80
  11. at PhpEngine->render('views:template.php', array('app' => object(Application), 'view' => object(View), 'params' => object(ArrObject), 'intl' => object(IntlModule), 'theme' => object(Module))) in DelegatingEngine.php line 43
  12. at DelegatingEngine->render('views:template.php', array('app' => object(Application), 'view' => object(View), 'params' => object(ArrObject), 'intl' => object(IntlModule), 'theme' => object(Module))) in View.php line 211
  13. at View->render('layout') in index.php line 121
  14. at Module->{closure}(object(ControllerEvent), object(Request))
  15. at call_user_func_array(object(Closure), array(object(ControllerEvent), object(Request))) in WrappedListener.php line 63
  16. at WrappedListener->__invoke(object(ControllerEvent), object(Request))
  17. at call_user_func_array(object(WrappedListener), array(object(ControllerEvent), object(Request))) in EventDispatcher.php line 123
  18. at EventDispatcher->trigger(object(ControllerEvent), array(object(ControllerEvent), object(Request))) in TraceableEventDispatcher.php line 126
  19. at TraceableEventDispatcher->trigger('controller', array(object(Request))) in HttpKernel.php line 148
  20. at HttpKernel->handleController() in HttpKernel.php line 77
  21. at HttpKernel->handle(object(Request)) in Application.php line 67
  22. at Application->run() in app.php line 24
  23. at require_once('/home/cu1oo7s7/public_html/app/system/app.php') in index.php line 42

Visiting the site as administrator doesn't cause any issue; the same is true when I disable the login widget.

Technical Details

  • Pagekit version: 1.0.18
  • Webserver: Apache
  • Database: MySQL 5.6.26-cll-lve
  • PHP Version: 7.3.8
@kiamlaluno
Copy link
Author

I changed the PHP version used from the site to PHP 7.2.21. Now the homepage and the login widget are visible. It seems the issue is caused from the PHP version.

I will check if there are PHP extensions not enabled when I use PHP 7.3, but I think the problem is incompatibility with PHP 7.3.

@kiamlaluno
Copy link
Author

These are the extensions PageKit lists for PHP 7.3.

Core, date, libxml, openssl, pcre, sqlite3, zlib, bz2, calendar, ctype, curl, hash, filter, ftp, gettext, gmp, SPL, iconv, pcntl, readline, Reflection, session, standard, shmop, SimpleXML, mbstring, tokenizer, xml, litespeed, intl, uploadprogress, gd, fileinfo, sockets, uuid, zip, xmlwriter, yaml, json, igbinary, exif, apcu, imap, mysqlnd, PDO, pdo_mysql, gmagick, dom, pdo_sqlite, Phar, xmlreader, posix, xsl, Zend OPcache

These are the extensions listed by PageKit for PHP 7.2. The difference is mostly extensions that cPanel doesn't show for PHP 7.3, which I cannot enable.

Core, date, libxml, openssl, pcre, sqlite3, zlib, bz2, calendar, ctype, curl, hash, filter, ftp, gettext, gmp, SPL, iconv, pcntl, readline, Reflection, session, standard, shmop, SimpleXML, mbstring, tokenizer, xml, litespeed, intl, brotli, gmagick, gd, fileinfo, sockets, uuid, zip, sodium, xmlwriter, yaml, json, igbinary, exif, sysvmsg, sysvshm, apcu, sysvsem, imap, mysqlnd, PDO, pdo_mysql, uploadprogress, dom, pdo_sqlite, Phar, xmlreader, posix, xsl, Zend OPcache

@tobbexiv
Copy link
Contributor

tobbexiv commented Nov 1, 2020

app/system/modules/user/widgets/login.php has line return $app['view']('system/user/widget-login.php', compact('widget', 'options', 'user', 'last_username', 'redirect'));. However, options is undefined and thus causes the error. Changing the line to return $app['view']('system/user/widget-login.php', compact('widget', 'user', 'last_username', 'redirect')); will solve the issue.

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

No branches or pull requests

2 participants