php error

On a web page I have a really esoteric php warning.  I have done a bunch of things to clear up the warning however to no avail.  Is there a way to out put an error so it gives me a robust report to help find what went wrong?  Something more robust than just:
ini_set('display_errors', '1');
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

There's a PHP extension called xdebug which can provide an automatic stack trace on errors ( That might help you better locate the source of the error.

Alternatively, you can just provide the error here and the relevant details and we can try to help walk you through it.
rgranlundAuthor Commented:
@gr8gonzo.  Thanks.  If I need more help I will post the url.  However, at this point it will take forever to explain how the whole thing works.  It is an warning generated by the CMS.
A PHP Error was encountered

Severity: Notice

Message: Array to string conversion

Filename: libraries/Template.php

Line Number: 3858

Open in new window

The php code being referred to:
		return str_replace(LD.$name.RD, $value, $string);

Open in new window

I know that probably does not help though.
Is $name or $string an array?
Why Diversity in Tech Matters

Kesha Williams, certified professional and software developer, explores the imbalance of diversity in the world of technology -- especially when it comes to hiring women. She showcases ways she's making a difference through the Colors of STEM program.

If $name is an array, then you can probably fix the warning by changing it to:

        foreach($name as $k => $v) { $name[$k] = LD.$name.RD; }
      return str_replace($name, $value, $string);

This assumes that:
LD and RD are defined constants and you're trying to put them around each value in the array. So if you had an array like:

[0] = "John"
[1] = "Gonzo"

...and LD was "X" and RD was "Y", the you'd end up with:

[0] = "XJohnY"
[1] = "XGonzoY"

At this point, you should be able to use an array in str_replace without a problem.
Ray PaseurCommented:
Here is a code sample that may show the sort of thing that is happening.  The PHP script is using an array as if it were a string.  You can type-hint or test for this and avoid it, but more likely it is a logic error in the script, or some unexpected data that was not filtered before it was used in the script.

<?php // demo/temp_rgranlund.php
 * See
 * Demonstrate an inappropriate array-to-string conversion
ini_set('display_errors', TRUE);

$selected = array
( 0 => 'selected'
, 1 => NULL
, 2 => NULL
, 3 => NULL

echo $selected;

Open in new window

rgranlundAuthor Commented:
" but more likely it is a logic error in the script, or some unexpected data that was not filtered before it was used in the script."  I'm sure it is this.  I just can't find where I made my mistake.  The code is part of a foreach so the first time it loops the warning is not there but the 2nd time, there is one warning.  the third time, there is 2 warnings and so on.  I'm trying to figure out a way to narrow down my search.  I thought that it may have to do with select choices and input fields but I can't find any mismatched.

Does this mean that if I am echoing out something that does not have a value, it will through an error?
Can you provide a URL with steps to reproduce those warnings?
rgranlundAuthor Commented:
fill in all needed info, submit.  On next page, click add another bike.
Fill in info, submit.
This warning will only appear in FireFox, not Chrome.
I don't see that error appearing.
rgranlundAuthor Commented:
Are you using FF?
Yes. I did see some kind of HTTP error in the AJAX call going to the view cart, but there wasn't any content returned. I didn't see anything that resembled the error message you mentioned above.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rgranlundAuthor Commented:
It seems to have disappeared.  I did not change anything at all.  However, I was able to look into the ajax error, which is good.  Thanks.  If it pops back up, I'll document how I made it happen.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.