php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22397 $this->$varname = $value
Submitted: 2003-02-24 11:35 UTC Modified: 2003-02-24 12:08 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: powerblade at mail dot dk Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5CVS-2003-02-24 (dev) OS: Redhat Linux 7.0
Private report: No CVE-ID: None
 [2003-02-24 11:35 UTC] powerblade at mail dot dk
<?php

class Database 
{
    var $s_dbServer;

    function changeVarValue($s_varname, $s_value) 
    {
    	$this->$s_varname = $s_value;
        return true;    	
    }
}

?>

The above example fails to load. In windows apache crashes.. In linux i get an error.

"$this->$s_varname = $s_value;"
that is what makes it crash. Probably because of $s_varname
changing it $this->s_dbServer makes it work. But using the variable $s_varname = dead server. 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-02-24 11:58 UTC] moriyoshi@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. Because of this, we hope you add your comments
to the existing bug instead.

Thank you for your interest in PHP.

duplicate of bug #22237

 [2003-02-24 12:05 UTC] powerblade at mail dot dk
Im sorry. I did take a look on the other bug reports before submitting it, and i couldn't find similar anywhere. The auto search function (after posting it) didn't find it either.

I searched for the word "object" and php version "5". 22 results.. But the above one was not shown.
 [2003-02-24 12:08 UTC] moriyoshi@php.net
Don't worry :) This kind of entry is generally hard to find..

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 14 14:01:31 2025 UTC