[sork] FW: Blank Page Returned By passwd - some (possible) solutions

Deryk Piper deryk at mod-soft.com
Fri Nov 5 11:39:37 PST 2004


Like some others, I was getting a blank screen with the passwd module
after attempting to change passwords.  I had searched high and low and
couldn't find a solution to this problem, although I did find a post to
this list by Peter Maag about a month or two ago.

Both Peter and I were finally able to resolve our respective issues,
although our two solutions took two different forms.

I'd like to mention here that I'm not a PHP programmer, and anything
that I've learned of the language has been solely through examining
Horde code.

In my case, I was able to determine that the factory() function in
/passwd/lib/Driver.php was choking when it tried to instantiate the
Password_Driver_$driver class:

@include_once dirname(__FILE__) . '/Driver/' . $driver . '.php';

Since I had no problem getting Vacation and Forwards to work, I noted
that for those modules the factory() function called include_once() a
little differently; specifically, without the @ that the Passwd function
used.
For me, replacing @include_once() with include_once() solved the
problem.

Peter's problem was a little different.  He was able to determine that
the Password_Driver_$driver class constructor was failing on this line:

$defaults = Horde::getDriverConfig('', 'sql');

For him, removing that line (and ensuring that all necessary $params
array objects were specified) solved his problem.

I don't know if anybody may find this useful - it's disconcerting that
each of us had two non-interchangeable solutions to the same problem -
but it may assist in troubleshooting for those who've given up.

I've forwarded the contents of my email exchange with Peter for any that
are interested.

DP


-----Forwarded Message-----
Subject: Re: [sork] Blank Page Returned By passwd


Deryk,

Ok, got everything working.  This was the call that was causing the
errors:
$defaults = Horde::getDriverConfig('', 'sql');

Havn't had the chance to figure out why yet, but commenting that line
out and hard coding the config into the constructor did the trick.

Thanks for the help!

Peter




On Sun, 31 Oct 2004 09:31:14 -0600, Peter Maag wrote:

Deryk,

I am using the vpopmail driver, and these are the last lines of the
constructor that actually run.

/* Use defaults from Horde */
$defaults = Horde::getDriverConfig('', 'sql');
$this->_params['hostspec']   = array_key_exists('hostspec', $params)
? $params['hostspec'] : $defaults['hostspec'];

$this->_params['protocol']   = array_key_exists('protocol', $params)
? $params['protocol'] : $defaults['protocol'];

$this->_params['username']   = array_key_exists('username', $params)
? $params['username'] : $defaults['username'];

$this->_params['password']   = array_key_exists('password', $params)
? $params['password'] : $defaults['password'];

$this->_params['database']   = array_key_exists('database', $params)
? $params['database'] : $defaults['database'];

The params array is passed just fine with the values from the config
file.  I think I will just hack the driver file to use hardcoded
values until I narrow everything down.

As always a second set of eyes is helpful.

Thanks!

Peter




On Sun, 31 Oct 2004 10:33:03 -0500, Deryk Piper  wrote:

What driver are you using?  And can you determine what statement is
failing in
the constructor?  I'll take a look as well a little later.


DP




Quoting Peter Maag :

Deryk,

Right, I am just print_fing the last statement out, and then following
that with a die().  Usually works pretty well but a lot of the time we
get the usual blank page return.

No worries on the code for your template I will just keep on messing
with this one until I get everything sorted out.  I have a feeling I
will get this working with a little more digging.

I will let you know what I find out.

Peter




On Sun, 31 Oct 2004 10:05:55 -0500, Deryk Piper wrote:

Peter,

I'm actually using a custom driver since my mailer is unsupported (using
sqlite3
for the user database) and I'm running on win32. I used the sql driver
as a
template.

I don't have access to the code right now (just woke up!) but I'll send
that to
you shortly. It basically loads the passed-in $params values to the
local
$this->_params array, just as the sql driver does.

If you're using printf()'s like I was, it's also helpful to follow that
statement with a return false so that you exit before php hangs up
(setting a
Pear or Horde error message is also a good idea, and can be done in
place of
the printf). This would allow you to pinpoint the exact statement that's
failing in the constructor.


DP




Quoting Peter Maag :

Deryk,
Thanks for getting me addicted to solving this problem :-)

I tried removing the '@' before the include_once line and did not have
any success.  I spent some time narrowing down exactly where things
are failing, and it looks like it is the constructor of the actual
driver class.

Which driver class are you using?

Thanks again, back to looking at code!!

Peter




On Sat, 30 Oct 2004 20:29:25 -0400, Deryk Piper  wrote:

Thanks for the quick reply Peter!

(please bear with me - I'm not a PHP programmer)

Well after spending another few hours on it today, I determined (through
the use of a few well-placed printf() calls :) that the factory()
function in /passwd/lib/Driver.php was failing at the point that it
loaded
the /passwd/lib/driver/$driver.php file.  The factory() function is
responsbile for instantiating a new class Passwd_Driver_$driver.

I looked at the driver.php files from Vacation and Forwards (both of
which work
correctly) and noticed their factory() functions both call include_once
to load
the $driver.php file, while the Passwd factory() function calls
@include_once.

Again, without knowing much PHP, I thought it best to remove the @ in
the name
of consistency.

Once I did that it started working.  My Passwd factory() function now
looks like this:

    function &factory($driver, $params = array())
    {
        $driver = strtolower(basename($driver));
        include_once dirname(__FILE__) . '/Driver/' . $driver . '.php';
        $class = 'Passwd_Driver_' . $driver;
        if (class_exists($class)) {
            return new $class($params);
        } else {
            return false;
        }
    }

Hopefully this "fix" works for you as well.

I'm running PHP 4.3.9 (previously 4.3.5) on Win32.

DP




Quoting Peter Maag :

Deryk,

Nope, never got a response here and got a little frustrated
trying to figure out exactly what was going on, so I gave up.

Please keep us updated if you ever find a solution to this problem, I
will try and check back from time to time and try again.

Peter




On Sat, 30 Oct 2004 04:27:03 -0400, Deryk Piper  wrote:

Hi Peter,

Came across your post on the sork mailing list regarding the
blank page when using the Horde Password module.

I can't say that I know to fix your problem, but having
experienced the same problem myself I'm wondering if you ever figured
out what the problem was. I've spent the last 2-3 hours trying to
figure it out to no avail.

Would really appreciate your insights!

TIA,

DP





More information about the sork mailing list