WonderCMS / wondercms

Fast and small flat file CMS (5 files). Built with PHP, JSON database.
https://wondercms.com
MIT License
657 stars 165 forks source link

Fatal error renderPageNavMenuItem() #269

Closed al3xg0r closed 2 years ago

al3xg0r commented 2 years ago

Hi. After installing and creating a menu item, errors popped up:

Fatal error: Uncaught TypeError: Argument 1 passed to Wcms::renderPageNavMenuItem() must be an object, null given, called in F:\OpenServer\domains\test.local\index.php on line 1732 and defined in F:\OpenServer\domains\test.local\index.php:2363 Stack trace: 
#0 F:\OpenServer\domains\test.local\index.php(1732): Wcms->renderPageNavMenuItem() 
#1 F:\OpenServer\domains\test.local\themes\Sky\theme.php(47): Wcms->menu() 
#2 F:\OpenServer\domains\test.local\index.php(1618): require_once('F:\\OpenServer\\d...') 
#3 F:\OpenServer\domains\test.local\index.php(177): Wcms->loadThemeAndFunctions() 
#4 F:\OpenServer\domains\test.local\index.php(16): Wcms->render() 
#5 {main} thrown in F:\OpenServer\domains\test.local\index.php on line 2363

php - 7.4 wcms - 3.3.2

robiso commented 2 years ago

Hi @al3xg0r, after debugging this with @slavenstancic, we're going to require more data to debug this:

  1. What server are you running on? (Apache, NGINX, Windows IIS, Caddy)
  2. Could you please also provide your database.js file, please make sure to remove the "password" and "loginURL".

We're assuming your menu must be somehow empty, although we're unsure at this point.

al3xg0r commented 2 years ago
  1. Apache 2.4 + NGINX 1.17 (Open Server)
  2. https://jsfiddle.net/4gjzdva3/
robiso commented 2 years ago

@al3xg0r it seems like your menu was somehow broken:

        "menuItems": {
            "0": {
                "name": "Home",
                "slug": "home",
                "visibility": "show",
                "subpages": {}
            },
            "1": {
                "name": "About",
                "slug": "about",
                "visibility": "show",
                "subpages": {}
            }
        }

The above should fix it. Do you possibly have any steps to reproduce the issue that broke your menu?

al3xg0r commented 2 years ago

fix helped, but I figured out why it appears, when you press "Move down" in the "Menu" settings this error pops up again

upd another question, how to remove the double "//" in the address

robiso commented 2 years ago

@al3xg0r the issue has been identified and fixed by @slavenstancic in the upcoming WonderCMS version.

Regarding the double slash in the URL, this seems like something to do with the NGINX config. Would you mind sharing it (without any sensitive info you do not wish to disclose).

al3xg0r commented 2 years ago

already figured it out I'm waiting for a fix thanks

robiso commented 2 years ago

Reordering first item now published on latest WonderCMS 3.3.3 version. Feel free to login to your WonderCMS website, open settings and "Check for updates".

The update should then show up. 🚀