php 5.1.4: Fatal error: Cannot access empty property in ..../piCal_xoops.php on line 164
- You cannot open a new topic into this forum
- Guests cannot post into this forum
msg# 1
System Info
----------------
Linux 2.6.11-gentoo-r4 i686 AMD Athlon GNU/Linux
PHP Version 5.1.4-pl0-gentoo
Apache 2.0 with asapi module (mod_php)
piCal 0.76
XOOPS 2.0.14-rc1
----------------
The following error occurs while trying to access the userinfo.php page (View Account) if I have entered any items into the calendar:
Fatal error: Cannot access empty property in /home/www/users/carsonfcc/www/modules/piCal/class/piCal_xoops.php on line 164
This happens when mysql_fetch_object() is called:
[qoute]
// ??????
$rs = mysql_query( $sql , $this->conn ) ;
$ret = array() ;
$context = '' ;
$myts =& MyTextSanitizer::getInstance();
while( $event = mysql_fetch_object($rs) ) {
If I trade this line out for mysql_fetch_array($rs), the fatal error is cleared, but this doesn't work with the loop, of course.
I checked out the query and the $rs variable using:
Quote:
// ??????
$rs = mysql_query( $sql , $this->conn ) ;
$ret = array() ;
$context = '' ;
$myts =& MyTextSanitizer::getInstance();
print "[".var_dump($rs)."]$sql<br>";
$event = mysql_fetch_object($rs);
while( $event !== false ) {
Which produced:
Quote:
resource(120) of type (mysql result) []
SELECT id,uid,summary,UNIX_TIMESTAMP(dtstamp) AS udtstamp, start, end, allday, start_date, end_date, ''
FROM x_pical_event
WHERE admission>0
AND (rrule_pid=0 OR rrule_pid=id)
AND (1) AND (1) AND (1) AND (uid=1)
ORDER BY dtstamp DESC LIMIT 0,5
I can't seem to figure out why mysql_fetch_object() fails so miserably. Running the same query against the database produces:
Quote:
mysql> SELECT id,uid,summary,UNIX_TIMESTAMP(dtstamp) AS udtstamp, start, end, allday, start_date, end_date, '' FROM x_pical_event WHERE admission>0 AND (rrule_pid=0 OR rrule_pid=id) AND (1) AND (1) AND (1) AND (uid=1) ORDER BY dtstamp DESC LIMIT 0,5;
+------------+----------+------------+------------+------------+------------+--------+------------+----------+--+
| id | uid | summary | udtstamp | start | end | allday | start_date | end_date | |
+------------+----------+------------+------------+------------+------------+--------+------------+----------+--+
| 0000000001 | 00000001 | Test Event | 1151194036 | 1150819200 | 1150848000 | 0 | NULL | NULL | |
+------------+----------+------------+------------+------------+------------+--------+------------+----------+--+
1 row in set (0.00 sec)
Any thoughts on how to fix this, other than changing this to mysql_fetch_array() and editing the entire code loop to use the values from the array?
Votes:18
Average:5.56
msg# 1.1
The source of this problem is the '' in the query:
Quote:
SELECT id,uid,summary,UNIX_TIMESTAMP(dtstamp) AS udtstamp, start, end, allday, start_date, end_date, '' FROM x_pical_event WHERE admission>0 AND (rrule_pid=0 OR rrule_pid=id) AND (1) AND (1) AND (1) AND (uid=1) ORDER BY dtstamp DESC LIMIT 0,5;
Votes:1
Average:10.00
msg# 1.2
Here is a fix, which removes the useless '':
// XOOPS Search module
$showcontext = empty( $_GET['showcontext'] ) ? 0 : 1 ;
$select4con = $showcontext ? ", description" : "" ;
// SQL??????
$sql = "SELECT id,uid,summary,UNIX_TIMESTAMP(dtstamp) AS udtstamp, start, end, allday, start_date, end_date $select4con FROM $this->table WHERE\
admission>0 AND (rrule_pid=0 OR rrule_pid=id) AND ($whr_categories) AND ($whr_class) AND ($whr_text) AND ($whr_uid) ORDER BY dtstamp DESC LIMIT $offse\
t,$limit" ;
// ??????
$rs = mysql_query( $sql , $this->conn ) ;
$ret = array() ;
$context = '' ;
$myts =& MyTextSanitizer::getInstance();
Votes:10
Average:1.00
msg# 1.2.1
Is it really piCal 0.76?
piCal_xoops.php in 0.76 should be ...
// XOOPS Search module
$showcontext = empty( $_GET['showcontext'] ) ? 0 : 1 ;
$select4con = $showcontext ? "description" : "'' AS description" ;
Thus, $event->description should not be empty property.
Though it is an issue of an incompatibility between MySQL versions.
Votes:20
Average:4.00