Re: testing pear part one
| From: | Mika Tuupola | Date: | Fri, 09 Aug 2002 08:38:15 +0000 |
| Subject: | Re: testing pear part one | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-8264@lists.php.net to get a copy of this message | ||
On Sat, 1 Jun 2002, robert janeczek wrote:
Back from summer vacation, so answering to an old mail.
> > It looks like isLocked() has been added by Mika Tuupola in revision
> > 1.10, which apparently didn't make it's way into PHP 4.2.1 :(.
> >
> > Yup, it should be actually :). Please get the latest version of
> > File/Passwd.php from CVS and try again.
>
> file: i downloaded latest file/passwd.php from cvs [Passwd.php,v 1.10
> 2002/04/17 14:41:37] and there are some serious problems:
> Auth_Container_File::Auth_Container_File() constructs new file_passwd object
> with lock set to 0 (no lock file is created), then 'locked' variable is set
> from code, but it doesn`t work as it seems to - someone surely wanted to
> crate lock file, but only by setting variable he gets nothing except file
What line do you mean? I can see Auth_Container_File() doing the
lock in addUser() and removeUser() methods using
$this->pwfile->lock().
function lock() {
$this->fplock = fopen($this->lockfile, 'w');
flock($this->fplock, LOCK_EX);
$this->locked = true;
}
This creates the lockfile, locks it and set the locked property
to true. I dont see how this "only sets the variable"?
> access errors. line 65 should be changed to '$this->pwfile->lock();' - this
> CREATES file and locks it. constructors end lines changed to this:
> $this->pwfile->lock();//primary locking
> $this->pwfile->close();//this saves file and UNLOCKS!
> $this->pwfile->lock();//this lock is needed to operate properly on data
> (adding users etc)
I dont see the point on this. There is no reason to create and
lock the lockfile allways when the Auth_Container_File object
is constructed. It is only needed when users are added or deleted.
Most of the time you are calling fetchData() anyway.
> my point is that Auth/Container/file.php has many more places like this
> where lock isn`t being made where it is needed. code reanalyzing is needed -
addUser() and removeUser()?
Maybe I am totally missing something :)
--
Mika Tuupola http://www.appelsiini.net/~tuupola/