Skip to content

PHP 8 deprecated warning on Syntax>Column #129

@vanbe

Description

@vanbe

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)) {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions