Quantcast

[knop-project] Re: Session started and cookie set, but no vars added

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[knop-project] Re: Session started and cookie set, but no vars added

stevepiercy
Cross-posting from LassoTalk for the Knop list archive.  To see
the message in context:
http://lasso.2283332.n4.nabble.com/Session-started-and-cookie-set-but-no-vars-added-tt4643867.html


On 7/3/15 at 12:01 PM, [hidden email] (Steve Piercy -
Website Builder) pronounced:

>I still have a couple of other tests to try:
>* Take the $s_user object and attempt to serialize it in the page.

I found the problem.  It was actually not the knop_user type
itself, but how I defined the knop_database object, which is
used in knop_user.  (Thanks again for the sanity check, Jolle!)

Here's where I went sideways.  I tried a new connection method
for knop_database for this one website, and it completely
slipped my mind I had done so because everything else was
working.  My motivation was to use the faster -host connection
method in order to bypass Lasso Admin's database checking.

This code will return an error when knop_database is defined
using the unsupported method.

     var(db) = knop_database(
         -host=cnxn -> host -> asarray, // <- don't do this
         -database=cnxn -> database,
         -table=cnxn -> table,
         -maxrecords=$maxrecords,
         -keyfield='keyfield',
         )

     var(s_user) = knop_user(
         -userdb=$db,
         -userfield='username',
         -passwordfield='password',
         -encrypt=$encrypt_method,
         -saltfield='saltfield',
         -cost=false,
     )

     <textarea rows="80" cols="160">
     [$s_user -> serialize]
     </textarea>
=>
Error Code: -9945
Error Msg: The type keyword was not serializable

This will work when you have also provided a connection to the
database in Lasso Admin.

     var(db) = knop_database(
         -database=cnxn -> database,
         -table=cnxn -> table,
         -maxrecords=$maxrecords,
         -keyfield='keyfield',
         )

=>
Lots of serialized output.

(Thanks to Steffan and Kyle for the clues toward serialization
issues, and Maxwell Klein for pointing me to look in the Lasso
Admin sessions database.)

Furthermore, there is an issue in Knop for Lasso 9, which is
likely a carryover from the conversion from Lasso 8.  In the
knop_database type, its oncreate method has three signatures,
one of which is defined as follows.

     oncreate(-database::string, -table::string, -host::array
=?, -username::string =?, -password::string =?,
-keyfield::string =?, -lockfield::string =?, -user =?,
-validate::boolean =?)

-host::array is bad because it cannot be serialized up the
chain.  It should be -host::staticarray for Lasso 9.

>* Take the gist from before and "Knoppify" it.

FTR, this worked.

>* Dive in deep into knop_user and possibly further into
>knop_database to see whether the datasource, MySQL vs.
>FileMaker, has anything to do with it.  The working website
>uses FileMaker, but the busted one uses MySQL.

In the short term, I might convert the -host argument to a
staticarray type and see if that's possible.

My plan with long term Knop for Lasso 9 development (when I get
a spare moment, ha), is to decouple the knop_database type from
all other knop_* types, allowing the use of [ds] and any other
datasource, including session data, to improve performance.  Now
if only there were a generous client who would fund open source
development for doing this work...

--steve

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Steve Piercy              Website Builder              Soquel, CA
<[hidden email]>               <http://www.StevePiercy.com/>


#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>

--
You received this message because you are subscribed to the Google Groups "knop-project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/knop-project.
To view this discussion on the web visit https://groups.google.com/d/msgid/knop-project/r422Ps-1085i-F970C244D2304C2D89EA1D89857ECDA3%40ip30.192-168-0.rfc1918.steadfastdns.net.
For more options, visit https://groups.google.com/d/optout.
Loading...