php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23932 PEAR_Frontend_CLI::displayError shouldn't dereference $eobj
Submitted: 2003-05-31 18:18 UTC Modified: 2003-06-06 11:10 UTC
From: greg at chiaraquartet dot net Assigned: mj (profile)
Status: Closed Package: PEAR related
PHP Version: 4.3.2 OS: Windows XP
Private report: No CVE-ID: None
 [2003-05-31 18:18 UTC] greg at chiaraquartet dot net
it would be helpful to know for sure whether PEAR_Frontend_CLI::displayError() accepts both strings and objects (a little @param string|object in a docblock would be helpful here).

In any case, if you do pear info blah there is a call to a non-object because the source which is:

    function displayError($eobj)
    {
        return $this->_displayLine($eobj->getMessage());
    }

should be:

    /**
     * @param string Error Message
     */
    function displayError($eobj)
    {
        return $this->_displayLine($eobj);
    }

or:

    /**
     * @param object|string either an error message
     *        or a class with a getMessage() method
     */
    function displayError($eobj)
    {
        if (is_object($eobj) {
            return $this->_displayLine($eobj->getMessage());
        } else {
            return $this->_displayLine($eobj);
        }
    }

    }

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-06-06 11:10 UTC] mj@php.net
Instead of using ui->displayError() in doInfo(), I've changed it to use PEAR::raiseError(). This way it's consistent and we don't need to change the parameter type of displayError(). Apart from that I've added the doc comment in CLI.php, which you've suggested.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Oct 28 12:03:36 2021 UTC