Xdebug breaks my code

I have recently upgraded my development server with WAMP 2.2e. This comes with the added benefit of Xdebug turned on by default. I like Xdebug but….

It’s reporting an error where there was no error before (breaking my page). I have a dynamically generated select box that gets about 5 options from a database table, checks for an existing setting from another database table and generates the select box with the existing setting selected.

$category_result = mysql_query("SELECT * FROM categories ORDER BY id") or die("Error: Cannot get Categories.");
                        while($categories = mysql_fetch_assoc($category_result)) {
                            if((!isset($existing_array)) AND ($categories['id'] == 'D')) {
                                echo '<option value="D" selected>'.$categories['label'].'</option>';    
                            } elseif(trim($categories['description']) === trim($existing_array['category'])) {
                                echo '<option value="'.$categories['id'].'" selected>'.$categories['description'].'</option>';
                            } else {
                                echo '<option value="'.$categories['id'].'">'.$categories['label'].'</option>';
                            }
                        }

Xdebug reports that there is no $existing_array['category'] and breaks the select box, when I KNOW $existing_array['category'] is set.

If I disable xdebug from php.ini, the page works perfectly. Why would xdebug pick up this error when the code works fine without it?

Leave a Reply

*

Hire Me
Follow Me!
Search
Most Popular Articles & Pages
Because your vote is Important
Sorry, there are no polls available at the moment.
Categories