* Update user_edit.php
Some PHP implementations return a fatal error when in_array() has the second parameter null.
$_SESSION['authentication']['methods'] is null by default on new installations.
so this small change has 2 purposes.
first, I found the hard way, that PHP PDO is not always coded with the same criteria between versions and databases. While PDO PGSQL on PHP 8.x may work, PDO SQLITE on PHP 7.4 may not and so on.. This will make sure that the value there is an integer.
Second, since these two values are taken from the _GET, which is in the URL string, it will protect against "imaginative" users.
$fax_email_outbound_authorized_senders is only filled when fax_extension_advanced permission is set. However, the edit part doesn't verify that sizeof(NULL) creates a fatal error.
Fatal error: Uncaught TypeError: sizeof(): Argument #1 ($value) must be of type Countable|array, null given in /var/www/fusionpbx/app/fax/fax_edit.php:286 Stack trace: #0 {main} thrown in /var/www/fusionpbx/app/fax/fax_edit.php on line 286
This patch verifies that $fax_email_outbound_authorized_senders is an array before sizeof() evaluates it. You can now add faxes with the fax_extension_advanced disabled.
The SQL query is missing the toll-allow setting from the virtual fax extension. All dialplans that have that condition will fail.
This patch makes sure the variable is present if need it.
In this condition you already have p.dialplay_uuid = s.dialplay_uuid and you have p.dialplay_uuid = CONST, no need tor s.dialplay_uuid=CONST,
In small databases, this could be trivial; but in significant databases, this saves a lot of processing.
So I discovered 2 things,
1. If a user adds the default config cdr-field-array with the content of a database field Let's pretend they want to show the xml_cdr_uuid column (for support purposes) - it could be any column, the SQL construction will fail as not Postgresql, Not MariaDB/MySQL allow having a column repeated twice. Adding array_unique() fixes this issue.
2. This one is for developers: If a developer wants to create more columns in the v_xml_cdr table and make them visible in the CDR app, common sense tells to add the default setting cdr-field-array to show it. As the code is now, this will look into the freeswitch variables and overwrite it with NULL. I am adding a condition that verifies if the value has been already assigned, if it is, it won't overwrite it. This allows any developer who may be interested in extending the CDR to simply extend the class without touching it; very handy to keep the original code untouched.