Skip to content

[BUG]: call_user_func_array breaking change for php 8 in phalcon 5.4 #16797

@nadorator

Description

@nadorator

Description of the problem:
array_values($params) is missing in AbstractDispatcher.zep when using call_user_func_array.

This fix is already on 5.0.x branch but not 5.4.x

actual source code in 5.4.x:

public function callActionMethod(handler, string actionMethod, array! params = [])
    {
        return call_user_func_array(
            [handler, actionMethod],
            params
        );
    }

it should be:

public function callActionMethod(handler, string actionMethod, array! params = [])
    {
        return call_user_func_array(
            [handler, actionMethod],
            array_values(params)
        );
    }

Expected behavior
it should handle routing /admin/menu/:action/:params correctly and not report error on named parameters on compiled version of phalcon 5.4.

Error capture

trap: {"s":"35320","q":"\/admin\/menu\/get\/p\/0\/o\/asc"} {"type":1,"message":"Uncaught Error: Unknown named parameter $p in \/opt\/nenuphar\/src\/Clients\/index.php:39\nStack trace:\n#0 [internal function]: Phalcon\\Dispatcher\\AbstractDispatcher->callActionMethod()\n#1 [internal function]: Phalcon\\Dispatcher\\AbstractDispatcher->dispatch()\n#2 \/opt\/nenuphar\/src\/Clients\/index.php(39): Phalcon\\Mvc\\Application->handle()\n#3 {main}\n  thrown","file":"\/opt\/nenuphar\/src\/Clients\/index.php","line":39} [{"function":"Frog\\{closure}","args":[]}]

Details

  • Phalcon version: Phalcon 5.4
  • PHP Version: Php 8.2
  • Operating System: Debian 12
  • Installation type: Compiling from source
  • Zephir version 1.7
  • Server: Apache2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions