|
Posted by Bryan Oakley on 12/01/06 22:58
comp.lang.tcl wrote:
> Bryan Oakley wrote:
>
>>comp.lang.tcl wrote:
>>
>>>Bryan Oakley wrote:
>>>
>>>>Show us *precisely* what you type.
>>>
>>>
>>>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);
>>> ?>}
>>>
>>> global valPHPPath
>>> if {![info exists valPHPPath]} {
>>> if {![array exists env]} { global env }
>>> source cgi_globals.tcl
>>> global valPHPPath
>>> }
>>> set contentsList [exec $valPHPPath << $php]
>>>
>>>
>>>-----------
>>>There you go, exactly what I typed
>>>-----------
>>>
>>>This is the error I get:
>>>
>>>Status: 404 X-Powered-By: PHP/4.4.4 Content-type: text/html No input
>>>file specified. child process exited abnormally while executing "exec
>>>$valPHPPath -q << $php" (procedure "XML_GET_ALL_ELEMENT_ATTRS" line 37)
>>
>>Strip out all the Tcl. All of it. Every last byte. Put the php into a
>>file. Then, from a command line type "php /your/file.php"
>>
>>You will get the exact same error. The bug is in php, of which I know
>>nothing about. What I do know is that the problem isn't Tcl.
>
>
> No, sorry I get no error whatsoever, in fact, I get nothing.
You are correct. My bad. I was getting this, which is the same error
you were earlier reporting:
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in
/private/tmp/error.php on line 9
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in
/private/tmp/error.php on line 14
.... but that was because the php had two lines with extra backslashes,
that were in to escape the curly braces due to the fact it was defined
in Tcl. My mistake. When I took those out in the file-based version of
the php code, it all worked fine (and by that I mean, I get no php errors).
> It's not
> a PHP syntax or evaluation error, it's just that apparently it seems
> $argv does not exist because it was never set with any values,
That's likely also true. Unless you give it a filename as an argument
you won't have a argv[1].
> so
> putting it into a PHP file is ultimately meaningless because I can't
> get the XML contents into the PHP file even if it were separate.
The exercise of putting it in a file is just to illustrate that the php
has errors in it, it has nothing to do with Tcl. If you can create a
working block of php you can call from the command line, you can
certainly execute it from tcl using the "exec php << $php" trick.
The first trick, then, is to figure out the PHP problems. Then take the
working PHP and execute it via Tcl. No sense fighting two battles at once.
Navigation:
[Reply to this message]
|