10 Replies - 1307 Views - Last Post: 16 September 2011 - 07:35 AM Rate Topic: -----

#1 USIT-HI  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 67
  • Joined: 14-September 11

How to test for error thrown in class.phpmailer.php?

Posted 15 September 2011 - 07:17 AM

If this is the wrong place to discuss my problem, please excuse the disturbance. (My second day of looking for help at Dreamincode is still confusing. I posted a question yesterday, but now can't find it!)

My web site u-sit.net, has a registration page for collecting payment information before passing the customer to PayPal.This page was crippled earlier this year and I've spent many weeks trying to fix it. I've switched to PHP5, which may have some hidden got'chas! I'm too inexperienced with PHP5 to know.

Problem: my RGSTRTN script has calls two scripts as REQUIRED_ONCE inclusions. One calls CLASS.PHPMAILER.php the other calls a PayPal listener IPNtestCode5.php (my adaptation of an open source example script.) These three scripts have been extracted from the larger site code and are being tested as a smaller package with preset customer data.

When this package is run class.phpmailer.php throws an error:
syntax error, unexpected T_STRING, expecting T_CATCH in /home/.../class.phpmailer.php on line 595.
Class.phpmailer.php is an open source script that I have not modified (and don't know enough about OOP to try to). So I'm attempting to adjust the other two scripts to be compatible with class.phpmailer.

I now need some suggestions of how to go about isolating the cause of this error.

Any help will be greatly appreciated.
ed

Is This A Good Question/Topic? 0
  • +

Replies To: How to test for error thrown in class.phpmailer.php?

#2 no2pencil  Icon User is online

  • Toubabo Koomi
  • member icon

Reputation: 5234
  • View blog
  • Posts: 27,025
  • Joined: 10-May 07

Re: How to test for error thrown in class.phpmailer.php?

Posted 15 September 2011 - 07:21 AM

View PostUSIT-HI, on 15 September 2011 - 10:17 AM, said:

If this is the wrong place to discuss my problem, please excuse the disturbance.

All of the sub-forums are on the right.

The introduce yourself sub forum is for introducing yourself. Any language related questions should go under that languages sub-forum. For example this is a php question, it should go under the php-sub forum.

I'll move it for you.

View PostUSIT-HI, on 15 September 2011 - 10:17 AM, said:

When this package is run class.phpmailer.php throws an error:
syntax error, unexpected T_STRING, expecting T_CATCH in /home/.../class.phpmailer.php on line 595.
Class.phpmailer.php is an open source script that I have not modified (and don't know enough about OOP to try to).

We would have to see the code. Can you post what's relevant to that line number? It could be anything from incorrect code, to a variable with a single quote not being escaped. It's difficult (if not impossible) to tell you why it's failing without seeing it.
Was This Post Helpful? 1
  • +
  • -

#3 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6053
  • View blog
  • Posts: 23,488
  • Joined: 23-August 08

Re: How to test for error thrown in class.phpmailer.php?

Posted 15 September 2011 - 09:56 AM

Can you tell use from where exactly you got the PHPmailer script you're using?
Was This Post Helpful? 1
  • +
  • -

#4 USIT-HI  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 67
  • Joined: 14-September 11

Re: How to test for error thrown in class.phpmailer.php?

Posted 15 September 2011 - 11:20 AM

THNx for the two quick responses.
Using PHP v. 5.2.6 on Apache 2.0.49.
Unzipped phpmailer from PHPMailer_v2.0.4.zip early this year.

Testing the following

RGSTRTN_06_5.php (w/ preloaded customer data).
L.048 require_once($_SERVER['DOCUMENT_ROOT'].'/lib/.../class.phpmailer.php')
L.608 <input type=hidden name=notify_url value='http://www.u-sit.net/auxlib/web07/
HTMLpages/IPNtestCode2.php'/> (This line sends the url to PayPal via their BuyNow Button. PP returns the
data & sale confirmation.)

Both L.048 & L.608 req. phpmailer. The error thrown is ...
"Parse error: syntax error, unexpected T_STRING, expecting T_CATCH in /home/.../class.phpmailer.php on line 595"
The relevant code at line 595 follows ...

      if($this->smtp->Connect(((!empty($this->SMTPSecure))?$this->SMTPSecure.'://>/':'').$host, $port, $this->Timeout)) {
        if ($this->Helo != '') {
          $this->smtp->Hello($this->Helo);
        } else {
          $this->smtp->Hello($this->ServerHostname());
        }

(595)    $connection = true;
        if($this->SMTPAuth) {
          if(!$this->smtp->Authenticate($this->Username, $this->Password)) {
            $this->SetError($this->Lang('authenticate'));
            $this->smtp->Reset();
            $connection = false;
          }
        }
      }


I did a try/catch enclosing the full mailing snippet in RGSTRTN.php but it didn't catch anything.

I'm at a loss for ideas of how to find the cause of the error.

thnx for u'r spprt
ed
PS; where is formatting discussed for this submission (e.g. indenting txt)?
Was This Post Helpful? 0
  • +
  • -

#5 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3515
  • View blog
  • Posts: 10,146
  • Joined: 08-June 10

Re: How to test for error thrown in class.phpmailer.php?

Posted 15 September 2011 - 11:29 AM

from the message itself it looks like a try block without a catch block.
Was This Post Helpful? 1
  • +
  • -

#6 USIT-HI  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 67
  • Joined: 14-September 11

Re: How to test for error thrown in class.phpmailer.php?

Posted 15 September 2011 - 12:01 PM

yeah, it does, but the snippet shown, containing L. 595 is where the error points in class.phpmailer. My attempted try/catch encased the mail snippet in RGSTRTN_06_5.php where the phpmailer support is needed.
I didn't know where else to try, since I assume that the unzipped class.phpmailer would be error free. Perhaps I should begin isolating section of class.phpmailer(?)
Was This Post Helpful? 0
  • +
  • -

#7 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6053
  • View blog
  • Posts: 23,488
  • Joined: 23-August 08

Re: How to test for error thrown in class.phpmailer.php?

Posted 15 September 2011 - 01:26 PM

It appears from my Google search of PHPmailer 2.0.4 that it's for PHP4, NOT PHP5. That would certainly cause potential problems...
Was This Post Helpful? 1
  • +
  • -

#8 USIT-HI  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 67
  • Joined: 14-September 11

Re: How to test for error thrown in class.phpmailer.php?

Posted 15 September 2011 - 01:35 PM

thnx JackOfAllTrades, that's good to know.
I'll do a search for a version of class.phpmailer for PHP5.
USIT-HI
Was This Post Helpful? 0
  • +
  • -

#9 USIT-HI  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 67
  • Joined: 14-September 11

Re: How to test for error thrown in class.phpmailer.php?

Posted 16 September 2011 - 06:33 AM

Thnx to JackOfAllTrades I’ve replaced phpmailer.v2.0.4 w/ phpmailer-lite (for PHP5).
REQ_ONC calls were updated accordingly.

Low&Behold the same error is thrown: “unexpected T_STRING, expecting T_CATCH in /home...phpmailer5/class.phpmailer.php on line 595!

?Although ‘phpmailer5/class.phpmailer.php’ in the above line has been replaced w/
‘phpmailer5_6/phpmailer-lite.php’, in all instances I can find, ‘require’ and ‘include’ statements now point to ‘phpmailer-lite.php’.

Searches for ‘phpmailer.php’, ‘require_’ and ‘include’ in the scripts being tested (RGSTRTN_06_5.php, IPNtestCode5.php) found no calls to phpmailer.php. Somewhere an unseen link is lurking!

I edit php code in Notepad++ and ftp to my web host using FileZilla.5.0.1.

The test file structure is ...
RGSTRTN_06_5.php
|_ REQUIRE_ONCE .../phpmailer5_6/phpmailer-lite.php
__|__ REQUIRE_ONCE IPNtestCode5.php
_____________________|_REQUIRE_ONCE .../phpmailer5_6/phpmailer-lite.php

Any ideas of what I’ve overlooked? Why doesn’t the modified RGSTRTN_05_5.php code find phpmailer-lite.php? What other tests could find the cause?

USIT-HI /w thnx

This post has been edited by USIT-HI: 16 September 2011 - 06:35 AM

Was This Post Helpful? 0
  • +
  • -

#10 USIT-HI  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 67
  • Joined: 14-September 11

Re: How to test for error thrown in class.phpmailer.php?

Posted 16 September 2011 - 06:58 AM

:hammer:HOLD OFF!
I found it!
:nottalkingtoyou:
I used to have a secretary to blame in cases like this.
But now, mea culpa!!! (one file didn't get reloaded)

thnx
USIT-HI
Was This Post Helpful? 0
  • +
  • -

#11 no2pencil  Icon User is online

  • Toubabo Koomi
  • member icon

Reputation: 5234
  • View blog
  • Posts: 27,025
  • Joined: 10-May 07

Re: How to test for error thrown in class.phpmailer.php?

Posted 16 September 2011 - 07:35 AM

Glad to see you got it fixed!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1