CMS MADE SIMPLE FORGE

CMS Made Simple Core

 

[#9078] Missing " top" and most of "head" after upgrade from 1.11.4 to 1.11.5

avatar
Created By: Fred Polizo (fredp)
Date Submitted: Sun Mar 24 04:18:14 -0400 2013

Assigned To: Tapio Löytty (Stikki)
Version: 1.11.5
CMSMS Version: 1.11.5
Severity: Major
Resolution: Fixed
State: Closed
Summary:
Missing " top" and most of "head" after upgrade from 1.11.4 to 1.11.5
Detailed Description:
It appears there is a typo in the regex at line 120 of
class.CMSPageTemplateResource.php:

$compare_content = preg_replace('/<(head|\/head).+\b[^>]*>/', '##DUMMY##',
$compare_content);

I'm using HTML5 and the above regex is matching <header> tags. This results in
each page of the upgraded site being rendered without a "top" and only the last
bit of the "head" sections.  For example:
      om.css" />
     </head>
     <body>


I made the following change to line 120 and this resolved the problem--pages are
rendered correctly again:

$compare_content = preg_replace('/<(head|\/head)\b.+[^>]*>/', '##DUMMY##',
$compare_content);
		

Hope this helps,
Fred P.

P.S.  I upgraded using cmsmadesimple-english-diff-1.11.4-1.11.5.tar.gz


History

Comments
avatar
Date: 2013-03-24 07:19
Posted By: Tapio Löytty (Stikki)

Provide me actual html that breaks this.

I tested this just before release, and it worked fine, and it is still working
fine.
      
avatar
Date: 2013-03-24 08:13
Posted By: Rolf (rolf1)

Hi Fred

Do you use {strip}{/strip} in the template <head>?
If so, please remove it and try again with an unchanged file.

Rolf
      
avatar
Date: 2013-03-24 20:24
Posted By: Fred Polizo (fredp)

Hi, 

@Stikki:  Below, I've attached  a pruned down version of the template, which
still exhibits the problem.  Following that is the rendered HTML.

Also, after looking more closely at the code of
class.CMSPageTemplateResource.php, I see that my originally proposed fix is not
correct.  I had the sense of the test inverted. Sorry!

The following regex seems more correct:   '/<(head|\/head)\B\S[^>]*>/'

I tested this regex with a PHP command line. I attached the output of that test
using the 1.11.5 regex from line 120 and then my proposed regex.  Which output
do you think is more correct?

@Rolf:  Yes, this template does use {strip}{/strip} in a number of places, but
when I removed them all the problem still occurred.  Thanks for the suggestion,
though!

BEGIN REGEX TEST ==========
#original regex from line 120
php -r "echo preg_replace('/<(head|\/head).+\b[^>]*>/' , '##DUMMY##', '<head
>..</head><body><header>...</header>');"
##DUMMY##

#my proposed regex
php -r "echo preg_replace('/<(head|\/head)\B\S[^>]*>/', '##DUMMY##', '<head
>..</head><body><header>...</header>');"
<head >..</head><body>##DUMMY##...##DUMMY##
END REGEX TEST ============

BEGIN TEMPLATE ==============
{process_pagedata}<!doctype html><html lang="en">
<head><meta charset="UTF-8">

{metadata showbase=1}
{cms_stylesheet}

</head>
<body>
  {content assign=main_content}

  <header id="hdr">
    <ul>
      <li class="c1">
        <h1>{cms_selflink dir="start" text="Example Site"}</h1>
      </li>
      <li class="c2">
        Center Text
      </li>
      <li class="c3">
           <span class="logo">
<a href="http://example.org"><img src="http://example.org/logo.png"
alt="Example Site" title="The Example Site"/></a>
           </span>
      </li>
    </ul>
  </header>
<div id="content" class="colmask leftmenu">
  <div class="colright">
    <div class="col1wrap">
      <article id="main" class="col1">
        <!-- Column 2 start -->
        <h2>Content</h2>
        {$main_content nocache}<br /><br />
	<!-- Column 2 end -->
      </article>
    </div>
    <aside id="sidebar" class="col2">
      <h3>Sidebar Stuff</h3>
      <!-- Column 1 end -->
    </aside>
  </div>
</div>

<footer id="footer">Footer Stuff</footer>
</body>
</html>
END TEMPALTE ================

BEGIN HTML OUTPUT ============

lesheet}

</head>
<body>
  
  <header id="hdr">
    <ul>
      <li class="c1">
<h1> <a href="http://beta.lan/" title="Home Page, shortcut key=1"
>Example Site</a></h1>
      </li>
      <li class="c2">
        Center Text
      </li>
      <li class="c3">
           <span class="logo">
<a class="external" href="http://example.org"><img
src="http://example.org/logo.png" alt="Example Site" title="The Example
Site"/></a>
           </span>
      </li>
    </ul>
  </header>
<div id="content" class="colmask leftmenu">
  <div class="colright">
    <div class="col1wrap">
      <article id="main" class="col1">
        <!-- Column 2 start -->
        <h2>Content</h2>
        Here's the page content.<br /><br />
	<!-- Column 2 end -->
      </article>
    </div>
    <aside id="sidebar" class="col2">
      <h3>Sidebar Stuff</h3>
      <!-- Column 1 end -->
    </aside>
  </div>
</div>

<footer id="footer">Footer Stuff</footer>
</body>
</html>
END HTML OUTPUT==============
      
avatar
Date: 2013-04-01 06:33
Posted By: Fred Polizo (fredp)

I see that this bug's Resolution field is still set to "Awaiting Response". I
provided the html (and more, below) that was requested on 2013-03-24.  If you
require something else, please let me know.

Regards,
Fred P.
      
avatar
Date: 2013-04-26 01:45
Posted By: Fred Polizo (fredp)

I noticed SVN rev 8745 included a fix for this problem. Since the change is
included  in CMSMS 1.11.6, I decided to upgrade my test site and retest.  The
upgrade was successful and uneventful. Afterwards, pages again appear to be
rendered correctly.
So, as far as I'm concerned, this bug can be closed.


Thanks again for the fix!
      
avatar
Date: 2013-05-19 18:22
Posted By: Tapio Löytty (Stikki)

Fixed in 1.11.6

Patch applied by: calguy1000
      
Updates

Updated: 2013-09-07 20:34
state: Open => Closed

Updated: 2013-05-19 18:22
resolution_id: 10 => 7

Updated: 2013-03-24 07:19
resolution_id: => 10
assigned_to_id: 100 => 11306