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

Lots of PHP errors with Customizer + local server #115

Closed
Darthagnon opened this issue Sep 2, 2020 · 12 comments
Closed

Lots of PHP errors with Customizer + local server #115

Darthagnon opened this issue Sep 2, 2020 · 12 comments
Labels
bug Something isn't working

Comments

@Darthagnon
Copy link

Greetings! Thank you for making Customizer; I find it's vital for Kanboard, and it seems to work well, despite lots of PHP errors showing repeatedly in the Customizer settings page.

I get the following repeatedly:

Notice: Trying to access array offset on value of type null in E:\ZNxPMp-Server\htdocs\kanboard\plugins\Customizer\Controller\CustomizerFileController.php on line 93


Call Stack
--
1 | 0.0008 | 373360 | {main}( ) | ...\index.php:0
2 | 2.5016 | 1651528 | Kanboard\Core\Controller\Runner->execute( ) | ...\index.php:9
3 | 2.5050 | 1788840 | Kanboard\Core\Controller\Runner->executeController( ) | ...\Runner.php:31
4 | 2.5072 | 1794776 | Kanboard\Plugin\Customizer\Controller\CustomizerFileController->show( ) | ...\Runner.php:77

and

Warning: Cannot modify header information - headers already sent by (output started at E:\ZNxPMp-Server\htdocs\kanboard\plugins\Customizer\Controller\CustomizerFileController.php:94) in E:\ZNxPMp-Server\htdocs\kanboard\app\Core\Http\Response.php on line 222
--
1 | 0.0008 | 373360 | {main}( ) | ...\index.php:0
2 | 2.5016 | 1651528 | Kanboard\Core\Controller\Runner->execute( ) | ...\index.php:9
3 | 2.5050 | 1788840 | Kanboard\Core\Controller\Runner->executeController( ) | ...\Runner.php:31
4 | 2.5072 | 1794776 | Kanboard\Plugin\Customizer\Controller\CustomizerFileController->show( ) | ...\Runner.php:77
5 | 2.5404 | 1965768 | Kanboard\Core\Http\Response->html( ) | ...\CustomizerFileController.php:101
6 | 2.5404 | 1965768 | Kanboard\Core\Http\Response->send( ) | ...\Response.php:272
7 | 2.5404 | 1965896 | header ( )

I'm running Kanboard on localhost with ZNxPMp Server. Any way I could stop those errors from appearing?

@creecros
Copy link
Owner

creecros commented Sep 2, 2020

what version of kanboard are you running? Man, I'm not gonna lie, I'm literally an idiot when it comes to these things. I haven't tested Customizer since version 1.2.13, and don't even have my server running anymore. I can spin up the latest KB version in docker and test, but If I don't get the errors, I'm not going to have a clue. I've tried to maintain the repo to the best of my ability and spent 100s of hours writing this code, but it was never anything more than just a hobby (to see if I could do it), I'm no coder, or even a computer person to be honest.

@creecros
Copy link
Owner

creecros commented Sep 2, 2020

Although, just looking at your error. I am wondering....all your issues are from a null on the logo path. Did you upload a logo? Is it showing? Is it a bad file maybe?

@creecros
Copy link
Owner

creecros commented Sep 2, 2020

Also, Tested in vs 1.2.15 and everything works as expected, no errors, running:
Application version: v1.2.15
PHP version: 7.3.19
PHP SAPI: fpm-fcgi
HTTP Client: cURL
OS version: Linux 4.14.122-rancher
Database driver: sqlite
Database version: 3.32.1
Browser: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36

Following your error though, this is whats happening.

  • Customizer thinks you have uploaded an image
  • It goes to grab the image
  • null is returned (specifically for the path, but if that's null, well, it can't actually grab an image)
  • it gets mad, spits out error
  • more mad ensues when making html header thing, cause, well image is null, spits out an other error

every error is referencing a null image

*** My suspicion now is PHP 7.4.1

@creecros
Copy link
Owner

creecros commented Sep 2, 2020

Confirmed. it's PHP 7.4.1

Trying to use values of type null, bool, int, float or resource as an array (such as $null["key"]) will now generate a notice.

https://www.php.net/manual/en/migration74.incompatible.php#migration74.incompatible.core.non-array-access

Previous versions didn't give a crap, and gave no "Notice".

If (when) kanboards docker image is updated to use 7.4.1, then I will add a fix.

@creecros creecros closed this as completed Sep 2, 2020
@creecros creecros added the bug Something isn't working label Sep 2, 2020
@creecros creecros reopened this Sep 2, 2020
@Darthagnon
Copy link
Author

Darthagnon commented Sep 3, 2020

[slaps forehead] Knew I'd seen something about PHP versions while researching the error; wishing I had mentioned it!

To be honest, I'm a beginner myself. Just going nuts recently about local servers and stuff like that; found Kanboard, and it looked like a good idea for family task/startup company management.

I'm testing Kanboard with Laragon at the moment, and it's working a lot nicer - there's even an easy GUI way I can set PHP versions! It still throws an error with PHP 7.4.1 Notice: Trying to access array offset on value of type null in E:\ZNxPMp-Server\laragon\www\plugins\Customizer\Controller\CustomizerFileController.php on line 94 but at least Laragon's polite and doesn't spam errors all over the page.

EDIT: I easily installed PHP 7.2 following these instructions and it works without errors now :) Now just to figure out why Kanboard in general is sluggish on my (fairly powerful) PC.

@creecros
Copy link
Owner

creecros commented Sep 4, 2020

You're running a virtual server on a pc and running it locally? Must be, since I see E:\

How would you access that, say, when your not at home? Or on your mobile?

I just use docker, for pretty much everything, and then nginx proxy with letsencrypt companion. Old laptop as the server, literally, made in 2003, running RancherOS, Not sluggish at all. Portainer for managing the containers.

@Darthagnon
Copy link
Author

Yes, correct, local server on my PC. Just for testing, as I'm trying to find a usable project planning/Kanban application for Windows (and none seem to exist (;_;) ). It's accessible via LAN from any other machine, but I haven't had any luck making Kanboard perform well on it (PHP server thrashes the HDD at 45% usage constantly while it's open), making pages/saving/etc. take long seconds to save (e.g. remote websites served from the internet are being faster than a local site served from my PC lol).

@creecros
Copy link
Owner

creecros commented Sep 5, 2020

In my experience, thats the nature of virtual machines. If you have an old pc laying around, id recommend just wiping it, throw a minimalist os on it, and serve from that.

@Darthagnon
Copy link
Author

Will do, maybe once I get my RPi homeserver running :D
I believe Laragon (and the stuff running through it) isn't virtualised (unlike Docker, which is virtualised), though I could be wrong.

@creecros
Copy link
Owner

creecros commented Sep 6, 2020

There is a big difference between the two. One is highly efficient.

@DigiLive
Copy link

Confirmed. it's PHP 7.4.1

Trying to use values of type null, bool, int, float or resource as an array (such as $null["key"]) will now generate a notice.

https://www.php.net/manual/en/migration74.incompatible.php#migration74.incompatible.core.non-array-access

Previous versions didn't give a crap, and gave no "Notice".

If (when) kanboards docker image is updated to use 7.4.1, then I will add a fix.

Not all of us run kanboard in a docker container. 😉
Quickfix for CustomizerFileController.php:

    public function show()
    {
        $logo         = $this->customizerFileModel->getByType(1);
        $flavicon     = $this->customizerFileModel->getByType(2) ?? ['id' => null, 'name' => null];
        $loginlogo    = $this->customizerFileModel->getByType(3) ?? ['id' => null, 'name' => null];
        $logopath     = $logo['path'] ?? null;
        $flaviconpath = $flavicon['path'] ?? null;
        $this->response->html(
            $this->helper->layout->config(
                'customizer:file/show',
                [
                    'logo'         => $logo,
                    'title'        => t('Settings') . ' > ' . t('Customizer'),
                    'flavicon'     => $flavicon,
                    'logopath'     => $logopath,
                    'flaviconpath' => $flaviconpath,
                    'loginlogo'    => $loginlogo,
                ]
            )
        );
    }

@creecros
Copy link
Owner

True, but I do.

Make a PR, and I'd be happy to merge.

creecros added a commit that referenced this issue Feb 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants