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

Bug in DataManager Class - Array to string Conversion #12

Open
mdkaleel opened this issue Jan 11, 2015 · 9 comments
Open

Bug in DataManager Class - Array to string Conversion #12

mdkaleel opened this issue Jan 11, 2015 · 9 comments

Comments

@mdkaleel
Copy link

Hi

Facing some issue in DataManger Class "Array to string Conversion" Issue, Please help

Array to string conversion in 'E:\PPNew\environment\classes\dataaccess\DataManager.class.php' on line 252 (error code: 8) 
#2 ERROR: Error: Array to string conversion in 'E:\PPNew\environment\classes\dataaccess\DataManager.class.php' on line 342 (error code: 8) 
#3 ERROR: Error: Array to string conversion in 'E:\PPNew\environment\classes\dataaccess\DataManager.class.php' on line 390 (error code: 8) 
#4 ERROR: Error: Array to string conversion in 'E:\PPNew\environment\classes\dataaccess\DataManager.class.php' on line 396 (error code: 8) 
#5 ERROR: Error: Array to string conversion in 'E:\PPNew\environment\classes\dataaccess\DataManager.class.php' on line 252 (error code: 8) 
#6 ERROR: Error: Array to string conversion in 'E:\PPNew\environment\classes\dataaccess\DataManager.class.php' on line 342 (error code: 8) 
#7 ERROR: Error: Array to string conversion in 'E:\PPNew\environment\classes\dataaccess\DataManager.class.php' on line 390 (error code: 8) 
#8 ERROR: Error: Array to string conversion in 'E:\PPNew\environment\classes\dataaccess\DataManager.class.php' on line 396 (error code: 8) 
#9 ERROR: Error: Array to string conversion in 'E:\PPNew\environment\classes\dataaccess\DataManager.class.php' on line 252 (error code: 8) 
#10 ERROR: Error: Array to string conversion in 'E:\PPNew\environment\classes\dataaccess\DataManager.class.php' on line 342 (error code: 8) 
#11 ERROR: Error: Array to string conversion in 'E:\PPNew\environment\classes\dataaccess\DataManager.class.php' on line 390 (error code: 8) 
#12 ERROR: Error: Array to string conversion in 'E:\PPNew\environment\classes\dataaccess\DataManager.class.php' on line 396 (error code: 8) 
#13 ERROR: Error: Array to string conversion in 'E:\PPNew\environment\classes\dataaccess\DataManager.class.php' on line 252 (error code: 8) 
#14 ERROR: Error: Array to string conversion in 'E:\PPNew\environment\classes\dataaccess\DataManager.class.php' on line 342 (error code: 8) 
#15 ERROR: Error: Array to string conversion in 'E:\PPNew\environment\classes\dataaccess\DataManager.class.php' on line 390 (error code: 8) 
#16 ERROR: Error: Array to string conversion in 'E:\PPNew\environment\classes\dataaccess\DataManager.class.php' on line 396 (error code: 8) 
#17 ERROR: Error: Array to string conversion in 'E:\PPNew\environment\classes\dataaccess\DataManager.class.php' on line 252 (error code: 8) 
#18 ERROR: Error: Array to string conversion in 'E:\PPNew\environment\classes\dataaccess\DataManager.class.php' on line 342 (error code: 8) 
#19 ERROR: Error: Array to string conversion in 'E:\PPNew\environment\classes\dataaccess\DataManager.class.php' on line 390 (error code: 8) 
#20 ERROR: Error: Array to string conversion in 'E:\PPNew\environment\classes\dataaccess\DataManager.class.php' on line 396 (error code: 8) 
#21 ERROR: Error: Array to string conversion in 'E:\PPNew\environment\classes\dataaccess\DataManager.class.php' on line 252 (error code: 8) 
#22 ERROR: Error: Array to string conversion in 'E:\PPNew\environment\classes\dataaccess\DataManager.class.php' on line 342 (error code: 8) 
#23 ERROR: Error: Array to string conversion in 'E:\PPNew\environment\classes\dataaccess\DataManager.class.php' on line 390 (error code: 8) 
#24 ERROR: Error: Array to string conversion in 'E:\PPNew\environment\classes\dataaccess\DataManager.class.php' on line 396 (error code: 8) 
Time since start: 0.29687285423279 seconds 
@JonDeG
Copy link
Contributor

JonDeG commented Jan 11, 2015

What version of the application are you using and what version of PHP are you using?

@mdkaleel
Copy link
Author

@JonDeG
PHP Version :5.4.14
ProjectPier Version : 0.8.8.sp2

@mdkaleel
Copy link
Author

TraceLog

E:\PPNew\environment\classes\dataaccess\DataManager.class.php:findOne()
E:\PPNew\environment\classes\dataaccess\DataManager.class.php:find():begin
E:\PPNew\environment\classes\dataaccess\DataManager.class.php:find():SELECT * FROM `pp088_config_options` WHERE `name` = 'theme'  
E:\PPNew\environment\classes\dataaccess\DataManager.class.php:find():found 1
E:\PPNew\environment\classes\dataaccess\DataManager.class.php:loadFromRow(row):begin
E:\PPNew\environment\classes\dataaccess\DataManager.class.php:isReady() = class_exists ConfigOption
E:\PPNew\environment\classes\controller\PageController.class.php:tpl_fetch(E:/PPNew/application/views/administration/browse_log.php)
E:\PPNew\application\helpers\company_website.php:administration_tabbed_navigation
E:\PPNew\application\models\PluginManager.class.php:call_user_func_array(times_add_administration_tab,..
E:\PPNew\environment\classes\controller\PageController.class.php:renderLayout(E:/PPNew/application/layouts/administration.php <xmp><div class="advancedPagination">
<a href="/index.php?c=administration&amp;a=browse_log&amp;active_project=2&amp;1421037759&amp;trace&amp;pos=0&amp;dir=">First page</a>
<a href="/index.php?c=administration&amp;a=browse_log&amp;active_project=2&amp;1421037759&amp;trace&amp;pos=3217576&amp;dir=up">Previous page</a>
 Page: 3221672 <a href="/index.php?c=administration&amp;a=browse_log&amp;active_project=2&amp;1421037759&amp;trace&amp;pos=3221672&amp;dir=">Next page</a>
<a href="/index.php?c=administration&amp;a=browse_log&amp;active_project=2&amp;1421037759&amp;trace&amp;pos=-1&amp;dir=up">Last page</a></div>
------------------------------------------------------------------
<br>Session "default" started at 2015-01-11T09:19:02+0000
<br>#1 ERROR: Error: Array to string conversion in 'E:\PPNew\environment\classes\dataaccess\DataManager.class.php' on line 252 (error code: 8)
<br>#2 ERROR: Error: Array to string conversion in 'E:\PPNew\environment\classes\dataaccess\DataManager.class.php' on line 342 (error code: 8)
<br>#3 ERROR: Error: Array to string conversion in 'E:\PPNew\environment\classes\dataaccess\DataManager.class.php' on line 390 (error code: 8)
<br>#4 ERROR: Error: Array to string conversion in 'E:\PPNew\environment\classes\dataaccess\DataManager.class.php' on line 396 (error code: 8)
<br>Time since start: 0.26563096046448 seconds
<br>-------------------------------------------------------------------------------
<br>Session "default" started at 2015-01-11T09:21:40+0000
<br>#1 ERROR: Error: Array to string conversion in 'E:\PPNew\environment\classes\dataaccess\DataManager.class.php' on line 252 (error code: 8)
<br>#2 ERROR: Error: Array to string conversion in 'E:\PPNew\environment\classes\dataaccess\DataManager.class.php' on line 342 (error code: 8)
<br>#3 ERROR: Error: Array to string conversion in 'E:\PPNew\environment\classes\dataaccess\DataManager.class.php' on line 390 (error code: 8)
<br>#4 ERROR: Error: Array to string conversion in 'E:\PPNew\environment\classes\dataaccess\DataManager.class.php' on line 396 (error code: 8)
<br>Time since start: 0.28125691413879 seconds
<br>-------------------------------------------------------------------------------
<br>Session "default" started at 2015-01-11T09:21:46+0000
<br>#1 ERROR: Error: Array to string conversion in 'E:\PPNew\environment\classes\dataaccess\DataManager.class.php' on line 252 (error code: 8)
<br>#2 ERROR: Error: Array to string conversion in 'E:\PPNew\environment\classes\dataaccess\DataManager.class.php' on line 342 (error code: 8)
<br>#3 ERROR: Error: Array to string conversion in 'E:\PPNew\environment\classes\dataaccess\DataManager.class.php' on line 390 (error code: 8)
<br>#4 ERROR: Error: Array to string conversion in 'E:\PPNew\environment\classes\dataaccess\DataManager.class.php' on line 396 (error code: 8)
<br>Time since start: 0.26563191413879 seconds
<br>-------------------------------------------------------------------------------
<br>Session "default" started at 2015-01-12T04:42:28+0000
<br>#1 ERROR: Error: Array to string conversion in 'E:\PPNew\application\controllers\AccessController.class.php' on line 133 (error code: 8)
<br>Time since start: 0.40625500679016 seconds
<br>-------------------------------------------------------------------------------
<br>Session "default" started at 2015-01-12T04:42:29+0000
<br>#1 ERROR: Error: Array to string conversion in 'E:\PPNew\environment\classes\dataaccess\DataManager.class.php' on line 252 (error code: 8)
<br>#2 ERROR: Error: Array to string conversion in 'E:\PPNew\environment\classes\dataaccess\DataManager.class.php' on line 342 (error code: 8)
<br>#3 ERROR: Error: Array to string conversion in 'E:\PPNew\environment\classes\dataaccess\DataManager.class.php' on line 390 (error code: 8)
<br>#4 ERROR: Error: Array to string conversion in 'E:\PPNew\environment\classes\dataaccess\DataManager.class.php' on line 396 (error code: 8)
<br>Time since start: 2.296905040741 seconds
<br>-------------------------------------------------------------------------------
<br>Session "default" started at 2015-01-12T04:42:35+0000
<br>#1 ERROR: Error: Array to string conversion in 'E:\PPNew\environment\classes\dataaccess\DataManager.class.php' on line 252 (error code: 8)
<br>#2 ERROR: Error: Array to string conversion in 'E:\PPNew\environment\classes\dataaccess\DataManager.class.php' on line 342 (error code: 8)
<br>#3 ERROR: Error: Array to string conversion in 'E:\PPNew\environment\classes\dataaccess\DataManager.class.php' on line 390 (error code: 8)
<br>#4 ERROR: Error: Array to string conversion in 'E:\PPNew\environment\classes\dataaccess\DataManager.class.php' on line 396 (error code: 8)
<br>Time since start: 0.46875309944153 seconds
<br>-------------------------------------------------------------------------------
<br></xmp>)
E:\PPNew\environment\classes\dataaccess\DataManager.class.php:findOne()
E:\PPNew\environment\classes\dataaccess\DataManager.class.php:find():begin
E:\PPNew\environment\classes\dataaccess\DataManager.class.php:find():SELECT * FROM `pp088_config_options` WHERE `name` = 'site_name'  
E:\PPNew\environment\classes\dataaccess\DataManager.class.php:find():found 1
E:\PPNew\environment\classes\dataaccess\DataManager.class.php:loadFromRow(row):begin
E:\PPNew\environment\classes\dataaccess\DataManager.class.php:isReady() = class_exists ConfigOption
E:\PPNew\environment\classes\dataaccess\DataManager.class.php:findOne()
E:\PPNew\environment\classes\dataaccess\DataManager.class.php:find():begin
E:\PPNew\environment\classes\dataaccess\DataManager.class.php:find():SELECT * FROM `pp088_config_options` WHERE `name` = 'theme'  
E:\PPNew\environment\classes\dataaccess\DataManager.class.php:find():found 1
E:\PPNew\environment\classes\dataaccess\DataManager.class.php:loadFromRow(row):begin
E:\PPNew\environment\classes\dataaccess\DataManager.class.php:isReady() = class_exists ConfigOption
E:\PPNew\environment\classes\dataaccess\DataManager.class.php:findOne()
E:\PPNew\environment\classes\dataaccess\DataManager.class.php:find():begin

@Engelbert
Copy link
Contributor

Does it work if you enable or disable TRACE @ login?
The only constant I can find in the error is the :

__TRACE__ 

@JonDeG
Copy link
Contributor

JonDeG commented Jan 14, 2015

Looks like a PHP 5.4+ change that is not backward compatible:

http://php.net/manual/en/migration54.incompatible.php

specifically:

"Converting an array to a string will now generate an E_NOTICE level error, but the result of the cast will still be the string "Array"."

I can confirm I have duplicated this on PHP 5.5. This error is logged in the PP system log, but I don't think it's affecting the functionality as it appears to be related to trace logging only.

Obviously we need to dig around and find the source. I suspect the variable $id is an array and is the source of the issue. Just a gut feeling at this point.

@GLHowell
Copy link

GLHowell commented Feb 5, 2015

FIX

I fixed this bug by replacing the double quotes with single quotes in the problem Trace statements in
Project-Pier/environment/classes/dataaccess/DataManager.class.php

For example here is the modified version of function findById:

function findById($id, $force_reload = false) {
  trace(__FILE__,'findById($id, $force_reload)');
...

The trace strings that contain variable names with $ signs require modification.

@Engelbert
Copy link
Contributor

Hi @GLHowell ,
Thanks for your fix mate. As soon as somebody has the time to test and confirm this, you're welcome to make a pull request if you'd like.

@JonDeG
Copy link
Contributor

JonDeG commented Feb 28, 2015

@GLHowell I still get the errors even after making the suggested change. Can you confirm this? When verifying, please directly evaluate the contents of log.php instead of relying on the log browser within the application. Thanks.

@GLHowell
Copy link

GLHowell commented Mar 2, 2015

I inspect log.php directly. I delete it and have it regenerated before tests.

Turns out, I found two additional files with the problematic trace calls.
- application/controllers/AccessController.class.php
- application/models/application_logs/ApplicationLogs.class.php

Perhaps the reported errors you are seeing are from these files? Change the strings with $ in the trace calls in these file as well. There may be other files, that my app hasn't hit yet.

If you are still seeing errors from DataManager, recheck your fixes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants