homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

PHP fails without error

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

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)

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)

one question:

* is output buffering on or off?



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

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)

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)

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)

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.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved