Sandwich Posted November 19, 2003 Posted November 19, 2003 I'm having an extremely weird problem with osCommerce 2.2-MS2. Visually, the footer of a site I'm working on is being shoved into the right column, as shown outlined in red in the picture below: Here's a few points I have so far, to avoid duplicate effort: Point 1 In the page source, the cause of this is an incomplete table tag. I'm getting this: </td> </tr> </ </td> </tr> <!-- reviews_eof //--> Instead of this: </td> </tr> </table> </td> </tr> <!-- reviews_eof //--> As you can see, the </table> tag and the PHP line break ("\n" in the script source) are getting truncated and omitted, respectively. Effectively, it's as if (see Point 3) the script (in includes/classes/boxes.php) has changed from this: $tableBox_string .= '</table>' . "\n"; To this: $tableBox_string .= '</'; Point 2 This problem only occurs in the reviews box. The code that generates the problematic closing table tag, however, is the includes/classes/boxes.php file, not the includes/boxes/reviews.php. Point 3 The problem is not constant. When the session IDs are present in the page (no cookie yet), the problem exists. But when the session IDs are not automatically added to links and forms, the problem disappears. Point 4 When the inclusion of reviews.php in includes/column_right.php is copied to the bottom of the column as well as its current position, the "current position" reviews box has a complete </table> tag, but the second reviews box, right at the end of the right column, has the tag truncation problem. Now, thinking that it might possibly be some sort of weird string length limit that only showed up when the extra "osCid=#####" text was inserted that was truncating the $tableBox_string, I tried adding an HTML comment before the truncated </table> string, like this: $tableBox_string .= '<!-- am I missing ?--></table>' . "\n"; But my theory was proved wrong when the </table> tag was still truncated, and at the exact same spot, too: </td> </tr> <!-- am I missing ?--></ </td> </tr> <!-- reviews_eof //--> So basically, I'm stumped. Here's my includes/classes/boxes.php - the relevant line is 67: <?php /* $Id: boxes.php,v 1.33 2003/06/09 22:22:50 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ class tableBox { var $table_border = '0'; var $table_width = '100%'; var $table_cellspacing = '0'; var $table_cellpadding = '2'; var $table_parameters = ''; var $table_row_parameters = ''; var $table_data_parameters = ''; // class constructor function tableBox($contents, $direct_output = false) { $tableBox_string = '<table border="' . tep_output_string($this->table_border) . '" width="' . tep_output_string($this->table_width) . '" cellspacing="' . tep_output_string($this->table_cellspacing) . '" cellpadding="' . tep_output_string($this->table_cellpadding) . '"'; if (tep_not_null($this->table_parameters)) $tableBox_string .= ' ' . $this->table_parameters; $tableBox_string .= '>' . "\n"; for ($i=0, $n=sizeof($contents); $i<$n; $i++) { if (isset($contents[$i]['form']) && tep_not_null($contents[$i]['form'])) $tableBox_string .= $contents[$i]['form'] . "\n"; $tableBox_string .= ' <tr'; if (tep_not_null($this->table_row_parameters)) $tableBox_string .= ' ' . $this->table_row_parameters; if (isset($contents[$i]['params']) && tep_not_null($contents[$i]['params'])) $tableBox_string .= ' ' . $contents[$i]['params']; $tableBox_string .= '>' . "\n"; if (isset($contents[$i][0]) && is_array($contents[$i][0])) { for ($x=0, $n2=sizeof($contents[$i]); $x<$n2; $x++) { if (isset($contents[$i][$x]['text']) && tep_not_null($contents[$i][$x]['text'])) { $tableBox_string .= ' <td'; if (isset($contents[$i][$x]['align']) && tep_not_null($contents[$i][$x]['align'])) $tableBox_string .= ' align="' . tep_output_string($contents[$i][$x]['align']) . '"'; if (isset($contents[$i][$x]['params']) && tep_not_null($contents[$i][$x]['params'])) { $tableBox_string .= ' ' . $contents[$i][$x]['params']; } elseif (tep_not_null($this->table_data_parameters)) { $tableBox_string .= ' ' . $this->table_data_parameters; } $tableBox_string .= '>'; if (isset($contents[$i][$x]['form']) && tep_not_null($contents[$i][$x]['form'])) $tableBox_string .= $contents[$i][$x]['form']; $tableBox_string .= $contents[$i][$x]['text']; if (isset($contents[$i][$x]['form']) && tep_not_null($contents[$i][$x]['form'])) $tableBox_string .= '</form>'; $tableBox_string .= '</td>' . "\n"; } } } else { $tableBox_string .= ' <td'; if (isset($contents[$i]['align']) && tep_not_null($contents[$i]['align'])) $tableBox_string .= ' align="' . tep_output_string($contents[$i]['align']) . '"'; if (isset($contents[$i]['params']) && tep_not_null($contents[$i]['params'])) { $tableBox_string .= ' ' . $contents[$i]['params']; } elseif (tep_not_null($this->table_data_parameters)) { $tableBox_string .= ' ' . $this->table_data_parameters; } $tableBox_string .= '>' . $contents[$i]['text'] . '</td>' . "\n"; } $tableBox_string .= ' </tr>' . "\n"; if (isset($contents[$i]['form']) && tep_not_null($contents[$i]['form'])) $tableBox_string .= '</form>' . "\n"; } $tableBox_string .= '<!-- am I missing ?--></table>' . "\n"; if ($direct_output == true) echo $tableBox_string; return $tableBox_string; } } class infoBox extends tableBox { function infoBox($contents) { $info_box_contents = array(); $info_box_contents[] = array('text' => $this->infoBoxContents($contents)); $this->table_cellpadding = '0'; $this->table_parameters = 'class="infoBox"'; $this->tableBox($info_box_contents, true); } function infoBoxContents($contents) { $this->table_cellpadding = '3'; $this->table_parameters = 'class="infoBoxContents"'; $info_box_contents = array(); $info_box_contents[] = array(array('text' => tep_draw_separator('pixel_trans.gif', '100%', '1'))); for ($i=0, $n=sizeof($contents); $i<$n; $i++) { $info_box_contents[] = array(array('align' => (isset($contents[$i]['align']) ? $contents[$i]['align'] : ''), 'form' => (isset($contents[$i]['form']) ? $contents[$i]['form'] : ''), 'params' => 'class="boxText"', 'text' => (isset($contents[$i]['text']) ? $contents[$i]['text'] : ''))); } $info_box_contents[] = array(array('text' => tep_draw_separator('pixel_trans.gif', '100%', '1'))); return $this->tableBox($info_box_contents); } } class infoBoxHeading extends tableBox { function infoBoxHeading($contents, $left_corner = true, $right_corner = true, $right_arrow = false) { $this->table_cellpadding = '0'; if ($left_corner == true) { $left_corner = tep_image(DIR_WS_IMAGES . 'infobox/corner_left.gif'); } else { $left_corner = tep_image(DIR_WS_IMAGES . 'infobox/corner_right_left.gif'); } if ($right_arrow == true) { $right_arrow = '<a href="' . $right_arrow . '">' . tep_image(DIR_WS_IMAGES . 'infobox/arrow_right.gif', ICON_ARROW_RIGHT) . '</a>'; } else { $right_arrow = ''; } if ($right_corner == true) { $right_corner = $right_arrow . tep_image(DIR_WS_IMAGES . 'infobox/corner_right.gif'); } else { $right_corner = $right_arrow . tep_draw_separator('pixel_trans.gif', '11', '14'); } $info_box_contents = array(); $info_box_contents[] = array(array('params' => 'height="20" class="infoBoxHeading"', 'text' => $left_corner), array('params' => 'width="100%" height="20" class="infoBoxHeading"', 'text' => $contents[0]['text']), array('params' => 'height="20" class="infoBoxHeading" nowrap', 'text' => $right_corner)); $this->tableBox($info_box_contents, true); } } class contentBox extends tableBox { function contentBox($contents) { $info_box_contents = array(); $info_box_contents[] = array('text' => $this->contentBoxContents($contents)); $this->table_cellpadding = '1'; $this->table_parameters = 'class="infoBox"'; $this->tableBox($info_box_contents, true); } function contentBoxContents($contents) { $this->table_cellpadding = '4'; $this->table_parameters = 'class="infoBoxContents"'; return $this->tableBox($contents); } } class contentBoxHeading extends tableBox { function contentBoxHeading($contents) { $this->table_width = '100%'; $this->table_cellpadding = '0'; $info_box_contents = array(); $info_box_contents[] = array(array('params' => 'height="20" class="infoBoxHeading"', 'text' => tep_image(DIR_WS_IMAGES . 'infobox/corner_left.gif')), array('params' => 'height="20" class="infoBoxHeading" width="100%"', 'text' => $contents[0]['text']), array('params' => 'height="20" class="infoBoxHeading"', 'text' => tep_image(DIR_WS_IMAGES . 'infobox/corner_right_left.gif'))); $this->tableBox($info_box_contents, true); } } class errorBox extends tableBox { function errorBox($contents) { $this->table_data_parameters = 'class="errorBox"'; $this->tableBox($contents, true); } } class productListingBox extends tableBox { function productListingBox($contents) { $this->table_parameters = 'class="productListing"'; $this->tableBox($contents, true); } } ?>
hankster Posted November 19, 2003 Posted November 19, 2003 you're not the only one. I'm having virtually the exact same problem (truncated closing table tag) except it's happening to my Best Sellers box (also at the bottom of the right column).
Sandwich Posted November 19, 2003 Author Posted November 19, 2003 Hmm... same thing with the session IDs triggering it on and off, too?
Harald Ponce de Leon Posted November 19, 2003 Posted November 19, 2003 Please refer to the following bug report: http://www.oscommerce.com/community/bugs,1242 , osCommerce
hankster Posted November 19, 2003 Posted November 19, 2003 ok, checked out the bug report. So I can: - Change the .htaccess file in the catalog directory. Remove the comment in front of the line reading # php_value session.use_trans_sid 0 What exactly does this do? How does it affect osCommerce? Will there be any negative side-effects? thanx-
Guest Posted November 19, 2003 Posted November 19, 2003 It turns off auto-writing of session IDs in links. osCommerce does not use this, so there shouldn't be negative side effects, except that some servers don't seem to like that setting (which is why it is commented out). It also precludes you from using software that does use it in subdirectories of osCommerce (unless you turn it on in their .htaccess). Hth, Matt
Sandwich Posted November 24, 2003 Author Posted November 24, 2003 Ok, removing that commented line seems to have fixed the issue, but it addresses the effect, not the cause. Even if it's some sort of PHP bug and not something in osC, I'd like to know if anyone can explain - in any depth they'd want to - why this happens... :D
Sandwich Posted November 30, 2003 Author Posted November 30, 2003 Ok, now I'm getting an Error 500 every time I uncomment that line in the .htaccess. Any ideas?
Guest Posted November 30, 2003 Posted November 30, 2003 Ok, now I'm getting an Error 500 every time I uncomment that line in the .htaccess. Any ideas?File a bug report with your host: one, they are using a version of PHP with known bugs; two, they are apparently not letting you set your php_values. Alternately, you could try one of the other two solutions from the bug report (FORCE_COOKIE_USE or use ini_set in includes/application_top.php). The bug seems to be a buffer issue. The variable that PHP uses to hold a URL to do the rewriting is apparently too small, causing part of the code to get overwritten. Turning off session ID rewriting addresses the cause directly as it no longer tries to do the URL rewriting. The other solution (forcing cookie use is just another way of turning off session ID rewriting) is to upgrade to a newer version of PHP that does not have the bug. You can find more information about this in the PHP bug report URLs that Jan listed in the link that Harald posted. Hth, Matt
Sandwich Posted November 30, 2003 Author Posted November 30, 2003 Ok, now I'm getting an Error 500 every time I uncomment that line in the .htaccess. Any ideas?File a bug report with your host: one, they are using a version of PHP with known bugs; two, they are apparently not letting you set your php_values. Alternately, you could try one of the other two solutions from the bug report (FORCE_COOKIE_USE or use ini_set in includes/application_top.php). The bug seems to be a buffer issue. The variable that PHP uses to hold a URL to do the rewriting is apparently too small, causing part of the code to get overwritten. Turning off session ID rewriting addresses the cause directly as it no longer tries to do the URL rewriting. The other solution (forcing cookie use is just another way of turning off session ID rewriting) is to upgrade to a newer version of PHP that does not have the bug. You can find more information about this in the PHP bug report URLs that Jan listed in the link that Harald posted. Hth, Matt First of all, I am my host. :P But second, it used to work, and now it doesn't. Nothing changed on my server AFAIK, which is strange.
cfs Posted January 6, 2004 Posted January 6, 2004 I am having this problem also. Instead of changing the .htaccess file could you just have the page refresh itself automatically - the second time on my site it is never an issue? What does everyone think about that??? New to Oscommerce would rather not introduce new problems to the fix
Recommended Posts
Archived
This topic is now archived and is closed to further replies.