Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NOTICE: PHP message: PHP Fatal error: Uncaught TypeError: implode() expects parameter 2 to be array, null given in src/Utils/Routine.php:123 #293

Open
williamdes opened this issue Feb 28, 2020 · 2 comments
Labels
bug

Comments

@williamdes
Copy link
Member

@williamdes williamdes commented Feb 28, 2020

NOTICE: PHP message: PHP Fatal error:  Uncaught TypeError: implode() expects parameter 2 to be array, null given in vendor/phpmyadmin/sql-parser/src/Utils/Routine.php:123"
Stack trace:"
#0 vendor/phpmyadmin/sql-parser/src/Utils/Routine.php(123): implode(',', NULL)"
#1 libraries/classes/Rte/RteList.php(304): PhpMyAdmin\SqlParser\Utils\Routine::getParameters(Object(PhpMyAdmin\SqlParser\Statements\CreateStatement))"
#2 libraries/classes/Rte/RteList.php(169): PhpMyAdmin\Rte\RteList->getRoutineRow(Array, '')"
#3 libraries/classes/Rte/Routines.php(131): PhpMyAdmin\Rte\RteList->get('routine', Array)"
#4 libraries/classes/Controllers/Database/RoutinesController.php(42): PhpMyAdmin\Rte\Routines->main('PROCEDURE')"
#5 db_routi..."
@williamdes williamdes added the bug label Feb 28, 2020
@williamdes
Copy link
Member Author

@williamdes williamdes commented Feb 28, 2020

{
    "name": {
        "database": null,
        "table": "foo",
        "column": null,
        "expr": "`foo`",
        "alias": null,
        "function": null,
        "subquery": null
    },
    "entityOptions": {
        "options": []
    },
    "fields": null,
    "select": null,
    "like": null,
    "partitionBy": null,
    "partitionsNum": null,
    "subpartitionBy": null,
    "subpartitionsNum": null,
    "partitions": null,
    "table": null,
    "return": null,
    "parameters": [
        {
            "name": "$",
            "inOut": null,
            "type": {
                "name": "FOO",
                "parameters": [],
                "options": {
                    "options": []
                }
            }
        },
        {
            "name": null,
            "inOut": null,
            "type": null
        }
    ],
    "body": [
        {
            "token": "select",
            "value": "SELECT",
            "keyword": "SELECT",
            "type": 1,
            "flags": 3,
            "position": 54
        },
        {
            "token": " ",
            "value": " ",
            "keyword": null,
            "type": 3,
            "flags": 0,
            "position": 60
        },
        {
            "token": "$",
            "value": "$",
            "keyword": null,
            "type": 0,
            "flags": 0,
            "position": 61
        },
        {
            "token": "foo",
            "value": "foo",
            "keyword": null,
            "type": 0,
            "flags": 0,
            "position": 62
        },
        {
            "token": null,
            "value": null,
            "keyword": null,
            "type": 9,
            "flags": 0,
            "position": null
        }
    ],
    "options": {
        "options": {
            "4": {
                "name": "DEFINER",
                "equals": true,
                "expr": {
                    "database": null,
                    "table": null,
                    "column": "root@%",
                    "expr": "`root`@`%`",
                    "alias": null,
                    "function": null,
                    "subquery": null
                },
                "value": "`root`@`%`"
            },
            "6": "PROCEDURE"
        }
    },
    "first": 0,
    "last": 23
}

passed to getParameters

@williamdes
Copy link
Member Author

@williamdes williamdes commented Feb 28, 2020

CREATE DEFINER=`root`@`%` PROCEDURE `$a`(IN `$a` INT)
    NO SQL
SELECT $a
-- or
CREATE DEFINER=`root`@`%` PROCEDURE `foo`( $foo int )
select $foo

I had not success adding a test

    public function testGetParametersFromCreateStatement()
    {
        //CREATE DEFINER=`root`@`%` PROCEDURE `$a`(IN `$a` INT)\n    NO SQL\nSELECT $a
        $parser = new Parser('CREATE DEFINER=`root`@`%` PROCEDURE `foo`( $foo int )\nselect $foo');

        /**
         * @var CreateStatement $stmt
         */
        $stmt = $parser->statements[0];

        $this->assertNotNull(Routine::getParameters($stmt));
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.