LyraAdminBundle icon indicating copy to clipboard operation
LyraAdminBundle copied to clipboard

Bug found

Open pmithrandir opened this issue 11 years ago • 0 comments

Hello.

It's something small, but in Grid/column.php in function getValue(), I got a notice error because $value was not initialized. It blocked everything to display.

public function getValue($object)
    {
        $value = null;
        foreach ($this->methods as $method) {
            $value = $object->$method();
            if (!is_object($value)) {
                break;
            }
            $object = $value;
        }
        if ($this->formatFunction) {
            $value = call_user_func($this->formatFunction, $value, $this->format, $object);
        } else if(null !== $value && $this->format) {
            if ('date' == $this->type || 'datetime' == $this->type) {
                $value = $value->format($this->format);
            } else {
                $value = sprintf($this->format, $value);
            }
        }

        return $value;
    }

As you can see, I initialized $value to prevent the notice to happen in the elseif statement.

Not much else to say

Pierre

pmithrandir avatar Apr 04 '13 17:04 pmithrandir