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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
47 + 2 = ?
Subscribe to this entry?

 
 [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-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 09:01:28 2024 UTC