Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Piwik 2.9.1 Array to string conversion in TrackerCodeGenerator.php #7273

Closed
mouyse opened this issue Feb 23, 2015 · 6 comments
Closed

Piwik 2.9.1 Array to string conversion in TrackerCodeGenerator.php #7273

mouyse opened this issue Feb 23, 2015 · 6 comments
Labels
Bug For errors / faults / flaws / inconsistencies etc. worksforme The issue cannot be reproduced and things work as intended.

Comments

@mouyse
Copy link

mouyse commented Feb 23, 2015

Reported at piwik forum also:
http://forum.piwik.org/read.php?2,124494

There is an error. Please report the message (Piwik 2.9.1) 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 /home/user/public_html/piwik/core/Tracker/TrackerCodeGenerator.php on line 137

Backtrace -->

#0 Piwik\Error::errorHandler(...) called at [:]
#1 str_replace(...) called at [/home/user/public_html/piwik/core/Tracker/TrackerCodeGenerator.php:137]
#2 Piwik\Tracker\TrackerCodeGenerator->generate(...) called at [/home/user/public_html/piwik/plugins/SitesManager/API.php:93]
#3 Piwik\Plugins\SitesManager\API->getJavascriptTag(...) called at [:]
#4 call_user_func_array(...) called at [/home/user/public_html/piwik/core/API/Proxy.php:211]
#5 Piwik\API\Proxy->call(...) called at [/home/user/public_html/piwik/core/API/Request.php:216]
#6 Piwik\API\Request->process(...) called at [/home /user/public_html/piwik/plugins/API/Controller.php:33]
#7 Piwik\Plugins\API\Controller->index(...) called at [:]
#8 call_user_func_array(...) called at [/home/user/public_html/piwik/core/FrontController.php:582]
#9 Piwik\FrontController->doDispatch(...) called at [/home/user/public_html/piwik/core/FrontController.php:96]
#10 Piwik\FrontController->dispatch(...) called at [/home/user/public_html/piwik/core/dispatch.php:36]
#11 require_once(...) called at [/home/user/public_html/piwik/index.php:46]

@mattab
Copy link
Member

mattab commented Feb 23, 2015

Hi @mouyse thanks for the report. I can't reproduce this bug. Can you explain how to reproduce this? do you use any custom plugin maybe?

@mattab mattab added the Bug For errors / faults / flaws / inconsistencies etc. label Feb 23, 2015
@mouyse
Copy link
Author

mouyse commented Feb 24, 2015

I am trying to get a tracking code using SitesManager.getJavascriptTag method. After calling it, I receive the above code plus the response like below:

<div style='word-wrap: break-word; border: 3px solid red; padding:4px; width:70%; background-color:#FFFF96;'>
        <strong>There is an error. Please report the message (Piwik 2.9.1)
        and full backtrace in the <a href='?module=Proxy&action=redirect&url=http://forum.piwik.org' target='_blank'>Piwik forums</a> (please do a Search first as it might have been reported already!).<br /><br/>
        Notice:</strong> <em>Array to string conversion</em> in <strong>/home/user/public_html/piwik/core/Tracker/TrackerCodeGenerator.php</strong> on line <strong>137</strong>
<br /><br />Backtrace --&gt;<div style="font-family:Courier;font-size:10pt"><br />
#0  Piwik\Error::errorHandler(...) called at [:]<br />
#1  str_replace(...) called at [/home/user/public_html/piwik/core/Tracker/TrackerCodeGenerator.php:137]<br />
#2  Piwik\Tracker\TrackerCodeGenerator->generate(...) called at [/home/user/public_html/piwik/plugins/SitesManager/API.php:93]<br />
#3  Piwik\Plugins\SitesManager\API->getJavascriptTag(...) called at [:]<br />
#4  call_user_func_array(...) called at [/home/user/public_html/piwik/core/API/Proxy.php:211]<br />
#5  Piwik\API\Proxy->call(...) called at [/home/user/public_html/piwik/core/API/Request.php:216]<br />
#6  Piwik\API\Request->process(...) called at [/home /user/public_html/piwik/plugins/API/Controller.php:33]<br />
#7  Piwik\Plugins\API\Controller->index(...) called at [:]<br />
#8  call_user_func_array(...) called at [/home/user/public_html/piwik/core/FrontController.php:582]<br />
#9  Piwik\FrontController->doDispatch(...) called at [/home/user/public_html/piwik/core/FrontController.php:96]<br />
#10  Piwik\FrontController->dispatch(...) called at [/home/user/public_html/piwik/core/dispatch.php:36]<br />
#11  require_once(...) called at [/home/user/public_html/piwik/index.php:46]<br />
</div><br />
 </pre></div>
<br />
<?xml version="1.0" encoding="utf-8" ?>
<result>
&lt;!-- Piwik --&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
  var _paq = _paq || [];
  _paq.push(['trackPageView']);
  _paq.push(['enableLinkTracking']);
  (function() {
.....
.....
....
...
...
..
.
&lt;!-- End Piwik Code --&gt;
</result>

@tsteur
Copy link
Member

tsteur commented Feb 24, 2015

Can you let us know how you call it?

I presume you are using the API? Can you maybe post the URL that you to use here? Do not forget to remove the parameter token_auth if set.

@mouyse
Copy link
Author

mouyse commented Feb 24, 2015

Yes, I am using the API.
And this is my code.

$p['module'] = "API";
$p['format'] = "xml";
$p['method'] = "SitesManager.getJavascriptTag";
$p['idSite'] = SITEID;

$url = "http://analytics.connectedforlife.in/index.php?"  . http_build_query($p);
$url .= "&token_auth=TOKEN_AUTH";

$fetch_data = file_get_contents($url);

This is the final url:

http://analytics.connectedforlife.in/index.php?module=API&method=SitesManager.getJavascriptTag&format=xml&url=http%3A%2F%2Fwww.xxxxxxx.com&idSite%5B0%5D=10&token_auth=xxxxxxxxxxxxxxxxxxxxxxx

@mattab
Copy link
Member

mattab commented Apr 8, 2015

@mattab mattab added this to the Short term milestone Apr 8, 2015
@mattab
Copy link
Member

mattab commented Apr 8, 2015

please re-open if you can reproduce, we will fix it

@mattab mattab closed this as completed Apr 8, 2015
@mattab mattab added the worksforme The issue cannot be reproduced and things work as intended. label Apr 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc. worksforme The issue cannot be reproduced and things work as intended.
Projects
None yet
Development

No branches or pull requests

3 participants