1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Fixes for PHP 8

This commit is contained in:
= 2021-02-20 21:51:33 +11:00
parent 087129788b
commit 633210e281
2 changed files with 8 additions and 4 deletions

View File

@ -49,7 +49,7 @@ class Helpers
*
* @return null|string
*/
public function formatCustomFieldValue($custom_fields = null, $field, $value, Client $client = null): ?string
public function formatCustomFieldValue($custom_fields, $field, $value, Client $client = null): ?string
{
$custom_field = '';
@ -84,7 +84,7 @@ class Helpers
*
* @return string
*/
public function makeCustomField($custom_fields = null, $field): string
public function makeCustomField($custom_fields, $field): string
{
if ($custom_fields && property_exists($custom_fields, $field)) {
$custom_field = $custom_fields->{$field};

View File

@ -217,13 +217,17 @@ trait CompanySettingsSaver
switch ($key) {
case 'int':
case 'integer':
return ctype_digit(strval(abs($value)));
if(is_string($value))
return false;
return is_int($value) || ctype_digit(strval(abs($value)));
case 'real':
case 'float':
case 'double':
return is_float($value) || is_numeric(strval($value));
case 'string':
return method_exists($value, '__toString') || is_null($value) || is_string($value);
// return method_exists($value, '__toString') || is_null($value) || is_string($value);
return is_null($value) || is_string($value);
case 'bool':
case 'boolean':
return is_bool($value) || (int) filter_var($value, FILTER_VALIDATE_BOOLEAN);