#214 problem testing empty textarea with tidy extension installed

Peter Meth

PHP 5.3.8 - WampServer
Windows 7 Ultimate 64-bit

I noticed a problem with $this->assertField('fieldname','');
The problem is that when the "tidy" php extension is installed, a different parser is used by SimpleTest. This parser seems to add an extra newline character to blank textarea values, which causes the assert to fail. The same assert passes when the "tidy" extension is not installed.
I believe this is a bug in tidy where tidy_parse_string(..) adds a \r to the end of the empty guard (eg. "___EMPTY___\r").

Steps to reproduce problem:
Install tidy extension in php
put an empty textarea field named fieldname on an html page, then write a simple test with
The test will fail if your version of tidy has the defect.

As a fix, I propose inserting the following before line 77 of tidy_parser.php:
// this should fix a bug with textareas where there is an extra \r on the end of the ___EMPTY___ guard.
$html = str_replace("___EMPTY___\r", "___EMPTY___", $html);

I don't think this should cause any problems even if the problem gets fixed in tidy.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks