PHP :: Bug #76683 :: tidy wraps even with wrap=0 (no wrapping)
php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76683 tidy wraps even with wrap=0 (no wrapping)
Submitted: 2018-07-30 11:09 UTC Modified: 2018-07-31 12:15 UTC
From: jordi dot cardona at gmail dot com Assigned:
Status: Open Package: Tidy (PECL)
PHP Version: 7.2.8 OS: Linux wc04.002info.com 4.17.7-10
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2018-07-30 11:09 UTC] jordi dot cardona at gmail dot com
Description:
------------
Tidy wraps text elements even when 'wrap' = 0 has been stated in configuration.
As http://tidy.sourceforge.net/docs/quickref.html#wrap states that 0 value means no wrapping. This worked in past versions (< php 7.2.7) but at least from that version and up to php 7.2.8 the wrap is made. 

A posible worakaround is to state a great enough value (i.e: PHP_INT_MAX), but stating -1 works as well.

Test script:
---------------
<?php
ob_start();
?>
<html>a html document</html>
<?php
$html = ob_get_clean();

// Specify configuration
$config = array(
           'indent'         => true,
           'output-xhtml'   => true,
           'wrap'           => 0,
);

// Tidy
$tidy = new tidy;
$tidy->parseString($html, $config, 'utf8');
$tidy->cleanRepair();

// Output
echo $tidy;
?>



Expected result:
----------------
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title></title>
  </head>
  <body>
    a html document
  </body>
</html>


Actual result:
--------------
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>
    </title>
  </head>
  <body>
    a
    html
    document
  </body>
</html>


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-07-30 14:23 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2018-07-30 14:23 UTC] cmb@php.net
I can't reproduce this with libtidy 5.4.0 (2017/03/01).  Which
libtidy version do you use (see PHP info)?
 [2018-07-31 11:15 UTC] jordi dot cardona at gmail dot com
-Status: Feedback +Status: Assigned
 [2018-07-31 11:15 UTC] jordi dot cardona at gmail dot com
My libtidy version is 5.6.0 (2017/11/25).
 [2018-07-31 12:15 UTC] cmb@php.net
-Status: Assigned +Status: Open -Assigned To: cmb +Assigned To:
 [2018-07-31 12:15 UTC] cmb@php.net
Thanks!
 
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Thu Aug 16 12:01:24 2018 UTC