Fwconsole reload fails with 'A non-numeric value encountered'

Hi,
Trying to reload asterisk with fwconsole reload and it fails…

fwconsole reload --dry-run

Reload Started

In registries.php line 19:

A non-numeric value encountered
reload [–json] [–dry-run] [–skip-registry-checks] [–dont-reload-asterisk]

fwconsole reload –skip-registry-checks

Reload Started

In registries.php line 19:

A non-numeric value encountered

reload [–json] [–dry-run] [–skip-registry-checks] [–dont-reload-asterisk]

Line 19 of /var/www/html/admin/modules/parking/functions.inc/registries.php

$parkpos2 = $parkpos1 + $lot[‘numslots’] - 1;

Checked another FreePBX 16 server and it has exact same line 19 in registries.php but # fwconsole reload works as expected

Thanks for any insight to this.

What it actually has is:

$parkpos2 = $parkpos1 + $lot['numslots'] - 1

Which correct according to the official sources:

https://git.freepbx.org/projects/FREEPBX/repos/parking/browse/functions.inc/registries.php#19

It is important to mark up code as pre-formatted text in the forum.

I assume the non-numeric value is that resulting from evaluating $lot['numslots'], which ultimately comes down to the results of running this SQL query:

SELECT * FROM parkplus WHERE defaultlot = 'yes' LIMIT 1

https://git.freepbx.org/projects/FREEPBX/repos/parking/browse/Parking.class.php#195

assuming that you don’t have the Parking Pro module, in which case its version will be used.

You’d therefore have manually run a similar query, to see what was wrong in the database.

Hi,
Parking Pro module is not installed.
mysqlcheck asterisk doesn’t show any errors

Running your query on the server reporting the error it displays…

MariaDB [asterisk]> SELECT * FROM parkplus WHERE defaultlot = 'yes' LIMIT 1;
+----+------------+--------+-------------+---------+---------+----------+-------------+------------------+------------+----------+------------+---------------------+---------------------+-----------+---------+-------+-----------+-----------------+------------------+------------------------+
| id | defaultlot | type   | name        | parkext | parkpos | numslots | parkingtime | parkedmusicclass | generatefc | findslot | parkedplay | parkedcalltransfers | parkedcallreparking | alertinfo | rvolume | cidpp | autocidpp | announcement_id | comebacktoorigin | dest                   |
+----+------------+--------+-------------+---------+---------+----------+-------------+------------------+------------+----------+------------+---------------------+---------------------+-----------+---------+-------+-----------+-----------------+------------------+------------------------+
|  1 | yes        | public | Default Lot |         |         |        4 |          45 | default          | yes        | first    | both       | caller              | caller              |           |         |       | none      |            NULL | yes              | app-blackhole,hangup,1 |
+----+------------+--------+-------------+---------+---------+----------+-------------+------------------+------------+----------+------------+---------------------+---------------------+-----------+---------+-------+-----------+-----------------+------------------+------------------------+
1 row in set (0.00 sec)

Run same query on server that doesn’t produce error running fwconsole reload it displays different…

MariaDB [asterisk]> SELECT * FROM parkplus WHERE defaultlot = 'yes' LIMIT 1;
+----+------------+--------+-------------+---------+---------+----------+-------------+------------------+------------+----------+------------+---------------------+---------------------+-----------+---------+-------+-----------+-----------------+------------------+------------------------+
| id | defaultlot | type   | name        | parkext | parkpos | numslots | parkingtime | parkedmusicclass | generatefc | findslot | parkedplay | parkedcalltransfers | parkedcallreparking | alertinfo | rvolume | cidpp | autocidpp | announcement_id | comebacktoorigin | dest                   |
+----+------------+--------+-------------+---------+---------+----------+-------------+------------------+------------+----------+------------+---------------------+---------------------+-----------+---------+-------+-----------+-----------------+------------------+------------------------+
|  1 | yes        | public | Default Lot | 70      | 71      |        8 |          45 | default          | yes        | first    | both       | caller              | caller              |           |         |       | none      |            NULL | yes              | app-blackhole,hangup,1 |
+----+------------+--------+-------------+---------+---------+----------+-------------+------------------+------------+----------+------------+---------------------+---------------------+-----------+---------+-------+-----------+-----------------+------------------+------------------------+

And you don’t notice how the one with errors is missing a parkext and parkpos value? The value that is trying to be used in the script.

I’d say it was actually parkpos that was the immediate cause of the failure. I’ll leave it to others to say whether the blank/null fields are actually reasonable, and if not, how they may have come to be missing values, but you could always try the query on a working system (I see you did, whilst I was checking some details).

Thing is, never use parking log. Not sure why one has values and the other doesn’t. Perhaps remove the parking lot from the FreePBX server returning the error for fwconsole reload and then add the parking log module back?

If you thing that would fix it, is there a way to fwconsole to add just the parking lot module?

Thanks.

Those two fields shouldn’t be blank for the default parking lot in FreePBX.

Uninstalled Parking lot module, apply. Reinstall Parking log module, apply. The reinstallation has populated the table in asterisk.

MariaDB [asterisk]> SELECT * FROM parkplus WHERE defaultlot = 'yes' LIMIT 1;
+----+------------+--------+-------------+---------+---------+----------+-------------+------------------+------------+----------+------------+---------------------+---------------------+-----------+---------+-------+-----------+-----------------+------------------+------------------------+
| id | defaultlot | type   | name        | parkext | parkpos | numslots | parkingtime | parkedmusicclass | generatefc | findslot | parkedplay | parkedcalltransfers | parkedcallreparking | alertinfo | rvolume | cidpp | autocidpp | announcement_id | comebacktoorigin | dest                   |
+----+------------+--------+-------------+---------+---------+----------+-------------+------------------+------------+----------+------------+---------------------+---------------------+-----------+---------+-------+-----------+-----------------+------------------+------------------------+
|  1 | yes        | public | Default Lot | 70      | 71      |        8 |          45 | default          | yes        | first    | both       | caller              | caller              |           |         |       | none      |            NULL | yes              | app-blackhole,hangup,1 |
+----+------------+--------+-------------+---------+---------+----------+-------------+------------------+------------+----------+------------+---------------------+---------------------+-----------+---------+-------+-----------+-----------------+------------------+------------------------+
# fwconsole reload
Reload Started
Reload Complete

Fixed.

It looks to me as though these fields correspond directly to one in the Parking Module in the GUI, and whilst it might be safer to reinstall if you don’t know how they got corrupted, you should have been able to fix them through the GUI.