Changeset 1651

Show
Ignore:
Timestamp:
03/31/08 09:19:47 (8 months ago)
Author:
fumiakiy
Message:

SetHashVar implemented correctly in PHP. BugId:70278

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/release-32/php/lib/block.mtsethashvar.php

    r1174 r1651  
    3030        $hash = $ctx->stash('__inside_set_hashvar'); 
    3131        $name = $ctx->stash('__name_set_hashvar'); 
    32         if (is_array($vars)) { 
    33             $vars[$name] = $hash
    34         } else
    35             $vars = array($name => $hash)
    36             $ctx->__stash['vars'] =& $vars
     32        $ctx->restore(array('__inside_set_hashvar', '__name_set_hashvar')); 
     33        $parent_hash = $ctx->stash('__inside_set_hashvar')
     34        if (isset($parent_hash))
     35            $parent_hash[$name] = $hash
     36            $ctx->stash('__inside_set_hashvar', $parent_hash)
    3737        } 
    38         $ctx->restore(array('__inside_set_hashvar', '__name_set_hashvar')); 
     38        else { 
     39            if (is_array($vars)) { 
     40                $vars[$name] = $hash; 
     41            } else { 
     42                $vars = array($name => $hash); 
     43                $ctx->__stash['vars'] =& $vars; 
     44            } 
     45        } 
     46        return $content; 
    3947    } 
    4048    return '';