With regards to Ticket #1943 (closed Bug: invalid)
It says the issue is closed but I am able to re-produce the error with regards to:
Fatal error: Call to undefined function safe_unserialize() in D:\WEBSITES\piwik\core\Cookie.php on line 239
When I run in PHP, code to run new Piwik_API_Request("..etc..");
the code runs fine.
The error ONLY occurs when I am concurrently logged into the super-admin dashboard.. (e.g, try log into super-admin dashboard, and run a php new Piwik_API_Request() .. and it probably hit that error when I was trying to json_decode the requested results.
Again if i log out of the admin dashboard, the error goes away when I run the php file again.
Apologies if this is not a real bug, but just to help out in pointing errors I find. Thanks!
Piwik Version: 1.2.5 - rc6
Php version: 5.2.13
Yes, you have to include upgrade.php. In the absence of any formal documentation, the source is the documented method.
If you got an error, then you probably weren't following the example in misc/api_internal_call.php (which includes Piwik's index.php, and in turn, testMinimumVersion, and upgradephp).
(In ) update comments in example; refactor file_get_contents, so compat functions are in one place; fixes #2292