Jay B Sun Feb 13 09:01:34 -0500 2011

Subject: Error thrown when following "Quick start guide"

Hi everyone,

Just downloaded php.activerecord from github and installed into my development PHP sandbox. Unfortunately when trying the code out, it doesnt't work as supposed, well the DB query is executed and stored to database, but errors are shown.
Here's my code:

require_once 'kla-php-activerecord-c389172/ActiveRecord.php';

ActiveRecord\Config::initialize(function($cfg) {
'development' => 'mysql://root:/dbtable?charset=utf8'));

$session = Session::create( array('id' => 'gos81vu0ss9tl8tui959knrdo5', 'expire' => (time() + 3600), 'session_data' => serialize(array('bla','bla','bla')) ) );


Errors shown:
- Notice: Undefined offset: 0 in /var/www/sandbox/kla-php-activerecord-c389172/lib/Model.php on line 573
- Notice: Trying to get property of non-object in /var/www/sandbox/kla-php-activerecord-c389172/lib/Model.php on line 823

I guess that my code, as following the example of yours isn't causing this?

Kien La Sun Feb 13 14:25:22 -0500 2011

Could you show the full stack trace?

Jay B Sun Feb 13 14:54:45 -0500 2011

Hi Kien,

Thanks for looking into this.

Here's an image showing the Stack trace from XDEBUG:

Please note that I have also tried the alternative format to make the insert:
$session = new Session;
$session->id = 'gos81vu0ss9tl8tui959knrdo6';
$session->expire = date("Y-m-d H:i:s", time());
$session->session_data = serialize( array('bla','bla','bla') );

Same errors are shown. PHP version 5.3.3-1ubuntu9.3 running on Ubuntu 10.10 with mySQL 5.1.49-1ubuntu8.1. PHP install is out of the box except for XDEBUG.

I downloaded the tarball from Github - name kla-php-activerecord-1.0-101-gc389172.tar.gz which in this error occurs. I thought that that was the stable one, but after downloading the one that's linked from this site, It appears to work, without errors that is.