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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: greg at chiaraquartet dot net
New email:
PHP Version: OS:

 

 [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: Sat Apr 20 12:01:28 2024 UTC