contents of var changing, seemingly without reason

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • lawrence

    #1

    contents of var changing, seemingly without reason

    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 , $allowedFunctio ns)) $allowed = true;


    if ($allowed) {
    echo "here is the name: $name <br> ";
    $this->import($name , " in checkTemplateFo rAllowedFunctio ns(), in
    the class McControllerFor All.");
    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($allowedF unctions);
    while (list($key, $val) = each($allowedFu nctions)) {
    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:
    McDatastoreConn ectorMySql
    McDatastoreForS essionInfoMySql
    McDatastorePage InfoMySql
    McDatastoreResu ltsMySql
    McQueryObjectMy SqlGetDefaultTe mplateId
    addBuiltInLinkT oNavForm
    bulkInputOfList
    checkPassword
  • Garp

    #2
    Re: contents of var changing, seemingly without reason


    "lawrence" <lkrubner@geoci ties.com> wrote in message
    news:da7e68e8.0 404271531.1131d d7b@posting.goo gle.com...[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


    Comment

    Working...