|
Posted by comp.lang.tcl on 12/01/06 20:44
Bryan Oakley wrote:
> comp.lang.tcl wrote:
> > When I went into command-line and tried it (again I'm using HP-UX
> > apparently):
> >
> > [quote]
> > set php
> > <?
> > error_reporting(E_ALL & ~E_NOTICE);
> > ...
>
> You are obviously paraphrasing; the above is invalid tcl and can't
> possibly be what you are actually doing or you would get different
> error messages. When you are reporting results, please try to be exact.
> Show us *precisely* what you type.
Oh and I also tried this to, also to no avail:
% set php
<?
error_reporting(E_ALL & ~E_NOTICE);
$xml = preg_replace('/(>)[\n\r\\s\t]+(<)/', '$1$2',
$argv[1]); /* STRIP OUT WHITESPACE xml_parser_set_option() MIGHT MANGLE
XML */
$parser = @xml_parser_create();
@xml_parse_into_struct($parser, $xml, $xmlArray, $tags);
@xml_parser_free_parser($parser);
for ($i = 1; $i < @sizeof($xmlArray) - 1; $i++) {
foreach ($xmlArray[$i]['attributes'] as $attr => $val)
$tclList .= $attr . ' {' . str_replace('{', '{',
str_replace('}', '}', $val)) . '} '; /* ESCAPED CURLY BRACES FOR
TCL LIST */
}
echo trim($tclList);
?>
% exec php -q << $php
child process exited abnormally
% exec php << $php
X-Powered-By: PHP/4.4.4
Content-type: text/html
child process exited abnormally
% exec php -q << <? print_r("Hello World"); ?>
No input file specified.
child process exited abnormally
% exec php << <? print_r("hello world"); ?>
Status: 404
X-Powered-By: PHP/4.4.4
Content-type: text/html
No input file specified.
child process exited abnormally
>
>
> > $xml = preg_replace('/(>)[\\n\\r\\\s\\t]+(<)/', '$1$2',
> > $argv[1]); /* STRIP OUT WHITESPACE xml_parser_set_option() MIGHT MANGLE
> > XML */
> > $parser = @xml_parser_create();
> > @xml_parse_into_struct($parser, $xml, $xmlArray, $tags);
> > @xml_parser_free_parser($parser);
> > for ($i = 1; $i < @sizeof($xmlArray) - 1; $i++) \{
> > foreach ($xmlArray[$i]['attributes'] as $attr => $val)
> > $tclList .= $attr . ' \{' . str_replace('\{', '{',
> > str_replace('\}', '}', $val)) . '\} '; /* ESCAPED CURLY BRACES FOR
> > TCL LIST */
> > \}
> > echo trim($tclList);
> > ?>
> > % exec /usr/local/bin/php -q << $php
> > <br />
> > <b>Warning</b>: Unexpected character in input: '\' (ASCII=92) state=1
> > in <b>-</b> on line <b>7</b><br />
> > <br />
> > <b>Warning</b>: Unexpected character in input: '\' (ASCII=92) state=1
> > in <b>-</b> on line <b>10</b><br />
> > child process exited abnormally
> >
> > [/quote]
> >
> > I realize I am getting PHP errors, so at this point I don't know if
> > this is a TCL problem with the way I'm creating $php, or a PHP problem
> > with the way TCL handles PHP.
>
> What happens if you cut and paste that exact data into a file and
> execute it via php? And by "exact" I mean *exact*, minus the leading and
> trailing {} (assuming you're using {} when assigning the php script to
> the php variable).
>
> >>
> >>Are you aware that single quotes are not a valid quoting mechanism for
> >>Tcl? Any time you try to use single quotes to quote something in Tcl
> >>you're bound to be disappointed.
> >
> >
> > Yes, but I was assuming that I needed to encase $php in single quotes
> > not for TCL exec but for the shell statement that is served by TCL
> > exec, if that makes sense.
>
> Tcl's exec doesn't have anything to do with a "shell statement". In the
> way you are using it you aren't executing a shell, not even magically
> under the covers. You're executing php directly. It is important you are
> aware of that fact.
Navigation:
[Reply to this message]
|