PHP Classes

Fatal Error

Recommend this page to a friend!

      HTML Parser  >  All threads  >  Fatal Error  >  (Un) Subscribe thread alerts  
Subject:Fatal Error
Summary:Class' Line 274
Messages:5
Author:David K. Lynn
Date:2015-05-30 11:00:31
 

  1. Fatal Error   Reply   Report abuse  
Picture of David K. Lynn David K. Lynn - 2015-05-30 11:00:31
Hi Dave,

This looks like a useful class but, when running example.php (including some of the alternative directives) it only returns:

Fatal error: Can't use function return value in write context in W:\Test\HTML_Parser\html.parser.class.php on line 274

Unfortunately, line 274 is:

if( !empty(trim($subNode->nodeValue)) ){

followed by assignments to $textCount and to the $GLOBALS['htmlTree'}... variables (case 3).

My quick review of your class code revealed numerous return statements for methods and the processDocument's return at line 118 (or 115 if there was an error).

Any suggestions or update?

Thanks!

  2. Re: Fatal Error   Reply   Report abuse  
Picture of Dave Smith Dave Smith - 2015-05-30 11:23:35 - In reply to message 1 from David K. Lynn
Well... PHP versions prior to 5.5 do not like anything but variables in language constructs.

I change it around to work and get an update out.

Dave

  3. Re: Fatal Error   Reply   Report abuse  
Picture of Dave Smith Dave Smith - 2015-05-30 11:41:20 - In reply to message 1 from David K. Lynn
I moved the trim out of the check for empty, in theory that should do the trick. The affected file is html.parser.class.php which has been updated.

Let me know if you have any other problems.

Dave

  4. Re: Fatal Error   Reply   Report abuse  
Picture of David K. Lynn David K. Lynn - 2015-05-30 22:05:43 - In reply to message 3 from Dave Smith
THANKS Dave! I'll check it out.

Regards,

DK

  5. Re: Fatal Error   Reply   Report abuse  
Picture of David K. Lynn David K. Lynn - 2015-05-30 23:08:10 - In reply to message 4 from David K. Lynn
Outstanding! Works like a champ now! THANKS!

Regards,

DK

 
For more information send a message to info at phpclasses dot org.