PHP Bugs  
php.net | support | documentation | report a bug | advanced search | search howto | statistics | login

go to bug id or search bugs for  

Bug #39417 Tidy: Handling of 'new-blocklevel-tags' inconsistent
Submitted:7 Nov 2006 10:19pm UTC Modified: 30 Nov 2006 11:17pm UTC
From:konstantin dot ryabitsev at mcgill dot ca Assigned to:
Status:Bogus Category:Unknown/Other Function
Version:5.2.0 OS:Linux, Windows
Votes:8 Avg. Score:4.5 ± 0.9 Reproduced:8 of 8 (100.0%)
Same Version:6 (75.0%) Same OS:6 (75.0%)
View/Vote Developer Edit Submission

[7 Nov 2006 10:19pm UTC] konstantin dot ryabitsev at mcgill dot ca
Description:
------------
I seem to get odd behaviour running the following code. Theoretically
(and confirmed by running command-line tidy utility), the output should
contain all namespace-prepended tags. On my machine, the output only
contains the <wps:block> element, and none of the elements contained
within.

It's really weird. If I change the names to "wps:blo", "wps:var" and
"wps:val", it works. I'm really confused at this point.

Reproduce code:
---------------
<?php
$contents = '
<wps:block>
 <wps:var>
   <wps:value/>
 </wps:var>
</wps:block>';
$config = array(
    'new-blocklevel-tags' => 'wps:block,wps:var,wps:value'
);
$tidy = tidy_parse_string($contents, $config, 'utf8');
$tidy->cleanRepair();
print "{$tidy->value}\n";
?>

Expected result:
----------------
<html>
<head>
<title></title>
</head>
<body>
<wps:block>
<wps:var>
<wps:value></wps:var>
</wps:block>
</body>
</html>

Actual result:
--------------
<html>
<head>
<title></title>
</head>
<body>
<wps:block>
</body>
</html>

[7 Nov 2006 10:22pm UTC] konstantin dot ryabitsev at mcgill dot ca
Specifying "Tidy:" in the Summary.
[8 Nov 2006 3:07am UTC] iliaa@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

This is a libtidy bug.
[8 Nov 2006 2:40pm UTC] konstantin dot ryabitsev at mcgill dot ca
I disagree. The bug does not occur when running tidy with the same
parameters, only when invoked as part of a PHP script. I will ask on the
libtidy support list, but I believe their answer will be to file a bug
with php.
[23 Nov 2006 6:04pm UTC] konstantin dot ryabitsev at mcgill dot ca
Upstream Tidy developers have ruled that this bug is not a bug in
libtidy, but a bug in php bindings.

http://sourceforge.net/tracker/index.php?func=detail&aid=1598422&group_i
d=27659&atid=390963

Please do not close as "bogus" -- this is a PHP bug that needs to be
fixed.
[23 Nov 2006 6:57pm UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip

Cannot reproduce.
I get the very expected result.
[23 Nov 2006 8:51pm UTC] konstantin dot ryabitsev at mcgill dot ca
No, same results with the latest CVS snapshot. I have now been able to
reproduce this problem on the followin systems:

* Fedora Core 5
* Fedora Core 6
* RHEL 4
* Debian Unstable

It's not a corner case.

---------------------------
icon@rakta:[~]$ cat tidy.php
<?php
$contents = '
<wps:block>
 <wps:var>
   <wps:value/>
 </wps:var>
</wps:block>';
$config = array(
    'new-blocklevel-tags' => 'wps:block,wps:value,wps:var'
);
$tidy = tidy_parse_string($contents, $config, 'utf8');
$tidy->cleanRepair();
print "{$tidy->value}\n";

?>
icon@rakta:[~]$ php -version
PHP 5.2.1-dev (cli) (built: Nov 23 2006 15:32:59) 
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2006 Zend Technologies
icon@rakta:[~]$ php tidy.php
<html>
<head>
<title></title>
</head>
<body>
<wps:block>
</body>
</html>
[23 Nov 2006 8:56pm UTC] tony2001@php.net
Which Tidy version are you using?
[23 Nov 2006 8:59pm UTC] konstantin dot ryabitsev at mcgill dot ca
icon@rakta:[~]$ rpm -q libtidy
libtidy-0:0.99.0-11.20051025.fc6.i386

(this is the latest released -- I have previously built the latest CVS
of libtidy while testing this bug, but there was no difference in the
end-result)
[23 Nov 2006 9:11pm UTC] tony2001@php.net
Works just fine here using both libtidy-CVS and default SuSE version
(built on Mar 19 2005).
Please update libtidy to the latest CVS, and if that doesn't help, harp
on this to libtidy developers.

# ./sapi/cli/php /tmp/2.php
<html>
<head>
<title></title>
</head>
<body>
<wps:block><wps:var>
<wps:value></wps:var></wps:block>
</body>
</html>

# cat /tmp/2.php
<?php
$contents = '
<wps:block>
 <wps:var>
    <wps:value/>
         </wps:var>
         </wps:block>';
$config = array(
            'new-blocklevel-tags' => 'wps:block,wps:value,wps:var'
        );
$tidy = tidy_parse_string($contents, $config, 'utf8');
$tidy->cleanRepair();
print "{$tidy->value}\n";
?>
[23 Nov 2006 10:11pm UTC] konstantin dot ryabitsev at mcgill dot ca
It's great that it's working fine for you. However, it's not working for
me, and I can now add Windows into the pile:

http://blues.mcgill.ca/~icon/misc/not-making-it-up.png

So, now reproduced on 3 different linux distros, and 2 different
platforms.

I'm not sure how much more I can do to convince you that I'm not making
this up.

I have tried the exact same parameters from tidy python bindings. I do
not see the same error. The error only seems to occur when I use php
bindings.

If you are going to close this bug, please don't close as bogus. This
bug is real.
[23 Nov 2006 10:28pm UTC] tony2001@php.net
You seem to be the only (unlucky?) person on the earth able to reproduce
it, hence it doesn't seem to me as a problem of PHP.
If you want to keep this report open and not to be marked as bogus,
please provide at least some info required to reproduce it.
I'm very excited that Python bindings work fine for you. So does
ext/tidy for me.
[23 Nov 2006 11:10pm UTC] yatiohi at ideopolis dot gr
We are at least two persons on earth :-)

[belbo@abu tmp]$ php -version
PHP 5.1.6 (cli) (built: Nov  2 2006 16:46:15) 
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
[belbo@abu tmp]$ rpm -q libtidy
libtidy-0.99.0-11.20051025.fc6
[belbo@abu tmp]$ rpm -q php-tidy
php-tidy-5.1.6-1.fc6
[belbo@abu tmp]$ cat tidy.php 
<?php
$contents = '
<wps:block>
 <wps:var>
   <wps:value/>
 </wps:var>
</wps:block>';
$config = array(
    'new-blocklevel-tags' => 'wps:block,wps:value,wps:var'
);
$tidy = tidy_parse_string($contents, $config, 'utf8');
$tidy->cleanRepair();
print "{$tidy->value}\n";

?>
[belbo@abu tmp]$ php tidy.php 
<html>
<head>
<title></title>
</head>
<body>
<wps:block>
</body>
</html>
[30 Nov 2006 11:17pm UTC] nlopess@php.net
The tidy team assumed this bug. The problem is clearly identified,
although it isn't that easy to fix.
Anyway, this is not a bug in PHP, but rather in the libtidy.

RSS feed | show source 

PHP Copyright © 2001-2009 The PHP Group
All rights reserved.
Last updated: Sat Nov 21 10:30:49 2009 UTC