Home » Database » DB_DataObject » Bug #3708
oldcontent variable is not emptied
Details
| Submitted | 2005-03-05 02:22 UTC |
|---|---|
| From | tdr at cs dot byu dot edu |
| Assigned | alan_k |
| Status | Closed |
| Package | DB_DataObject |
| PHP Version | 4.3.9 |
| OS | Gentoo |
| Roadmaps | (Not assigned) |
Comments
[2005-03-05 02:22 UTC] tdr at cs dot byu dot edu
Description:
------------
When creating an extra table to an already existing database, DB_DataObject, in creating a file, uses data from a previous file.
Meaning, say I have Sprint and Stores as my tables. I create a new table called Sprint_data. In Sprint, I have added 2 getter functions of my own. When I run maketables, I discover that Sprint_data now has these 2 getter functions as well as comments above the class definition saying that this file is for DataObject_Sprint (And the file is DataObject_Sprint_data). The problem is that var $oldcontents is not cleared when generating classes, so, it can have bad data. This happens when one of the previous files exist, but a latter file has to be created.
Reproduce code:
---------------
A patch would be to set $oldcontents to empty when the file does not exist.
if (file_exists($outfilename)) {
// file_get_contents???
$oldcontents=implode('',file($outfilename));
} else {
$oldcontents = '';
}
[2005-03-05 02:25 UTC] tdr at cs dot byu dot edu
The patch would go in the file Generator.php in the function generateClasses() at line 488.