f3-factory / fatfree-core

Fat-Free Framework core library
GNU General Public License v3.0
207 stars 88 forks source link

@PARAMS: Issue and difficult to upgrade from PHP 5 to PHP 7 and from F3 3.3 to 3.6/3.7 #242

Closed sineverba closed 6 years ago

sineverba commented 6 years ago

Hi to all, I have a (pretty old) web app on PHP5 + F3 3.3.0.

It works very well but... I would / need upgrade PHP from v5 to v7.

I did try F3 3.3.0 with PHP 7 and I got this error:

Fatal error: Cannot use $this as parameter in /var/www/vhosts/xxxx/httpdocs/lib/f3_330/base.php on line 1185

And line 1185 is REDIRECT method:

/**
    *   Redirect a route to another URL
    *   @return NULL
    *   @param $pattern string|array
    *   @param $url string
    */
    function redirect($pattern,$url) {
        if (is_array($pattern)) {
            foreach ($pattern as $item)
                $this->redirect($item,$url);
            return;
        }
        $this->route($pattern,function($this) use ($url) {
            $this->reroute($url);
        });
    }

So, I did move from 3.3.0 to lastest 3.6/3.7 F3.

It works, but I have an issue with an url.

The url is:

/transaction/page-1?id_aa=4&id_bb=112226

With PHP 5 + F3 3.3.0 with var_dump

var_dump(@PARAMS) I got

array(2) { [0]=> string(59) "/transaction/page-1?id_aa=4&id_bb=112226" ["page"]=> string(6) "page-1" }

(all perfect).

With PHP7 and F3 3.6.3 or 3.6.4 with same var_dump I got only

array(2) { [0]=> string(59) "/transaction/page-1" ["page"]=> string(6) "page-1" }

Missing the query strings on key 0.

Any help here? Thank you very much

xfra35 commented 6 years ago

Quite a few things have changed since 3.3.0.

You can find the full list in the changelog.

Especially there's that line:

Changed: Router works on PATH instead of URI (#126) NB: PARAMS.0 no longer contains the query string