There is an error. core/dispatch.php line 37 PHP unserialized


#1

[quote=Exception Handle]

There is an error. Please report the message (Piwik 2.2.2) and full backtrace in the Piwik forums (please do a Search first as it might have been reported already!).

Notice: Array to string conversion in /<HOSTING_ROOT_STRING>/core/dispatch.php on line 37 

Backtrace -->

#0 Piwik\Error::errorHandler(...) called at [/<HOSTING_ROOT_STRING>/core/dispatch.php:37]
#1 require_once(...) called at [/<HOSTING_ROOT_STRING>/index.php:47]

Array[/quote]

This happens when I try to return PHP data unserialized using the following URI query:

/index.php?module=API&method=API.get&format=PHP&idSite=18&period=day&date=2014-05-02,2014-05-10&expanded=1&token_auth=<AUTH_TOKEN_STRING>&serialize=0

#2

Did I miss the edit post button?

Anyway, I forgot to mention, that Array, that shows, is actually an empty array. So no data is being returned.

@Matt, if you need that actual link, I can provide that via PM. Let me know.

Thanks for all your hard work! v2 looks great!

-Sven2157


(Matthieu Aubry) #3

@Sven2157 actually it is not really supported to request “unserialized php data” from the web API. In this case, set serialize=1

The only way to request unserialized data is to use this technique: Querying the Reporting API: Integrate - Matomo Analytics (formerly Piwik Analytics) - Developer Docs - v3 => then you get the direct PHP data structures back.


#4

Yes the above URL had serialize=1 ( though it says serialize=0, as there is no edit post button ). I get that error, when trying to use the serialize=1. Here is the exact query:

/index.php?module=API&method=API.get&format=PHP&idSite=18&period=day&date=2014-05-02,2014-05-10&expanded=1&token_auth=<AUTH_TOKEN_STRING>&serialize=1

Which returns the error.


(Matthieu Aubry) #5

It looks OK on the demo: http://demo.piwik.org/index.php?module=API&method=API.get&format=PHP&idSite=3&period=day&date=2014-05-02,2014-05-10&expanded=1&serialize=1

are you using 2.2.2 ? Could you reproduce on the demo?


#6

Set at both 0 and 1, I don’t get the error. Here is the exact link of my error( the token auth is of a read only account ): PHP Serialized = 0


#7

Argh! I forgot to finish my thought. In the demo &serialized=1 return the serialized data, &serialized=0 returns ‘Array’; as it should.


#8

Could you please edit that post, and remove that full URL. These forums are quite maddening. I thought That I could post a link like you did, then remove it. But I forgot that YOU CAN’T EDIT posts here. Thanks.


(Matthieu Aubry) #9

I’ve edited your post. I will check and make sure to add the button “Edit”. Didn’t notice it wasn’t there.

Btw what else is maddening with the forums here? we’re trying to make them better so your feedback is welcome :slight_smile:

are you using 2.2.2?


#10

I am using v2.2.2. I use the Auto-update button when ever it lights up.

As for the forums, when I try to post a link, I get the standard enter address, then link title, but when I post, it is a full url, with no clickable link. I guess it that is how it is going to post, there should not be a link button. Then the edit post thing. :wink:

Your forums are great otherwise!

Did you try the link I was trying to post? That should have shown the error.


(Matthieu Aubry) #11

That should be fixed in: Calling API with serialize=0, get: Array to string conversion in core/dispatch.php on line 37 · Issue #5144 · matomo-org/matomo · GitHub

does it work for you?


#12

This is a link: Best Analytics on the Web! Let’s see if that says “Best Analytics on the Web!” with a link to http://piwik.org:wink:


#13

I posted a link several hours ago, and it said that it was waiting for Administration approval. :S


(Matthieu Aubry) #14

Yes when posts have 2+ links, it goes to moderation automatically