Connecting Tech Pros Worldwide Forums | Help | Site Map

contents of var changing, seemingly without reason

lawrence
Guest
 
Posts: n/a
#1: Jul 17 '05
Please look at these few lines of code. You'll see that I keep echoing
out the variable $name. And each time, I'm getting the correct result.
But then, when it is used in an error statement, it is missing the
first letter. How can this be? Does anyone see a place where $name is
being changed? Below you can see the output.



// 04-26-04 - now we want just the name, without the parentheses.
$location1 = strpos($name, "(");
echo "here is the name: $name <br> ";
$location1 = $location1;
$name = substr($name, 0, $location1);
echo "here is the name: $name <br> ";
if (in_array($name, $allowedFunctions)) $allowed = true;


if ($allowed) {
echo "here is the name: $name <br> ";
$this->import($name, " in checkTemplateForAllowedFunctions(), in
the class McControllerForAll.");
echo "here is the name: $name <br> ";
} else {
echo "here is the name: $name <br> ";
echo "Sorry, but we did not recognize the name of a PHP function
in the template or arrangement we were asked to show. We were given
'$name', which we did not recognize as being in the official list.
These are the officially allowed PHP functions: ";
reset($allowedFunctions);
while (list($key, $val) = each($allowedFunctions)) {
echo "$val \n<br />";
}
die();
}


[color=blue][color=green][color=darkred]
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[/color][/color][/color]
Below is the output[color=blue][color=green][color=darkred]
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[/color][/color][/color]





here is the name: showNav2(4);
here is the name: showNav2
here is the name: showNav2
here is the name at the top of import(): showNav2 here is the name:
showNav2
Sorry, but we did not recognize the name of a PHP function in the
template or arrangement we were asked to show. We were given
'howNav2', which we did not recognize as being in the official list.
These are the officially allowed PHP functions:
McDatastoreConnectorMySql
McDatastoreForSessionInfoMySql
McDatastorePageInfoMySql
McDatastoreResultsMySql
McQueryObjectMySqlGetDefaultTemplateId
addBuiltInLinkToNavForm
bulkInputOfList
checkPassword

Garp
Guest
 
Posts: n/a
#2: Jul 17 '05

re: contents of var changing, seemingly without reason



"lawrence" <lkrubner@geocities.com> wrote in message
news:da7e68e8.0404271531.1131dd7b@posting.google.c om...[color=blue]
> Please look at these few lines of code. You'll see that I keep echoing
> out the variable $name. And each time, I'm getting the correct result.
> But then, when it is used in an error statement, it is missing the
> first letter. How can this be? Does anyone see a place where $name is
> being changed? Below you can see the output.[/color]

<snip>

Weird - it works for me. If you snipped this code out and did it standalone,
does it still fail on your machine? Here's what I used (the concatenation in
the final echo is for ease of reading, it works regardless whether it's all
on one line or this way):

<?php
$name="showNav2(4)";
$location1 = strpos($name, "(");
echo "here is the name: $name <br> ";
$location1 = $location1;
$name = substr($name, 0, $location1);
echo "here is the name: $name <br> ";

echo "here is the name: $name <br> ";
echo "Sorry, but we did not recognize the name of a PHP function ".
"in the template or arrangement we were asked to show. We were given ".
"'$name', which we did not recognize as being in the official list. ".
"These are the officially allowed PHP functions: ";[color=blue]
>?[/color]

Garp


Closed Thread