2018-03-12, 09:22:11
(This post was last modified: 2018-03-12, 09:25:29 by vanfruniken.)
Experimenting a little bit with get_defined_vars() inside a component, I discovered the existence of the following predefined vars: $id, $arguments, $args, $component, $saved_args.
The component seems to contain some of the source code from the component itself, usually html
But as soon as there appears a closing angle bracket ('>') in php code, the component seems to contain
source code FOLLOWING that angle bracker.
with the component definition
V<?php $a = 'A'; // xyz
echo 'The predefined variable $component = '.json_encode($component);
$D ='d';
?>W
we get
VThe predefined variable $component = "VW"W
but with a '>' in front of the xyz
V<?php $a = 'A'; // >xyz
echo 'The predefined variable $component = '.json_encode($component);
$D ='d';
?>W
results in
VThe predefined variable $component = "Vxyz\necho 'The predefined variable $component = '.json_encode($component);\n$D ='d';\n?>W"W
whereas a '>' inside the string in echo
V<?php $a = 'A'; // xyz
echo 'The predefined> variable $component = '.json_encode($component);
$D ='d';
yields
?>WVThe predefined> variable $component = "V variable $component = '.json_encode($component);\n$D ='d';\n?>W"W
Weird. What, if any, is the purpose of this predefined variable $component?
Probably unimportant or way beyond my level of comprehension.
The component seems to contain some of the source code from the component itself, usually html
But as soon as there appears a closing angle bracket ('>') in php code, the component seems to contain
source code FOLLOWING that angle bracker.
with the component definition
V<?php $a = 'A'; // xyz
echo 'The predefined variable $component = '.json_encode($component);
$D ='d';
?>W
we get
VThe predefined variable $component = "VW"W
but with a '>' in front of the xyz
V<?php $a = 'A'; // >xyz
echo 'The predefined variable $component = '.json_encode($component);
$D ='d';
?>W
results in
VThe predefined variable $component = "Vxyz\necho 'The predefined variable $component = '.json_encode($component);\n$D ='d';\n?>W"W
whereas a '>' inside the string in echo
V<?php $a = 'A'; // xyz
echo 'The predefined> variable $component = '.json_encode($component);
$D ='d';
yields
?>WVThe predefined> variable $component = "V variable $component = '.json_encode($component);\n$D ='d';\n?>W"W
Weird. What, if any, is the purpose of this predefined variable $component?
Probably unimportant or way beyond my level of comprehension.