PEAR Forum :: PHP Extension and Application Repository

PEAR Forum Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Please help with this "stdClass" mimeDecode error

 
Post new topic   Reply to topic    PEAR Forum Forum Index -> Mail
View previous topic :: View next topic  
Author Message
mOrloff



Joined: 22 Dec 2009
Posts: 2
Location: The Great Pacific NW, USA

PostPosted: Wed Dec 23, 2009 12:02 am    Post subject: Please help with this "stdClass" mimeDecode error Reply with quote

This is all new and a bit obscure to me, and I'm getting an error that I don't know what to do with.
I am trying to use Mail_mimeDecode, and this is what it's throwing back at me: Catchable fatal error: Object of class stdClass could not be converted to string in /home/user/public_html/test.php on line 407

Here's the code I'm using (basically copied and pasted directly from the documentation on the PEAR site):
Code:

require_once '../php/Mail/mimeDecode.php';

$params['include_bodies'] = true;
$params['decode_bodies']  = true;
$params['decode_headers'] = true;

$decoder = new Mail_mimeDecode($email);
$structure = $decoder->decode($params);

echo $structure;   // NOTE: this is the line reported in the error (line 407)


I copied this from a mail-server bounceback, and am using it as a test email:
Code:

$email = 'Return-path: <[email protected]>
Received: from voyager1 by host133.hostmonster.com with local-bsmtp (Exim 4.69)
       (envelope-from <[email protected]>)
       id 1NLg8r-0004KO-GE
       for [email protected]; Fri, 18 Dec 2009 09:57:25 -0700
X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on
       host133.hostmonster.com
X-Spam-Level:
X-Spam-Status: No, score=-2.6 required=7.0 tests=AWL,BAYES_00,HTML_MESSAGE,
       SPF_PASS shortcircuit=no autolearn=ham version=3.2.4
Received: from mail-qy0-f204.google.com ([209.85.221.204])
       by host133.hostmonster.com with esmtp (Exim 4.69)
       (envelope-from <[email protected]>)
       id 1NLg8r-0004K4-82
       for [email protected]; Fri, 18 Dec 2009 09:57:25 -0700
Received: by qyk42 with SMTP id 42so1366756qyk.16
       for <[email protected]>; Fri, 18 Dec 2009 08:57:24 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
       d=gmail.com; s=gamma;
       h=domainkey-signature:mime-version:sender:received:date
        :x-google-sender-auth:message-id:subject:from:to:content-type;
       bh=DRbcZ/cLXNJUkCmhg8Gfzeg0LJBx43ThcnYeLl4fZSw=;
       b=j8d94ZOJoaTluQuW3XcmNUfHVE+Dy3n1Wqjz68J7HmfriZtH3eYtYban6IFBLYFE3X
        GrDz2oMbU1g7Jn9BHdZfEDUL+bHDjfBob2lWVRhhySSKWCWnKrgVx8XCMJ3fS7AeRsGo
        8mWVKo0vVvGs72hBaOJAUPYbrUnQ9BGeAAcUY=
DomainKey-Signature: a=rsa-sha1; c=nofws;
       d=gmail.com; s=gamma;
       h=mime-version:sender:date:x-google-sender-auth:message-id:subject
        :from:to:content-type;
       b=fcYXMxbeQKmkhDKpxHJS47F9lkbe0bDbygu+rdSS4ELrE4Yt9O7yce0SCvm2e/6cH0
        PQWTobDAlaRegJ1MHFrM3OPZTz+mwYLJjkC7dd4QnbH4GWKVmvCVM3JbJ6eMLNCB9mXG
        HlP40SrF4Z3MkP8J9SUKmA2ckIWG+iVbIgl8Q=
MIME-Version: 1.0
Received: by 10.229.54.143 with SMTP id q15mr2104641qcg.74.1261155444166; Fri,
       18 Dec 2009 08:57:24 -0800 (PST)
Date: Fri, 18 Dec 2009 08:57:24 -0800
X-Google-Sender-Auth: cc320e2f6cd1bdc6
Message-ID: <[email protected]>
Subject: sandbox attempt from test.php
From: "Mehile \"Mo\" Orloff" <[email protected]>
To: [email protected]
Content-Type: multipart/alternative; boundary=00151773e2d6418f1f047b03a280
X-Identified-User: {992:host133.hostmonster.com:voyager1:voyagercomponents.com} {sentby:spamassassin for local delivery to identified user}

--00151773e2d6418f1f047b03a280
Content-Type: text/plain; charset=ISO-8859-1

This is plain text content.

--00151773e2d6418f1f047b03a280
Content-Type: text/html; charset=ISO-8859-1

this is HTML content<br>

--00151773e2d6418f1f047b03a280--';


What do I need to fix to get past this error?

~ Mo
Back to top
View user's profile Send private message
mOrloff



Joined: 22 Dec 2009
Posts: 2
Location: The Great Pacific NW, USA

PostPosted: Wed Dec 30, 2009 7:34 pm    Post subject: RESOLVED (mostly) Reply with quote

For any other newbie who has this problem in the future, the problem is that ECHO doesn't work for objects.
I got some deeply appreciated help from Bryce Mickler. When I tried PRINT_R() instead of echo, I started getting somewhere.


Now I just need to learn how to get the content out of the object Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    PEAR Forum Forum Index -> Mail All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



PEAR Forum topic RSS feed 
Powered by phpBB © 2001, 2005 phpBB Group

Provided by Ministry of Web developement