Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

PHP fails without error



2:36 am on May 4, 2006 (gmt 0)

10+ Year Member

I have been trying to do the following (in more complex code but it fails without an error and does not output anything. The last error in the apache error file was "Invalid URI in request GET HTTP/1.1". I am running "PHP Version 5.0.4".

Can anyone see anything wrong with this code?

If I remove the "$test -> control -> dump();" line, everything works.


//could be written in a shorter way, but lets be obvious.

class Control{
public $key = null;
public function dump(){
class Form {
public $control = null;
function __set($a, $b){
$b->key = $a;
$this->control = $b;

$test = new Form();
$key = '123';
$test->$key = new Control();
$test -> control -> dump();
echo 'completed';


5:57 am on May 4, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

I am still struggling to know the inside out of classes but from from my assesment your Control function has got C in caps. I hope classes too are case sensitive ;)



7:03 am on May 4, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

one question:

* is output buffering on or off?



10:24 am on May 4, 2006 (gmt 0)

10+ Year Member

No sign of output buffering... so no.
and the server now seems to give me a:

Server Error
The following error occurred:

[code=SERVER_RESPONSE_CLOSE] The server closed the connection while reading the response. Contact your system administrator.
Please contact the administrator.

error when I have the:
$test -> control -> dump();
line in, but works fine when
//$test -> control -> dump();
is commented out.


10:35 am on May 4, 2006 (gmt 0)

10+ Year Member

Well I have made progress and now I am only left with the question... WHY?

In the end it was only one character that needed adding to make it work.

If I change the line:

$b->key = $a;

To be:

$b->key =& $a;

It all works.

Just an


So can any one say WHY?


1:33 pm on May 4, 2006 (gmt 0)

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

Habtom, classes can have uppercase and lowercase letters and can begin with uppercase without any issues. Basically, class names follow the same rules as other labels in PHP. A valid class name starts with a letter or underscore, followed by any number of letters, numbers, or underscores. One thing to be cautious of though is using names that start with double underscores. That, and more cautions, can be read here:

thing3b, perhaps you can gain an understanding from the example in the PHP manual regarding References inside the constructor [php.net] as well as References Explained [php.net].


10:00 pm on May 4, 2006 (gmt 0)

10+ Year Member

Someone pointed out that my original code does work like it should on Windows running PHP 5.0.4. I checked this and it works on Windows XP with PHP 5.0.5 as well.

I know what the & should do, but this issue is not a coding error, but a bug in the way PHP 5.0.4 is set up on my linux server. I am not sure if the bug is in PHP its self or one of the zend php extentions things.


Featured Threads

Hot Threads This Week

Hot Threads This Month