Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F772945
D224.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Feb 1, 9:09 PM
Size
2 KB
Mime Type
text/x-diff
Expires
Sun, Feb 2, 9:09 PM (16 h, 28 m)
Engine
blob
Format
Raw Data
Handle
556223
Attached To
D224: INP-1562 - Don't overwrite template parameter value in <inp2:m_Param/> tag
D224.diff
View Options
Index: branches/5.2.x/core/kernel/nparser/ntags.php
===================================================================
--- branches/5.2.x/core/kernel/nparser/ntags.php
+++ branches/5.2.x/core/kernel/nparser/ntags.php
@@ -404,42 +404,47 @@
{
$o = parent::Open($tag);
- if ($o === false) {
+ if ( $o === false ) {
// some required params not passed
return $o;
}
+ $param_name = $tag['NP']['name'];
$capture_params = $tag['NP'];
- $capture_params['name'] = '__capture_' . $tag['NP']['name'];
+ $capture_params['name'] = '__capture_' . $param_name;
$capture_to_pass = $this->Parser->CompileParamsArray($capture_params);
- $code[] = "if (isset(\$_parser->Captures['{$tag['NP']['name']}'])) {";
- $code[] = "\${$tag['NP']['name']} = \$_parser->ParseBlock($capture_to_pass);";
+ $code[] = "if (isset(\$_parser->Captures['{$param_name}'])) {";
+ $code[] = "\t\${$param_name} = \$_parser->ParseBlock($capture_to_pass);";
+ $code[] = "\t\$params['{$param_name}'] = \${$param_name};";
+ $code[] = "\t\$tmp_{$param_name} = \${$param_name};";
$code[] = "}";
$code[] = "else {";
+
$to_pass = $this->Parser->CompileParamsArray($tag['NP']);
- $code[] = '$_p_ =& $_parser->GetProcessor(\'m\');';
- $code[] = '$_tag_params = ' . $to_pass . ';';
- $code[] = "\${$tag['NP']['name']} = \$_p_->PostProcess(\${$tag['NP']['name']}, \$_p_->PreparePostProcess(\$_tag_params));";
+ $code[] = "\t" . '$_p_ =& $_parser->GetProcessor(\'m\');';
+ $code[] = "\t" . '$_tag_params = ' . $to_pass . ';';
+ $code[] = "\t\$tmp_{$param_name} = \$_p_->PostProcess(\${$param_name}, \$_p_->PreparePostProcess(\$_tag_params));";
$code[] = "}";
- if (array_key_exists('result_to_var', $tag['NP']) && $tag['NP']['result_to_var']) {
- $code[] = "\$params['{$tag['NP']['result_to_var']}'] = \$_parser->GetParam('{$tag['NP']['result_to_var']}');";
+ if ( array_key_exists('result_to_var', $tag['NP']) && $tag['NP']['result_to_var'] ) {
+ $result_to_var = $tag['NP']['result_to_var'];
+ $code[] = "\${$result_to_var} = \$_parser->GetParam('{$result_to_var}');";
- if (array_key_exists('plus', $tag['NP'])) {
- $code[] = "\$params['{$tag['NP']['result_to_var']}'] += {$tag['NP']['plus']};";
+ if ( array_key_exists('plus', $tag['NP']) ) {
+ $code[] = "\${$result_to_var} += {$tag['NP']['plus']};";
}
- $code[] = "\${$tag['NP']['result_to_var']} = \$params['{$tag['NP']['result_to_var']}'];";
+ $code[] = "\$params['{$result_to_var}'] = \${$result_to_var};";
}
- elseif (array_key_exists('plus', $tag['NP'])) {
- $code[] = "\${$tag['NP']['name']} += {$tag['NP']['plus']};";
+ elseif ( array_key_exists('plus', $tag['NP']) ) {
+ $code[] = "\$tmp_{$param_name} += {$tag['NP']['plus']};";
}
- $code[] = "\$params['{$tag['NP']['name']}'] = \${$tag['NP']['name']};";
- $code[] = "echo (\${$tag['NP']['name']});";
+ $code[] = "echo (\$tmp_{$param_name});";
$this->AppendCode($o, $code);
+
return $o;
}
}
Event Timeline
Log In to Comment