Frecuencio / sqlbuddy-php7

SqlBuddy with compatibility with PHP 5.5+ (PHP 7 Included)
MIT License
40 stars 30 forks source link

Fatal error: [] operator not supported for strings in.... #5

Closed A2-Dev closed 4 years ago

A2-Dev commented 6 years ago

Thank you for the fork, i was irritated at the thought of skinning adminer when i found sqlbuddy. It could still be prettier but it's way better. My heart dropped when i saw a mysql_connect error. Luckily i found your code. You saved the day, for me at least. ;)

According to google this is a php 7 issue but i'm not quite sure how no one else has run into this issue. Info and fix below.

_gimpy@GimpyDevil ~/publichtml/fukpma $ uname -a && apachectl -v && php -v && mysql -V FreeBSD GimpyDevil 11.1-RELEASE FreeBSD 11.1-RELEASE #0 r321309: Fri Jul 21 02:08:28 UTC 2017 amd64 Server version: Apache/2.4.33 (FreeBSD) PHP 7.2.6 (cli) (built: Jun 23 2018 01:23:24) ( NTS ) mysql Ver 14.14 Distrib 5.7.22, for FreeBSD11.1 (amd64)

Issue is from functions.php and occurs when i tried to run a sql statment.

block: function splitQueryText($query) specific line is: $querySplit = ""; Changing it to the following will fix it: $querySplit = array();

IP-CAM commented 6 years ago

SqlBuddy Reviewed Version : 2016 Carlos Martín Arnillas Confirm Non Function, if I try to run a query / statement. PHP v.7.2.7 There was an error receiving data from the server PHP v.7.1.19 Fatal error: Uncaught Error: [] operator not supported for strings in /home/jacobch/www/bigmax_ch/shop/admin/sqlbuddy/functions.php:469 Stack trace: #0 /home/jacobch/www/bigmax_ch/shop/admin/sqlbuddy/browse.php(31): splitQueryText('DELETE FROM `oc...') #1 {main} thrown in /home/jacobch/www/bigmax_ch/shop/admin/sqlbuddy/functions.php on line 469 PHP v.7.0.30 All works well ! You are connected to MySQL 5.5.5 with the user ......... mysql.db.internal. PHP Version: 7.0.30 Ernie

IP-CAM commented 4 years ago

Tried to export a Database, to be confronted with the same error as noted above. So I changed in Line 134 of the export.php file from $tables = ""; to $tables = array(); to make it work with PHP 7.1.x again. The same probably needs to be done in other Sections, where the above Error exists.

            // $tables = "";
            $tables = array();

            if ($conn->isResultSet($tableSql)) {
                while ($tableRow = $conn->fetchArray($tableSql)) {
                    $tables[] = $tableRow[0];
                }
            }
        }