Javascript alert XML problem in Wordpress

I have activated the 2.3 version of the scheduler/event calendar plugin in Wordpress 3.0.4 and am experiencing problems. I have used phpMyAdmin to verify that I have date records in the wp_event_rec table. When I go to my page with the [[scheduler_plugin]] on it I always get a Javascript alert which displays what looks like the content of an xml file. Here is what is displayed when I go to the [[scheduler_plugin]] page at fumcsalt.org/?page_id=27#date=20 … mode=month:

<?xml version='1.0' encoding='utf-8' ?>

This happens every time I go to the page. It also happens when I go to the Wordpress Site-Admin Plugin Scheduler page to administer the plug-in settings, although the message in the Javascript alert is different:

<?xml version='1.0' encoding='utf-8' ?>DescriptionStart dateEnd DateType date%

I can not set Debug to on, because no content is displayed on the [[scheduler_plugin]] page when I try this.

The calendar draws nicely on the screen but none of the dates show up on the calendar, even though I can browse the table see that they are saved there.

I have tried deactivating and doing the fresh start sql routine (deleting scheduler options and dropping the events table) and then reinstalling and activating, but I still get this problem

Can someone please help.

Thank you

There is some problem with your php server configuration.
Data stream is correct but has two extra whitespaces before data start, which is not generated by connector, but caused by some code, specific to your server and those two whitespaces is enough to kill correct xml parsing in non-ie browser ( yep, it works in IE )

You can try to edit
event-calendar-scheduler\codebase\connector\base_connector.php

locate
$start="<?xml version='1.0' encoding='".$this->encoding."' ?>".$this->xml_start();

and replace with
$start=$this->xml_start();

it may restore functionality

After editing your code as per your instruction I receive the following alert:

"

Parse error: syntax error, unexpected $end in /Library/WebServer/Documents/fumcSALT/wp-content/plugins/event-calendar-scheduler/codebase/connector/base_connector.php on line 707
"

(Quotes are mine.)

I receive this alert when going to the [[scheduler_plugin]] page and in the admin panel. The page is served up from a Mac Mini with Snow Leopard Server with PHP 5.3.3. I am using Firefox. I receive the same message on my Windows XP machine using IE.

Some additional insight:

I changed the code back to the original and tried the site on the Windows XP machine using IE. The scheduler seemed to work as advertised - no error alerts. I tried using Firefox on the XP machine and I received the original alert message that I posted in my first post. I also received the same error report when I tried Safari on the XP machine.

I do not have IE for the Mac so I can’t try it, but I get the error alert on both Firefox and Safari on the Mac, also.

Is this a browser problem?

Some more insight:

After downloading and testing the latest versions of different browsers, I found that version 2.3 of the scheduler does not work on either Mac 10.6 or Windows XP using the following browsers:

Firefox
Safari
Opera
Chrome

It does work on the latest version of Internet Explorer.

Hope this helps correct the problem. The scheduler plugin for Wordpress is an amazing tool.

Thank you.

After editing your code as per your instruction I receive the following alert:
It seems you have changed something wrong, now php code syntax is invalid, but above suggested edit can’t cause such effect.

After downloading and testing the latest versions of different browsers
The scheduler itself works fine in all main ( FF, Chrome, Safari, Opera, IE ) browsers on both win and Mac computers.

I commented out the line of code you said to replace and inserted the replacement line below it. (I obviously did not follow your instructions precisely.) I now have deleted the commented line and now have the calendar displaying the dates saved in the database without the large alert message as first posted. But now I am getting ‘confirmation’ messages when I edit or add dates to the scheduler calendar and also on the admin panel.

How do I prevent these alerts from occurring.

You said my php configuration was wrong. What can I change there to prevent these alerts? I am using the scheduler on five wordpress sites and replacing the line of code in each of the sites will become tedious.

Thank you.

For instance, on deleting a date record, I get an alert message like this:

" <?xml version='1.0' ?>"

The quotes are mine and are included to show that the message is prefixed by the spaces you mentioned.

How do I prevent these alerts from occurring.
The alert just a signal of server side error.
PHP code has extra data in output which is caused by some server side settings, without fixing that error - problem will not be resolved.

What can I change there to prevent these alerts?
If you have access to php.ini - check is it have
output_buffering = On
this is not mandatory requirement, but with enabled buffer, server side code must be able to delete any unwanted output ( which may be produced by some other scripts | settings )

Still the same problem

" <?xml version='1.0' ?>

you have whitespace before <?xml - which must not be here.
It can occurs because of some custom modifications in php code of scheduler, or because of some server side settings ( auto php includes and similar )

The php.ini file had the following entry: output_buffering = 4096.

I changed it to “output_buffering = On”, saved, and restarted. I am still receiving the same alert on editing date event entries. I also have the same spaces at the beginning of the message in the alert.

The only changes I have made to the PHP configuration file is to set the max file upload size to 10mb. I have not changed anything in the scheduler code other than what you have asked me to.

A novice programmer question: if the spaces are the problem can they be eliminated using the trim function somewhere in the scheduler code?

Unfortuanately trim will not help.
Code of scheduler already eradicates all unnecessary whitespaces, in your case they are added by some logic outside of plugin ( and it is not clear, how some outside code can affect not modified scheduler plugin )

You can try to do one more modification
event-calendar-scheduler\codebase\connector\dataprocessor.php

locate and comment the next line

echo “<?xml version='1.0' ?>”;

still it is not a solution, just a workaround which will allow to ignore strange whitespace output

Things seem to be working with the following edits.

When I comment the line I get the following alert every time I go to the page with the [[schedule_plugin]] code:

"

Parse error: syntax error, unexpected $end in /Library/WebServer/Documents/fumcSALT/wp-content/plugins/event-calendar-scheduler/codebase/connector/dataprocessor.php on line 465
"

(The quotes are mine.) This also displays when I go to the admin panel. However, this message disappears when I delete the line from the code. This happened before on the first edit you asked me to do and I tried to just comment the line. For some reason, just commenting the code inside the function does not work. I was able to move the line into the comment block above the function without the message I have described occurring.

With the line deleted from the function, I am able to add and edit events in the calendar. When I add an event I get an alert with a blank message. When I edit an existing event I do not get this alert.

Could the spaces problem be the result of other plugins? I have deactivated the plugins I have installed (all but yours) and this does not seem to correct the message alerts. These are the plugins installed: Akismet, Executable PHP widget, PHP Execution, Raw HTML capability, and WP-Mail-SMTP.

Could the spaces problem be the result of other plugins?
Don’t think so. Data feed of calendar takes data directly from DB so it must not be a problem.
By any chance, do you add some modification to the core WP’s files ?
Normally, WP’s file are have not whitespace output, but as result of manual modification they may appear, and leak into data feed.

No, I did not modify any WP files.

I created the wp_config.php file and edited it to add the database information as requested. At the end of it I “include” a local config.php file that starts $_SESSION processing, hooks a function to the wp_logout function to clear $_SESSION, defines two local global variables and then loads (includes_once) eight php scripts I use for various purposes (HTML manipulation, database access to my site specific database tables, emailing to a roster of people in my database).

Through a process of elimination I have discovered that one of the php scripts loaded in this routine is the culprit - but it isn’t a script I wrote. I have an email function script that ‘includes’ a script containing an email class I got off the web some time ago which I am using to send emails to people in my roster database. The script name is ‘htmlMimeMail5.php’. When I block the loading of this script (commenting it), your scheduler_plugin works.

I have replaced the file with the newest version of the script, named Rmail from http://www.phpguru.org/downloads/Rmail/Rmail%20for%20PHP/. Everything seems to be working great.

Thank you for sticking with me. I look forward to using your plugin and seeing what enhancements you incorporate for the future.

Hello Stanislav,

I have treid your solution of replacing

$start="<?xml version='1.0' encoding='".$this->encoding."' ?>".$this->xml_start();

with

$start=$this->xml_start();

But when I do and I try to add an event I get this

<?xml version='1.0' ?>

Do you know how I can fix this so that the user does not get any errors?

Thanks,

Aaron

Do you know how I can fix this so that the user does not get any errors?

Hello Stanislav,

Thanks for your help, this worked great.

Aaron