compatibility issue with tidy 5.6 #1276

Closed
opened 2026-02-05 00:28:18 +03:00 by OVERLORD · 3 comments
Owner

Originally created by @Occyss on GitHub (Jul 26, 2019).

Describe the bug
There is a compatibility issue with tidy 5.6 that provoke the same issue mentionned in #610 but with every revision pages and without changing the editor.

It works well with tidy 5.4 and for some reason there aren't any version 5.6 for ubuntu (this why there are no problem with a bookstack installation on ubuntu yet).

Related to htmldiff #139

Current Behavior
from books/foo/page/bar/revisions only a few characters from each line are showing.

Steps to Reproduce
Docker linuxserver or install bookstack in a centos/redhat VM (with tidy 5.6) then :

  • Create a book -> chapter -> page
  • Add content and save
  • Make an edit
  • From the page go to More -> Revisions and click Changes for the edit

Screenshots
Example : https://ibb.co/37BJ5DF
Actually the hole page is like : https://ibb.co/BcCFvj4

Your Configuration (please complete the following information):

  • Exact BookStack Version (Found in settings): 0.26.3
  • PHP Version: 7.2
  • Hosting Method (Nginx/Apache/Docker): Docker linuxserver and tried also on a redhat VM

Additional context
What I have tried :

  • manual install on a redhat VM with nginx and apache -> same problem
  • install with the installation script on ubuntu 16.04/18.04 VM -> no problem

On my redhat VM, I could fix the issue by :

Originally created by @Occyss on GitHub (Jul 26, 2019). **Describe the bug** There is a compatibility issue with tidy 5.6 that provoke the same issue mentionned in #610 but with every revision pages and without changing the editor. It works well with tidy 5.4 and for some reason there aren't any version 5.6 for ubuntu (this why there are no problem with a bookstack installation on ubuntu yet). Related to htmldiff #139 **Current Behavior** from books/foo/page/bar/revisions only a few characters from each line are showing. **Steps to Reproduce** [Docker linuxserver](https://github.com/linuxserver/docker-bookstack) or install bookstack in a centos/redhat VM (with tidy 5.6) then : - Create a book -> chapter -> page - Add content and save - Make an edit - From the page go to More -> Revisions and click Changes for the edit **Screenshots** **Example** : https://ibb.co/37BJ5DF Actually the hole page is like : https://ibb.co/BcCFvj4 **Your Configuration (please complete the following information):** - Exact BookStack Version (Found in settings): 0.26.3 - PHP Version: 7.2 - Hosting Method (Nginx/Apache/Docker): [Docker linuxserver](https://github.com/linuxserver/docker-bookstack) and tried also on a redhat VM **Additional context** **What I have tried :** - manual install on a redhat VM with nginx and apache -> same problem - install with [the installation script](https://github.com/BookStackApp/devops/blob/master/scripts/installation-ubuntu-16.04.sh) on ubuntu 16.04/18.04 VM -> no problem **On my redhat VM, I could fix the issue by :** - removing php-tidy - installing tidy5.4.0 from http://binaries.html-tidy.org/ - installing php-tidy again - rebooting
OVERLORD added the 🐛 Bug🏭 Back-End labels 2026-02-05 00:28:18 +03:00
Author
Owner

@thelamer commented on GitHub (Jul 26, 2019):

If any developers are looking and have a local docker setup you can debug this image using this compose file:

---
version: "2"
services:
  bookstack:
    image: lsiodev/bookstack:v0.26.3-pkg-7e80b73c-dev-be7359e1a7579d9ee3a76039278ce4a0369bcb5d
    container_name: bookstack
    environment:
      - DB_HOST=bookstack_db
      - DB_USER=bookstack
      - DB_PASS=bookpass
      - DB_DATABASE=bookstackapp
    ports:
      - 6875:80
      - 8000:8000
    restart: unless-stopped
    depends_on:
      - bookstack_db
  bookstack_db:
    image: linuxserver/mariadb
    container_name: bookstack_db
    environment:
      - MYSQL_ROOT_PASSWORD=bookpass
      - TZ=Europe/London
      - MYSQL_DATABASE=bookstackapp
      - MYSQL_USER=bookstack
      - MYSQL_PASSWORD=bookpass
    restart: unless-stopped

This will spinup bookstack on 6875 and a web based IDE to modify code and debug on 8000.

Downstream we will hack the previous version of the lib pending updates from you.

@thelamer commented on GitHub (Jul 26, 2019): If any developers are looking and have a local docker setup you can debug this image using this compose file: ``` --- version: "2" services: bookstack: image: lsiodev/bookstack:v0.26.3-pkg-7e80b73c-dev-be7359e1a7579d9ee3a76039278ce4a0369bcb5d container_name: bookstack environment: - DB_HOST=bookstack_db - DB_USER=bookstack - DB_PASS=bookpass - DB_DATABASE=bookstackapp ports: - 6875:80 - 8000:8000 restart: unless-stopped depends_on: - bookstack_db bookstack_db: image: linuxserver/mariadb container_name: bookstack_db environment: - MYSQL_ROOT_PASSWORD=bookpass - TZ=Europe/London - MYSQL_DATABASE=bookstackapp - MYSQL_USER=bookstack - MYSQL_PASSWORD=bookpass restart: unless-stopped ``` This will spinup bookstack on 6875 and a web based IDE to modify code and debug on 8000. Downstream we will hack the previous version of the lib pending updates from you.
Author
Owner

@ssddanbrown commented on GitHub (Apr 2, 2020):

Thanks for the detailed report @Occyss and apologies for my really late reply.

Also thanks @thelamer for the container with the built-in editor, That is just some awesome magic. Worked great for debugging.

Have spent some time tracking this down, Found the following:

Upstream issues

Findings

Looks like this is fixed in more recent tidy versions, but those versions are not widespread or really published as of yet.

Interestingly, My dev environment is on Ubuntu 19.10 and I appear to have tidy 5.6 installed but I do not get the issue. From what I can see, maintainers have back-ported patches to 5.6 hence fixing this.

Possible Fixes

  • Option A: Wait it out for systems to gain the latest version of tidy.
  • Option B: Replacing false on this line with 2147483647 appears to fix this. Could cause other issues in other edge cases (Really long html lines) but might be a lesser evil. Would require a temporary fork of the library.
  • Find another library to do the diffing.
@ssddanbrown commented on GitHub (Apr 2, 2020): Thanks for the detailed report @Occyss and apologies for my really late reply. Also thanks @thelamer for the container with the built-in editor, That is just some awesome magic. Worked great for debugging. Have spent some time tracking this down, Found the following: ### Upstream issues * https://github.com/htacg/tidy-html5/issues/673 * https://github.com/htacg/tidy-html5/issues/858 * https://github.com/htacg/tidy-html5/issues/780 ### Findings Looks like this is fixed in more recent tidy versions, but those versions are not widespread or really published as of yet. Interestingly, My dev environment is on Ubuntu 19.10 and I appear to have tidy 5.6 installed but I do not get the issue. From what I can see, maintainers have back-ported patches to 5.6 hence fixing this. ### Possible Fixes - Option A: Wait it out for systems to gain the latest version of tidy. - Option B: Replacing `false` on [this line](https://github.com/gathercontent/htmldiff/blob/24674a62315f64330134b4a4c5b01a7b59193c93/src/GatherContent/Htmldiff/Processor.php#L10) with `2147483647` appears to fix this. Could cause other issues in other edge cases (Really long html lines) but might be a lesser evil. Would require a temporary fork of the library. - Find another library to do the diffing.
Author
Owner

@ssddanbrown commented on GitHub (Dec 18, 2020):

I went with the last option here, and ported an alternative library to PHP for use in BookStack: https://github.com/ssddanbrown/HtmlDiff

This is ready to be part of the next release, v0.31, so I'll close this off as it will no longer apply on the current master branch on future releases.

Thanks again for the detailed report @Occyss

@ssddanbrown commented on GitHub (Dec 18, 2020): I went with the last option here, and ported an alternative library to PHP for use in BookStack: https://github.com/ssddanbrown/HtmlDiff This is ready to be part of the next release, v0.31, so I'll close this off as it will no longer apply on the current master branch on future releases. Thanks again for the detailed report @Occyss
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#1276