php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26740 Object Attribute Unexpectly Overwritten
Submitted: 2003-12-29 08:43 UTC Modified: 2003-12-29 09:05 UTC
From: leo at myleo dot info Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.0.0b2 (beta2) OS: Linux
Private report: No CVE-ID: None
 [2003-12-29 08:43 UTC] leo at myleo dot info
Description:
------------
In the source code, $this->filepath is overwritten unexpectly in the assignment 
$this->$tempFilepath=$this->$filepath.".tmp";

Reproduce code:
---------------
class Zone{

        var $path; // The path to store zone files
        var $filepath; // The zone file with absolute filepath
        var $tempFilepath; // Temporary file
        var $domain; // Domain object

        function Zone($domainTemp,$pathTemp){
                if(preg_match("/^\//",$pathTemp)){
                        $this->$path=$pathTemp;
                        $this->$domain=new Domain($domainTemp.".");
                        $this->$filepath=$pathTemp."/".$domainTemp.".zone";
                        print $this->$filepath;
                        $this->$tempFilepath=$this->$filepath.".tmp";
                        print $this->$filepath;
...
...

Expected result:
----------------
I create the object 
$zone=new Zone("mydomain.com","/var/named");

$this->$filepath should be /var/named.mydomain.com.zone
$this->$tempFilepath should be /var/named.mydomain.com.zone.tmp



Actual result:
--------------
both variable metioned above have the same value /var/named.mydomain.com.zone.tmp


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-12-29 09:05 UTC] derick@php.net
Bogus code, use $this->domain and not $this->$domain.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Aug 25 04:00:02 2025 UTC