New user's registration have been closed due to high spamming and low trafic on this forum. Please contact forum admins directly if you need an account. Thanks !

PHP error on status page

Got problems with your B2 or B3? Share and get helped!
Post Reply
jonathf
Posts: 4
Joined: 27 Aug 2011, 06:06

PHP error on status page

Post by jonathf »

Every time I go to the status page (as admin) on my B3 web interface I receive a few error messages.

On top:
A PHP Error was encountered
Severity: Warning
Message: implode(): Argument must be an array
Filename: controllers/stat.php
Line Number: 48
Next to attached printers:
A PHP Error was encountered
Severity: Warning
Message: array_map(): Argument #2 should be an array
Filename: stat/stat_view.php
Line Number: 43
A PHP Error was encountered
Severity: Warning
Message: array_map(): Argument #2 should be an array
Filename: stat/stat_view.php
Line Number: 43
Before I got the errors I had done the following:
apt-get update
apt-get upgrade
apt-get install libapache2-mod-python

My first instinct was that the python-module some how made trouble when running the b3 web interface. So I remove it and restarted apache. However that didn't work.

Anyone have an idea what might be the cause to this problem and how I might fix it?
Gordon
Posts: 1464
Joined: 10 Aug 2011, 03:18

Re: PHP error on status page

Post by Gordon »

Apparently there is an issue with executing the shell command `cups-list-printers`. You might want to try and see what (error) this command returns if you execute it manually.

The reason that you're seeing this in the web-admin is because the helper function returns a null value rather than an empty array, which is the expected input to the php implode() function.
jonathf
Posts: 4
Joined: 27 Aug 2011, 06:06

Re: PHP error on status page

Post by jonathf »

Gordon wrote:Apparently there is an issue with executing the shell command `cups-list-printers`. You might want to try and see what (error) this command returns if you execute it manually.

The reason that you're seeing this in the web-admin is because the helper function returns a null value rather than an empty array, which is the expected input to the php implode() function.
Thank you for taking interest. It is appreciated.

Bash doesn't recognize the command `cups-list-printers`. Is it supposed to be a linux/debian command?
Gordon
Posts: 1464
Joined: 10 Aug 2011, 03:18

Re: PHP error on status page

Post by Gordon »

I think it's proprietary. Not part of cups itself anyway.

Content of /usr/bin/cups-list-printers is as follows:

Code: Select all

#!/usr/bin/python
import cups, json

printers = []
try:
    for name, queue in cups.Connection().getPrinters().iteritems ():
        printers.append({
            'name': name,
            'info': queue['printer-info'],
            'enabled': queue['printer-state'] != cups.IPP_PRINTER_STOPPED,
            'state': queue['printer-state-message']
        })
except:
    # we just ignore exceptions
    pass

print json.dumps(printers)
I must note though that you might be missing other components as well, so your best bet would probably be to reinstall all the bubba* packages.
jonathf
Posts: 4
Joined: 27 Aug 2011, 06:06

Re: PHP error on status page

Post by jonathf »

Small note: My B3 does not have a file called /usr/bin/cups-list-printers.

So to recap: you want me to run something like
`apt-get remove -y bubba && apt-get -y autoremove && apt-get install -y bubba`
and reinstall all 221 packages associated with the bubba-system in hope to fix some components in a close to vanilla install of the B3.
Have I understood you correctly?
Gordon
Posts: 1464
Joined: 10 Aug 2011, 03:18

Re: PHP error on status page

Post by Gordon »

jonathf wrote:Small note: My B3 does not have a file called /usr/bin/cups-list-printers.
I got that. Point is that you should have had it and we can only guess why you don't. You may have inadvertently removed it as part of a dependency, or maybe just something went wrong during the bubba software upgrade. Reinstalling the whole bubba system would solve this, but would also be somewhat drastic when you currently appear to be missing just a single file.

Just consider it as an option for when more troubles with missing or bad files pop up. Meanwhile create the cups-list-printers file as posted and mark it as executable. This should correct the error you're experiencing at this time, unless of course something else is wrong with the cups system.
jonathf
Posts: 4
Joined: 27 Aug 2011, 06:06

Re: PHP error on status page

Post by jonathf »

That sounds very likely.

Thank you very much for helping me with this.
Post Reply