I am in the screen at: /admin/content/publicbookings/booking/add

I fill out all the info and click save and come to a blank screen with just this error:
Fatal error: __clone method called on non-object in /includes/common.inc on line 1732

It appears to be PHP related, the chuck of code from common.inc is:

 * Provide a substitute clone() function for PHP4.
 */
function drupal_clone($object) {
  return version_compare(phpversion(), '5.0') < 0 ? $object : clone($object);
}

My PHP version is 5.2.11

CommentFileSizeAuthor
#9 bookingsapi.808788-d6.patch1.09 KBAnonymous (not verified)

Comments

Anonymous’s picture

This is strange .. I'll look into it, thanks.

Which OS and webserver are you using?

Anonymous’s picture

Could you alter your drupal_clone-method and send me the output by adding something like

watchdog('PB','<pre>'.print_r(debug_backtrace(),true)).'</pre>');

right before the return statement?

danny englander’s picture

Which OS and webserver are you using? - Mac OS X (10.6.3 and MAMP Pro 1.84)

danny englander’s picture

Could you alter your drupal_clone-method
-- What is the best spot to insert the code you mention? thanks.

Anonymous’s picture

Simply change

* Provide a substitute clone() function for PHP4.
*/
function drupal_clone($object) {
  return version_compare(phpversion(), '5.0') < 0 ? $object : clone($object);
}

into

* Provide a substitute clone() function for PHP4.
*/
function drupal_clone($object) {
  watchdog('PB','<pre>'.print_r(debug_backtrace(),true)).'</pre>');
  return version_compare(phpversion(), '5.0') < 0 ? $object : clone($object);
}

and look into the wachtdog-report ( admin/reports/dblog ) after visiting the failing page :)

danny englander’s picture

I am getting a syntax error on the added code, I am not a PHP expert, your syntax looks good though.

Anonymous’s picture

I actually made a mistake .. it did contain a ) too much :/


* Provide a substitute clone() function for PHP4.
*/
function drupal_clone($object) {
  watchdog('PB','<pre>'.print_r(debug_backtrace(),true).'</pre>');
  return version_compare(phpversion(), '5.0') < 0 ? $object : clone($object);
}
danny englander’s picture

I am not sure if this is what you are looking for?


Message	

Array
(
    [0] => Array
        (
            [file] => /Users/danny/Sites/John Stone/Bain/site510/sites/all/modules/date/date_api.module
            [line] => 964
            [function] => drupal_clone
            [args] => Array
                (
                    [0] => 
                )

        )

    [1] => Array
        (
            [file] => /Users/danny/Sites/John Stone/Bain/site510/sites/all/modules/bookingsapi/bookingsapi.module
            [line] => 415
            [function] => date_difference
            [args] => Array
                (
                    [0] => 2010-05-28 09:30:00
                    [1] => 2010-05-25 12:09:33
                    [2] => minutes
                    [3] => DATE_DATETIME
                )

        )

etc....

Anonymous’s picture

StatusFileSize
new1.09 KB

Could you test the attached fix?

Anonymous’s picture

Assigned: Unassigned »
Status: Active » Needs review

Apologies, forgot to change the status..

danny englander’s picture

The patch worked, I was now able to get beyond that error. I think the issue I am facing now is just wrapping my arms around the entire way this works. for example I created a bookable resource but when I go the page it says "The public booking system is currently disabled. Try again later." so I guess for that I will have to read some of the documentation or open another ticket.

Anonymous’s picture

Simply go to admin/content/publicbookings/settings and check 'Enable the public bookings form' :)

danny englander’s picture

Thanks I see that, I think I am at a point where I can play around with it now.

Anonymous’s picture

Status: Needs review » Fixed

Committed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

asb’s picture

Component: Code » Public Bookings
Priority: Normal » Major
Status: Closed (fixed) » Active

Same issue with publicbookings-6.x-3.x-dev from 2011-Apr-14:

Saving a "Public bookings" at ./admin/content/publicbookings/booking/add results in the error message: "Fatal error: __clone method called on non-object in /var/www/drupal/includes/common.inc on line 1733" (not line 1732 as above).

Installed version of 'Bookings API': bookingsapi -6.x-3.x-dev from 2011-Apr-14

This is probably caused by a broken handling of some validation routine, because - depending on what I fill out - I also get this message (in red):

field is required.
 field is required.
 field is required.
Field Start has errors. The year must be a number between 1 and 4000. The month must be a number between 1 and 12. The day must be a number between 1 and 31.
 field is required.
 field is required.
 field is required.
Field End has errors. The year must be a number between 1 and 4000. The month must be a number between 1 and 12. The day must be a number between 1 and 31.
Recurrences must have an end date.
Recurrences must have an end date.
 Conflicts found

Obviously this message is useless since it doesn't say which fields are supposed to be filled.

And yes, I filled all four fields marked as required (red *): Resource, Name, Start, End.

If I try to make the booking not recurring (by leaving the dropdown menu at "--Frequency" and "--Period", I'm getting just another nonsense error message:

Recurrences must have an end date.
 Conflicts found

As it seems it is impossible to save anything at ./admin/content/publicbookings/booking/add. Setting severity to 'major' as this seems not to work at all.

Anonymous’s picture

Which version of PHP are you using?

asb’s picture

# php -version
PHP 5.2.6-1+lenny10 with Suhosin-Patch 0.9.6.2 (cli) (built: Mar 19 2011 02:57:53)