View Issue Details

IDProjectCategoryView StatusLast Update
2069RackTablesdefaultpublic2022-09-26 22:11
Reporterfcolista Assigned Toinfrastation  
PriorityhighSeveritycrashReproducibilityalways
Status assignedResolutionopen 
Product Version0.22.0 
Summary2069: Fatal error: Uncaught TypeError: Unsupported operand types when searched a string with three dots.
DescriptionWith Racktables 0.22.0, when searching for a string with three dots, it returns the following error:

"
Fatal error: Uncaught TypeError: Unsupported operand types: string * int in /usr/share/webapps/RackTables/wwwroot/inc/functions.php:2542 Stack trace: #0 /usr/share/webapps/RackTables/wwwroot/inc/functions.php(2647): ip6_parse() #1 /usr/share/webapps/RackTables/wwwroot/inc/functions.php(5043): ip6_checkparse() #2 /usr/share/webapps/RackTables/wwwroot/inc/interface.php(3683): searchEntitiesByText() #3 /usr/share/webapps/RackTables/wwwroot/index.php(43): searchHandler() #4 {main} thrown in /usr/share/webapps/RackTables/wwwroot/inc/functions.php on line 2542
"

With any other number of "dots" in the string, it works fine.
Steps To ReproduceIn the "search" field, digit any domain with three dots: fourth.leveldomain.example.com
If searched for any other number of dots, it works fine.

Additional InformationThe issue happens in "RackTables/wwwroot/inc/functions.php on line 2542", as you can see from the error.
Probably the three dots is interpreted as IP address, so numbers are expected.

Thanks
TagsNo tags attached.

Activities

infrastation

infrastation

2022-09-23 09:44

administrator   ~0004433

Thank you for this bug report. I have tried "fourth.leveldomain.example.com " with RackTables versions 0.21.5 and 0.22.0 on PHP 7.4, and it worked as expected.

It would help to establish the exact steps to reproduce the bug. What are the OS and PHP versions on the system where the bug reproduces?
fcolista

fcolista

2022-09-23 10:06

reporter   ~0004435

Thanks for your prompt reply, I missed these important info, sorry.
it's Alpine Linux 3.16 with PHP 8.0.20:

PHP 8.0.20 (cli) (built: Jun 10 2022 09:06:30) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.20, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.20, Copyright (c), by Zend Technologies


# cat /etc/os-release
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.16.0
PRETTY_NAME="Alpine Linux v3.16"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://gitlab.alpinelinux.org/alpine/aports/-/issues"
infrastation

infrastation

2022-09-23 22:32

administrator   ~0004437

Thank you for this information. Does the following change solve the problem?
--- a/wwwroot/inc/functions.php
+++ b/wwwroot/inc/functions.php
@@ -2539,8 +2539,8 @@ function ip6_parse ($ip)
    if (count ($split) == 4)
    {
      $hex_tokens = array();
-     $hex_tokens[] = dechex ($split[0] * 256 + $split[1]);
-     $hex_tokens[] = dechex ($split[2] * 256 + $split[3]);
+     $hex_tokens[] = dechex ((int)$split[0] * 256 + (int)$split[1]);
+     $hex_tokens[] = dechex ((int)$split[2] * 256 + (int)$split[3]);
      array_splice ($tokens, -1, 1, $hex_tokens);
    }
    if (count ($tokens) > 8)
fcolista

fcolista

2022-09-26 08:44

reporter   ~0004439

Thanks @infrastation.
This indeed fix the error.
Thank you very much for the prompt fix!
infrastation

infrastation

2022-09-26 22:11

administrator   ~0004441

Thank you for confirming, this might be not the best way to address this problem, so if I get to reproduce the problem myself, the final fix might be different. Let's leave this open until that's clear.

Issue History

Date Modified Username Field Change
2022-09-23 08:45 fcolista New Issue
2022-09-23 09:44 infrastation Note Added: 0004433
2022-09-23 10:06 fcolista Note Added: 0004435
2022-09-23 22:32 infrastation Note Added: 0004437
2022-09-23 22:34 infrastation Assigned To => infrastation
2022-09-23 22:34 infrastation Status new => assigned
2022-09-26 08:44 fcolista Note Added: 0004439
2022-09-26 22:11 infrastation Note Added: 0004441