[PHP-DEV] Bug #10838: wierd problem concatenating global string vars From: gearond <email protected>
Date: 05/13/01

From: gearond <email protected>
Operating system: linux
PHP version: 4.0.5
PHP Bug Type: Unknown/Other Function
Bug description: wierd problem concatenating global string vars

<the version is two back, but I would
be hesitant to ask my ISP to change
to 4.0.5 after all the little problems
I read about. Can you tell me if the following
is fixed in versions > 4.0.3pl1 ?

If I do echo($HTTP_SERVER_VARS["SERVER_ADDR"])
I get the expected server address ***WITHOUT A SLASH AT THE END***
eg. "my.server.address"
-------
If I do echo($PHP_SELF)
I get the expeted URL relative the the server ***WITH O-N-E SLASH** at
beginning.
eg. "/expected/url/relative/doc_name"

-------
If I do THIS:
  $this_page = "http://" . $HTTP_SERVER_VARS["SERVER_ADDR"] . $PHP_SELF;
  echo( $this_page );
I get, "http://my.server.address//expected/url/relative/doc_name"

There is **ALWAYS** a double slash between the server address and the
doc path,
if the concatenation of those two variables occurs in the same
statement.

It works when used as an action for a form, but I don't think it should
do unexpected
results.

-------
HOWEVER
If I do **THIS**:
  $this_page = "http://";
  $this_page .= $HTTP_SERVER_VARS["SERVER_ADDR"];
  $this_page .= $PHP_SELF;
I get the correct results,
"http://my.server.address/expected/url/relative/doc_name"

My provider is using PHP version 4.0.3pl1

-- 
Edit Bug report at: http://bugs.php.net/?id=10838&edit=1

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>