ReadOnlyTraitLaravel icon indicating copy to clipboard operation
ReadOnlyTraitLaravel copied to clipboard

Illuminate Database: A void function must not return a value

Open michaelachrisco opened this issue 2 years ago • 0 comments

The newest version 9.0+ https://github.com/illuminate/database seems to be having issues with php 8.0+ Note this bug seems to only break this libraries CI job and NOT the official framework itself.

Im seeing the following error in illuminate/database/Eloquent/Model.php:

PHP Fatal error: A void function must not return a value in vendor/illuminate/database/Eloquent/Model.php on line 2077 I dont believe this is caused by this library but is currently breaking the CI build.

This does not seem to effect older PHP versions.

    /**
     * Set the value for a given offset.
     *
     * @param  mixed  $offset
     * @param  mixed  $value
     * @return void
     */
    public function offsetSet($offset, $value): void
    {$__KPOINTCUT_ARGS__ = func_get_args(); $__KPOINTCUT_SELF__ = isset($this) ? $this : get_called_class(); if ($__KPOINTCUT__ = \Kahlan\Plugin\Pointcut::before(__METHOD__, $__KPOINTCUT_SELF__, $__KPOINTCUT_ARGS__)) { $r = $__KPOINTCUT__($__KPOINTCUT_SELF__, $__KPOINTCUT_ARGS__); return $r; }
        echo('hello');
        $this->setAttribute($offset, $value);
    }

    /**
     * Unset the value for a given offset.
     *
     * @param  mixed  $offset
     * @return void
     */
    public function offsetUnset($offset): void
    {$__KPOINTCUT_ARGS__ = func_get_args(); $__KPOINTCUT_SELF__ = isset($this) ? $this : get_called_class(); if ($__KPOINTCUT__ = \Kahlan\Plugin\Pointcut::before(__METHOD__, $__KPOINTCUT_SELF__, $__KPOINTCUT_ARGS__)) { $r = $__KPOINTCUT__($__KPOINTCUT_SELF__, $__KPOINTCUT_ARGS__); return $r; }
        unset($this->attributes[$offset], $this->relations[$offset]);
    }

changing the above to: public function offsetSet($offset, $value): mixed "fixes" the issue but I haven't one a deep dive on what is going on to cause the type changes.

generated composer lock file is pulling fro the newest build here:

            "name": "illuminate/database",
            "version": "v9.0.2",
            "source": {
                "type": "git",
                "url": "https://github.com/illuminate/database.git",
                "reference": "23be1a5e1d6179cfd25c2174c5c0149d110fb628"
            },

michaelachrisco avatar Feb 14 '22 00:02 michaelachrisco