#3 mcal_fetch_event start,end, and recurr_end objects empty

General_Issues
open
3
2000-02-04
1999-12-16
Lauren Matheson
No

Mark is looking into this, but to keep a record here, here's the info:

the datetime objects of mcal_fetch_event are not working - they always return empty. I poked around for a while to try and figure out what's going on. Here's what I've got:

all properties except start, end, and recur_enddate work fine.
Those three objects are recognized (as "Resource id #1" when I echoed them).
All properties of those objects return "" (including property names they don't have)

I tried looking through the source to find out why and, well, looked for a while, but didn't get too far (I'm an undergraduate Eng, but not much C coding). I didn't see anything at the php3_mcal.c level that looked strange, the properties for the datetime objects are defined the same way as the event properties that work fine. CALEVENT and datetime struct's
(classes?) seem fine. This leads me to wonder if it is a problem in cal_fetch and the information isn't making it into event at all. Checking in /var/calendar there is a start date recorded, so at least that should be being picked up. If it's a problem in cal_fetch then it's probably a driver problem, and that's where I stopped looking. I'm using mstore. Take everything that I've said with a grain of salt, I may have overlooked something

Discussion

  • Robert Allen
    Robert Allen
    1999-12-17

    • priority: 5 --> 3
    • assigned_to: nobody --> markie
    • status: Error - status not found --> open
     
  • Ron Saad
    Ron Saad
    2000-01-24

    Seems to me that this is due to the use of automatic variables for pval start, end and recurend in make_event_object in php3_mcal.c. The calls to add_assoc_object add these automatics to the return value, but the data is trashed on return from the function call.
    Changing these to <pval *> and calling MAKE_STD_ZVAL on them
    (along with fixing all the &xxx to xxx) fixes this problem.
    I am not an expert in php so I don\'t know if any \'free\' calls are necessary or if this will cause a memory leak.

    Here\'s a diff:
    *** php3_mcal.c.orig Mon Jan 24 01:13:11 2000
    --- php3_mcal.c Mon Jan 24 01:43:40 2000
    ***************
    *** 222,228 ****
    }

    ! static int add_assoc_object(pval *arg, char *key, pval tmp)
    {
    #ifdef ZEND_VERSION
    HashTable *symtable;
    --- 222,228 ----
    }

    ! static int add_assoc_object(pval *arg, char *key, pval * tmp)
    {
    #ifdef ZEND_VERSION
    HashTable *symtable;
    ***************
    *** 463,502 ****

    void make_event_object(pval *mypvalue,CALEVENT *event)
    {
    ! pval start,end,recurend;
    object_init(mypvalue);
    add_property_long(mypvalue,\"id\",event->id);
    add_property_long(mypvalue,\"public\",event->public);
    ! object_init(&start);

    if(event->start.has_date)
    {
    ! add_property_long(&start,\"year\",event->start.year);
    ! add_property_long(&start,\"month\",event->start.mon);
    ! add_property_long(&start,\"mday\",event->start.mday);
    }
    if(event->start.has_time)
    {
    ! add_property_long(&start,\"hour\",event->start.hour);
    ! add_property_long(&start,\"min\",event->start.min);
    ! add_property_long(&start,\"sec\",event->start.sec);
    }

    add_assoc_object(mypvalue, \"start\",start);

    ! object_init(&end);
    if(event->end.has_date)
    {
    ! add_property_long(&end,\"year\",event->end.year);
    ! add_property_long(&end,\"month\",event->end.mon);
    ! add_property_long(&end,\"mday\",event->end.mday);
    }
    if(event->end.has_time)
    {
    ! add_property_long(&end,\"hour\",event->end.hour);
    ! add_property_long(&end,\"min\",event->end.min);
    ! add_property_long(&end,\"sec\",event->end.sec);
    }
    add_assoc_object(mypvalue, \"end\",end);

    --- 463,504 ----

    void make_event_object(pval *mypvalue,CALEVENT *event)
    {
    ! pval *start,*end,*recurend;
    object_init(mypvalue);
    add_property_long(mypvalue,\"id\",event->id);
    add_property_long(mypvalue,\"public\",event->public);
    ! MAKE_STD_ZVAL(start);
    ! object_init(start);

    if(event->start.has_date)
    {
    ! add_property_long(start,\"year\",event->start.year);
    ! add_property_long(start,\"month\",event->start.mon);
    ! add_property_long(start,\"mday\",event->start.mday);
    }
    if(event->start.has_time)
    {
    ! add_property_long(start,\"hour\",event->start.hour);
    ! add_property_long(start,\"min\",event->start.min);
    ! add_property_long(start,\"sec\",event->start.sec);
    }

    add_assoc_object(mypvalue, \"start\",start);

    ! MAKE_STD_ZVAL(end);
    ! object_init(end);
    if(event->end.has_date)
    {
    ! add_property_long(end,\"year\",event->end.year);
    ! add_property_long(end,\"month\",event->end.mon);
    ! add_property_long(end,\"mday\",event->end.mday);
    }
    if(event->end.has_time)
    {
    ! add_property_long(end,\"hour\",event->end.hour);
    ! add_property_long(end,\"min\",event->end.min);
    ! add_property_long(end,\"sec\",event->end.sec);
    }
    add_assoc_object(mypvalue, \"end\",end);

    ***************
    *** 510,527 ****
    add_property_long(mypvalue,\"alarm\",event->alarm);
    add_property_long(mypvalue,\"recur_type\",event->recur_type);
    add_property_long(mypvalue,\"recur_interval\",event->recur_interval);
    ! object_init(&recurend);
    if(event->recur_enddate.has_date)
    {
    ! add_property_long(&recurend,\"year\",event->recur_enddate.year);
    ! add_property_long(&recurend,\"month\",event->recur_enddate.mon);
    ! add_property_long(&recurend,\"mday\",event->recur_enddate.mday);
    }
    if(event->recur_enddate.has_time)
    {
    ! add_property_long(&recurend,\"hour\",event->recur_enddate.hour);
    ! add_property_long(&recurend,\"min\",event->recur_enddate.min);
    ! add_property_long(&recurend,\"sec\",event->recur_enddate.sec);
    }
    add_assoc_object(mypvalue, \"recur_enddate\",recurend);
    add_property_long(mypvalue,\"recur_data\",event->recur_data.weekly_wday);
    --- 512,530 ----
    add_property_long(mypvalue,\"alarm\",event->alarm);
    add_property_long(mypvalue,\"recur_type\",event->recur_type);
    add_property_long(mypvalue,\"recur_interval\",event->recur_interval);
    ! MAKE_STD_ZVAL(recurend);
    ! object_init(recurend);
    if(event->recur_enddate.has_date)
    {
    ! add_property_long(recurend,\"year\",event->recur_enddate.year);
    ! add_property_long(recurend,\"month\",event->recur_enddate.mon);
    ! add_property_long(recurend,\"mday\",event->recur_enddate.mday);
    }
    if(event->recur_enddate.has_time)
    {
    ! add_property_long(recurend,\"hour\",event->recur_enddate.hour);
    ! add_property_long(recurend,\"min\",event->recur_enddate.min);
    ! add_property_long(recurend,\"sec\",event->recur_enddate.sec);
    }
    add_assoc_object(mypvalue, \"recur_enddate\",recurend);
    add_property_long(mypvalue,\"recur_data\",event->recur_data.weekly_wday);

     
  • Robert Allen
    Robert Allen
    2000-02-04

    • assigned_to: markie --> inan
     
  • I\'ve applied this patch to php4 cvs, and things seem to be working. However, I don\'t seem to be able to close bugs, so I\'m just noting this here...