For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > March 2006 > LiveUser strange issue!









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author LiveUser strange issue!
Wright Zane A A1C 30 IS/DOMM

2006-03-24, 7:04 pm

Hey all,



I have been using LiveUser for over a year now and haven't had any
problems at all getting it configured and working properly. But ever
since we migrated it over to a new database (same software and
everything, just a new name 'UNICORN_Dev'). I cannot add users at all. I
should probably state that the database is MS SQL2000... The permissions
are set to the same as before for the user that accesses the database,
so I can't see that being the problem.



So when I go to add a new user, I do a print_r on the $lu_admin object
and it gives me this error about not being able to create the
liveuser_users_seq table (due to permissions). But what I don't
understand is why its even trying to ADD that table when I already have
an existing one? There was a previous error relating to that (table
already exists) but I finally removed the ability for it to add tables
to see what it would do.



So I'm totally stuck... does anybody out there have any clue why
LiveUser would be trying to add a new table when it already exists? It
is running into this problem when it runs the nextId function, if that
helps at all. Thanks for any help, this is the second day straight I've
been trying to fix this.. and I have NO clue what it could be. Thanks



Zane


Lukas Smith

2006-03-24, 7:04 pm

Wright Zane A A1C 30 IS/DOMM wrote:

> So I'm totally stuck... does anybody out there have any clue why
> LiveUser would be trying to add a new table when it already exists? It
> is running into this problem when it runs the nextId function, if that
> helps at all. Thanks for any help, this is the second day straight I've
> been trying to fix this.. and I have NO clue what it could be. Thanks


Uhm .. so you already have both a liveuser_users and liveuser_users_seq
table?

regards,
Lukas
Wright Zane A A1C 30 IS/DOMM

2006-03-24, 7:04 pm

Yes,

Just to make sure I copied over the original (working) database, with
the only modified code being the different dsn... and its still
happening.=20

-----Original Message-----
From: Lukas Smith [mailto:lsmith@php.net]=20
Sent: Friday, March 24, 2006 9:09 AM
To: Wright Zane A A1C 30 IS/DOMM
Cc: pear-general@lists.php.net
Subject: Re: LiveUser strange issue!

Wright Zane A A1C 30 IS/DOMM wrote:

> So I'm totally stuck... does anybody out there have any clue why
> LiveUser would be trying to add a new table when it already exists? It
> is running into this problem when it runs the nextId function, if that
> helps at all. Thanks for any help, this is the second day straight

I've
> been trying to fix this.. and I have NO clue what it could be. Thanks


Uhm .. so you already have both a liveuser_users and liveuser_users_seq=20
table?

regards,
Lukas
Lukas Smith

2006-03-24, 7:04 pm

Wright Zane A A1C 30 IS/DOMM wrote:
> Yes,
>
> Just to make sure I copied over the original (working) database, with
> the only modified code being the different dsn... and its still
> happening.


What was the name of the old database?

regards,
Lukas
Wright Zane A A1C 30 IS/DOMM

2006-03-24, 7:04 pm

The old database was 'work'. I have two new ones, UNICORN and
UNICORN_dev and neither works (thought maybe it was the '_')

-----Original Message-----
From: Lukas Smith [mailto:lsmith@php.net]=20
Sent: Friday, March 24, 2006 9:49 AM
To: Wright Zane A A1C 30 IS/DOMM
Cc: pear-general@lists.php.net
Subject: Re: LiveUser strange issue!

Wright Zane A A1C 30 IS/DOMM wrote:
> Yes,
>=20
> Just to make sure I copied over the original (working) database, with
> the only modified code being the different dsn... and its still
> happening.=20


What was the name of the old database?

regards,
Lukas
Lukas Smith

2006-03-24, 7:04 pm

Wright Zane A A1C 30 IS/DOMM wrote:
> The old database was 'work'. I have two new ones, UNICORN and
> UNICORN_dev and neither works (thought maybe it was the '_')


Ok what database driver are you using?
DB, MDB, MDB2, PDO?

regards,
Lukas
Wright Zane A A1C 30 IS/DOMM

2006-03-24, 7:04 pm

DB, with mssql. When I try to trace it back I get the 'changed database
context' error but when I looked at adding permissions (which works
fine) it also reports that as an error so I don't think that is part of
the problem.

(sorry, trying to keep it in the mailing list)

-----Original Message-----
From: Lukas Smith [mailto:lsmith@php.net]=20
Sent: Friday, March 24, 2006 9:52 AM
To: Wright Zane A A1C 30 IS/DOMM
Cc: pear-general@lists.php.net
Subject: Re: LiveUser strange issue!

Wright Zane A A1C 30 IS/DOMM wrote:
> The old database was 'work'. I have two new ones, UNICORN and
> UNICORN_dev and neither works (thought maybe it was the '_')


Ok what database driver are you using?
DB, MDB, MDB2, PDO?

regards,
Lukas
Lukas Smith

2006-03-24, 7:04 pm

Wright Zane A A1C 30 IS/DOMM wrote:
> DB, with mssql. When I try to trace it back I get the 'changed database
> context' error but when I looked at adding permissions (which works
> fine) it also reports that as an error so I don't think that is part of
> the problem.


Well could you try to run a script like the following:

$db =& DB::connect($dsn, $options);
var_dump($db->nextID('liveuser_users');

And maybe try to trace exactly what is going on inside the nextID() method.

BTW: nothing else changed in the environment? Same servers, php version etc?

regards,
Lukas
Wright Zane A A1C 30 IS/DOMM

2006-03-24, 7:04 pm

While I work on tracing... the only difference is an upgrade to php 5
from 4.3/4.4 (this db is installed on two different working servers with
different versions). I can't really get to the PEAR versions of DB but I
looked through the release notes to make sure there weren't any crazy
changes.=20

-----Original Message-----
From: Lukas Smith [mailto:lsmith@php.net]=20
Sent: Friday, March 24, 2006 9:57 AM
To: Wright Zane A A1C 30 IS/DOMM
Cc: pear-general@lists.php.net
Subject: Re: LiveUser strange issue!

Wright Zane A A1C 30 IS/DOMM wrote:
> DB, with mssql. When I try to trace it back I get the 'changed

database
> context' error but when I looked at adding permissions (which works
> fine) it also reports that as an error so I don't think that is part

of
> the problem.


Well could you try to run a script like the following:

$db =3D& DB::connect($dsn, $options);
var_dump($db->nextID('liveuser_users');

And maybe try to trace exactly what is going on inside the nextID()
method.

BTW: nothing else changed in the environment? Same servers, php version
etc?

regards,
Lukas
Lukas Smith

2006-03-24, 7:04 pm

Wright Zane A A1C 30 IS/DOMM wrote:
> While I work on tracing... the only difference is an upgrade to php 5
> from 4.3/4.4 (this db is installed on two different working servers with
> different versions). I can't really get to the PEAR versions of DB but I
> looked through the release notes to make sure there weren't any crazy
> changes.


Well that opens up a lot of possible causes. I do not use MSSQL myself
so I cant immediatly think of reasons.

regards,
Lukas
Wright Zane A A1C 30 IS/DOMM

2006-03-24, 7:04 pm

Ok,

In PEAR/DB/mssql.php line 530 it returns an error to the $result, which
says...

INSERT INTO liveuser_users_seq (vapor) values (0) [nativecode=3D0 -
changed database context to UNICORN]

At that point it executes the popErrorHandling() which I don't know what
the crap that is... then from there it executes the createSequence()
function which starts the creation of the table, which returns the real
error.=20

Any ideas?

-----Original Message-----
From: Lukas Smith [mailto:lsmith@php.net]=20
Sent: Friday, March 24, 2006 10:05 AM
To: Wright Zane A A1C 30 IS/DOMM
Cc: pear-general@lists.php.net
Subject: Re: LiveUser strange issue!

Wright Zane A A1C 30 IS/DOMM wrote:
> While I work on tracing... the only difference is an upgrade to php 5
> from 4.3/4.4 (this db is installed on two different working servers

with
> different versions). I can't really get to the PEAR versions of DB but

I
> looked through the release notes to make sure there weren't any crazy
> changes.=20


Well that opens up a lot of possible causes. I do not use MSSQL myself=20
so I cant immediatly think of reasons.

regards,
Lukas
Lukas Smith

2006-03-24, 7:04 pm

Wright Zane A A1C 30 IS/DOMM wrote:
> Ok,
>
> In PEAR/DB/mssql.php line 530 it returns an error to the $result, which
> says...
>
> INSERT INTO liveuser_users_seq (vapor) values (0) [nativecode=0 -
> changed database context to UNICORN]


so what is that error about?
this is the problem .. why cant it do the insert?

> At that point it executes the popErrorHandling() which I don't know what
> the crap that is... then from there it executes the createSequence()
> function which starts the creation of the table, which returns the real
> error.


pushErrorHandling()/popErrorHandling() just handle the supression of
errors .. the code there is badly written .. it should really just only
supress errors that map to the error code DB_ERROR_NOSUCHTABLE

however that is not the cause if your issue .. the cause if your issue
is that the initial insert fails eventhough you say the table exists and
is accessable ..

what if you just write a script like:

$db =& DB($dsn, $options);
var_dump($db->query('INSERT INTO liveuser_users_seq (vapor) values (0)'));

regards,
Lukas
Wright Zane A A1C 30 IS/DOMM

2006-03-24, 7:04 pm

Ok here ya go,

I ran that, and it added the value to the table, but still reported that
as an error. I think its honestly more a Notice than anything when I
look at it elsewhere, like under Microsofts KnowledgeBase it shows that
message popping up when you do a 'use' command to set the database
(don't know why it needs to do that...) but it worked, just reported it
as an error.=20

Is there any way I can suppress this msg?

One of the other weird things is that when I add a new right it shows
the same error when I dig into it, but it still follows through and the
error doesn't really surface to the top to stop everything.=20

-----Original Message-----
From: Lukas Smith [mailto:lsmith@php.net]=20
Sent: Friday, March 24, 2006 10:20 AM
To: Wright Zane A A1C 30 IS/DOMM
Cc: pear-general@lists.php.net
Subject: Re: LiveUser strange issue!

Wright Zane A A1C 30 IS/DOMM wrote:
> Ok,
>=20
> In PEAR/DB/mssql.php line 530 it returns an error to the $result,

which
> says...
>=20
> INSERT INTO liveuser_users_seq (vapor) values (0) [nativecode=3D0 -
> changed database context to UNICORN]


so what is that error about?
this is the problem .. why cant it do the insert?

> At that point it executes the popErrorHandling() which I don't know

what
> the crap that is... then from there it executes the createSequence()
> function which starts the creation of the table, which returns the

real
> error.=20


pushErrorHandling()/popErrorHandling() just handle the supression of=20
errors .. the code there is badly written .. it should really just only=20
supress errors that map to the error code DB_ERROR_NOSUCHTABLE

however that is not the cause if your issue .. the cause if your issue=20
is that the initial insert fails eventhough you say the table exists and

is accessable ..

what if you just write a script like:

$db =3D& DB($dsn, $options);
var_dump($db->query('INSERT INTO liveuser_users_seq (vapor) values
(0)'));

regards,
Lukas
Lukas Smith

2006-03-24, 7:04 pm

Wright Zane A A1C 30 IS/DOMM wrote:
> Ok here ya go,
>
> I ran that, and it added the value to the table, but still reported that
> as an error. I think its honestly more a Notice than anything when I
> look at it elsewhere, like under Microsofts KnowledgeBase it shows that
> message popping up when you do a 'use' command to set the database
> (don't know why it needs to do that...) but it worked, just reported it
> as an error.
>
> Is there any way I can suppress this msg?
>
> One of the other weird things is that when I add a new right it shows
> the same error when I dig into it, but it still follows through and the
> error doesn't really surface to the top to stop everything.


Well personally I am guessing that this behaviour is likely a database
setting which you did not have set in the old database. Alternatively it
could be a change in the extension. However these "false error reports"
will surely screw up PEAR::DB ..

regards,
Lukas
Wright Zane A A1C 30 IS/DOMM

2006-03-24, 7:04 pm

I agree, but on this new database I don't really have access to get to
look and compare. I'll see if I can find some work around or look
through logs or something... I'll let ya'll know if I come up with
anything. Thanks for the help.

Zane

-----Original Message-----
From: Lukas Smith [mailto:lsmith@php.net]=20
Sent: Friday, March 24, 2006 10:27 AM
To: Wright Zane A A1C 30 IS/DOMM
Cc: pear-general@lists.php.net
Subject: Re: LiveUser strange issue!

Wright Zane A A1C 30 IS/DOMM wrote:
> Ok here ya go,
>=20
> I ran that, and it added the value to the table, but still reported

that
> as an error. I think its honestly more a Notice than anything when I
> look at it elsewhere, like under Microsofts KnowledgeBase it shows

that
> message popping up when you do a 'use' command to set the database
> (don't know why it needs to do that...) but it worked, just reported

it
> as an error.=20
>=20
> Is there any way I can suppress this msg?
>=20
> One of the other weird things is that when I add a new right it shows
> the same error when I dig into it, but it still follows through and

the
> error doesn't really surface to the top to stop everything.=20


Well personally I am guessing that this behaviour is likely a database=20
setting which you did not have set in the old database. Alternatively it

could be a change in the extension. However these "false error reports"=20
will surely screw up PEAR::DB ..

regards,
Lukas
Wright Zane A A1C 30 IS/DOMM

2006-03-24, 7:04 pm

Ok I found a little more info, when MSSQL returns these 'notices' it
sends them as a nativecode of 0. Is there any nice and clean way to
ignore any 'error' codes of 0?=20

-----Original Message-----
From: Lukas Smith [mailto:lsmith@php.net]=20
Sent: Friday, March 24, 2006 10:27 AM
To: Wright Zane A A1C 30 IS/DOMM
Cc: pear-general@lists.php.net
Subject: Re: LiveUser strange issue!

Wright Zane A A1C 30 IS/DOMM wrote:
> Ok here ya go,
>=20
> I ran that, and it added the value to the table, but still reported

that
> as an error. I think its honestly more a Notice than anything when I
> look at it elsewhere, like under Microsofts KnowledgeBase it shows

that
> message popping up when you do a 'use' command to set the database
> (don't know why it needs to do that...) but it worked, just reported

it
> as an error.=20
>=20
> Is there any way I can suppress this msg?
>=20
> One of the other weird things is that when I add a new right it shows
> the same error when I dig into it, but it still follows through and

the
> error doesn't really surface to the top to stop everything.=20


Well personally I am guessing that this behaviour is likely a database=20
setting which you did not have set in the old database. Alternatively it

could be a change in the extension. However these "false error reports"=20
will surely screw up PEAR::DB ..

regards,
Lukas
Lukas Smith

2006-03-24, 7:04 pm

Wright Zane A A1C 30 IS/DOMM wrote:
> Ok I found a little more info, when MSSQL returns these 'notices' it
> sends them as a nativecode of 0. Is there any nice and clean way to
> ignore any 'error' codes of 0?


No not really .. the problem seems to be that in the following line
$result ends up false:
$result = @mssql_query($query, $this->connection);

at this point the error routines kick in and it will be handled as an
error and you will get an error object returned. now for your specific
issue you could add an item to the $errorcode_map property

0 => DB_OK,

this would prevent the createSequence() call but it would still return a
result object which would probably have the LiveUser error handling kick
in ..

regards,
Lukas
Wright Zane A A1C 30 IS/DOMM

2006-03-24, 7:04 pm

Alrighty,

I can't find any 'proper' solution to the problem, although I've seen it
pop up a few times in php's buglist. So it HAS happened before at
least... so I'm not totally crazy! Ok, but the solution I found (seems
to work out pretty good so far, and SHOULDN'T affect any other errors)
is in the mssqlRaiseError() function around line 627... I just wrapped
the return statement in:

if(strops($message, 'Changed database context')) {
return $this->raiseError($this->errorCode($code, $message),
null, null, null, "$code - $message");
}

Let me know if you think this would be worth submitting for anything? Or
is it just a horrible hack that I'll have to add after every upgrade?
Thanks for all the help though...=20

Zane

-----Original Message-----
From: Lukas Smith [mailto:lsmith@php.net]=20
Sent: Friday, March 24, 2006 10:41 AM
To: Wright Zane A A1C 30 IS/DOMM
Cc: pear-general@lists.php.net
Subject: Re: LiveUser strange issue!

Wright Zane A A1C 30 IS/DOMM wrote:
> Ok I found a little more info, when MSSQL returns these 'notices' it
> sends them as a nativecode of 0. Is there any nice and clean way to
> ignore any 'error' codes of 0?=20


No not really .. the problem seems to be that in the following line=20
$result ends up false:
$result =3D @mssql_query($query, $this->connection);

at this point the error routines kick in and it will be handled as an=20
error and you will get an error object returned. now for your specific=20
issue you could add an item to the $errorcode_map property

0 =3D> DB_OK,

this would prevent the createSequence() call but it would still return a

result object which would probably have the LiveUser error handling kick

in ..

regards,
Lukas
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com