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

PHP 8 deprecated warning on Syntax>Column #129

Open
vanbe opened this issue Apr 2, 2023 · 4 comments
Open

PHP 8 deprecated warning on Syntax>Column #129

vanbe opened this issue Apr 2, 2023 · 4 comments

Comments

@vanbe
Copy link

vanbe commented Apr 2, 2023

I recently upgrated to PHP 8.2, and getting warnings on Column->setAlias($alias) function line 115.

Code:

public function setAlias($alias)
    {
        if (0 == \strlen($alias)) {
            $this->alias = null;

            return $this;
        }

        if ($this->isAll()) {
            throw new QueryException("Can't use alias because column name is ALL (*)");
        }

        $this->alias = (string) $alias;

        return $this;
    }

Throws Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in ...app/Vendor/nilportugues/sql-query-builder/src/Syntax/Column.php on line 115

The strlen line should be:

if ($alias === null || 0 == \strlen($alias)) {

@rafark
Copy link

rafark commented May 25, 2023

Came to post this issue too. Have you considered a pull request? @nilportugues

@rafark
Copy link

rafark commented May 25, 2023

To provide more context, this happens (at least to me), when trying to select all columns (when not specifying conditions), by just calling Select::setTable() and no other methods.

For the query string:

SELECT ``options_table``.* FROM ``options_table``

PHP 81

@nilportugues
Copy link
Owner

I'm considering releasing this package as a PHP 8.2 and above, yeah.

@akamaccio
Copy link

I'm considering releasing this package as a PHP 8.2 and above, yeah.

The big question is WHEN!?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants