Categories > TinyButStrong general >

MergeBlock in foreach dynamic string names

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: cwells
Date: 2006-10-09
Time: 16:06

MergeBlock in foreach dynamic string names

This works perfectly fine in our development environment, but in our production environment, it does not:

// go through each piece
foreach($blocks as $piece => $val) {
    // then merge in an empty block for the unters that will not be displayed
    if($piece != $primaryBlock) $TBS->MergeBlock('Sub'.$piece, 'clear');
    // merge the piece (for the uber-level)
    $TBS->MergeBlock($piece, 'array', 'blocks['.$piece.']');
}

We're trying to merge in this array of navigation items, and like I said, it works perfectly fine in one environment.  The difference in environments seems to be the PHP version (PHP Version 4.4.1) and that the Zend Optimizer is installed in production.  When all is said and done, the end result seems to be that it's merging the same element over and over again, but the exact correct number of times.  For example, we would expect a top-level nav of:

Who | What | When | Where | Why

but we get

Who | Who | Who | Who | Who

So it does it five times, but it doesn't seem to be pulling in the right thing.  Are there any known issues with this PHP version, or the Zend Optimizer?  Our TBS version says "Version  : 3.1.1 for PHP >= 4.0.6"

.cw.
By: Skrol29
Date: 2006-10-09
Time: 17:31

Re: MergeBlock in foreach dynamic string names

Hi,

The problem you're describing seems to be the same fixed by TBS 2.05.4.
More details about this bug here:
  http://www.tinybutstrong.com/support/changelog_tbs2.htm

This is a bad bug that occurs because of a bug in PHP 4.4.1, this version only. TBS contains special patch in the code in order to avoid this bug, but it seems that Zend Optimizer makes the TBS patch unavailable.

Could could send to me the full contents of the string returned by the constant PHP_VERSION when you are running in production with Zend Optimizer ?

My personal suggestion is to not use PHP 4.4.1 because this bug can affect other libraries and can make your coders beeing made.