backdrop-contrib/bee

Array offset error when listing projects depending on terminal width

marcus-leonard opened this issue · 4 comments

This is just a UI thing. When listing projects bee can throw the following error depending on terminal width.

 [i] Notice: Trying to access array offset on value of type bool
in bee_get_remaining_rows() (line 373 of phar:///path/to/bee/bee.phar/includes/render.inc).

Not a serious problem, but initially made me think there was an issue. I had to make my terminal bigger than 110 characters to get rid of the error. Some virtual terminals may not allow this sort of width.

Backdrop CMS 1.28.2
Bee version 1.x-1.0.2

I think this is related to #360 and is basically a problem with the table rendering. I still haven't been able to reproduce this, but perhaps if you could share the list of projects that may help me reproduce and dig deeper. I wonder if a long project name is the cause here.

I think you might be right about long project names.

Width 130 - all OK.

Width 120 - just one.

| entity_plus                     | Entity Plus                                 | module | Enabled  | 1.x-1.0.21       |
| entity_plus_i18n                | Entity Plus Internationalization Integratio | module | Disabled | 1.x-1.0.21       |

 [i] Notice: Trying to access array offset on value of type bool
in bee_get_remaining_rows() (line 373 of phar:///srv/home/marcus/bee/bee.phar/includes/render.inc).

Width 110 - three:

| entity_plus                     | Entity Plus                       | module | Enabled  | 1.x-1.0.21       |
| entity_plus_i18n                | Entity Plus Internationalization  | module | Disabled | 1.x-1.0.21       |

 [i] Notice: Trying to access array offset on value of type bool
in bee_get_remaining_rows() (line 373 of phar:///srv/home/marcus/bee/bee.phar/includes/render.inc).

...[snip]...

| simplesamlphp_auth              | simpleSAMLphp authentication      | module | Enabled  |                  |
| simplesamlphp_auth_extra        | simpleSAMLphp authentication extr | module | Enabled  | 1.x-1.0.0-alpha1 |

 [i] Notice: Trying to access array offset on value of type bool
in bee_get_remaining_rows() (line 373 of phar:///srv/home/marcus/bee/bee.phar/includes/render.inc).

...[snip]...

| views_aggregator                | Views Aggregator Plus             | module | Enabled  | 1.x-1.0.6        |
| views_aggregator_more_functions | Views Aggregator Plus More Functi | module | Enabled  | 1.x-1.0.6        |

 [i] Notice: Trying to access array offset on value of type bool
in bee_get_remaining_rows() (line 373 of phar:///srv/home/marcus/bee/bee.phar/includes/render.inc).

(The notice message is actually repeated three times for each one.)

This is odd. When I do this locally (Ubuntu 20.04 on WSL2) I get a mess but no error:
image

Not sure I'll be able to reproduce but if you can share OS and PHP version, that may help. I think the table writing might be trying to be too clever with terminal widths and is sometimes falling over.

I think because I'm using Windows Terminal it is sizing dynamically so I never get an error.

One other thing that might help me hack together a reproduction of the issue, try both:

tput cols
echo $COLUMNS

And report back the results.

Right. I've figured out what was going on. I could never reproduce as lando, where I do development and testing, sets columns to 256 (though this should be fixed in the next release of lando core - see lando/core#179)

Once I figured out what was happening a simple additional check fixes the error. PR to follow shortly