Closed (fixed)
Project:
Advertisement
Version:
5.x-1.x-dev
Component:
ad_image.module
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
26 Mar 2007 at 01:21 UTC
Updated:
14 May 2007 at 20:40 UTC
After submitting an image ad I got this error:
Fatal error: Cannot use object of type stdClass as array in /home/lohas/drupal5/modules/ad/image/ad_image.module on line 290
Changing line 290 from:
if ($file['list'] && file_exists($file['filepath'])) {
to:
if ($file->list && file_exists($file->filepath)) {
Seems to fix the issue.
Comments
Comment #1
mariuss commentedSame thing two lines down:
$image->fid = $file['fid'];
should probably be:
$image->fid = $file->fid;
Comment #2
jeremy commentedI'm unable to duplicate (with PHP set to log E_ALL). Please try again with the latest version of the ad.module and ad_image.module.
Comment #3
mariuss commentedForgot to specify, using PHP 5.
And yes, the issues is still there. Very easy to fix.
Comment #4
jeremy commentedI just verified that the $file structure is an array, not an object. I don't know why it's an object for you. Are you using the core upload module?
(I am testing with Drupal 5, PHP 5 and E_ALL enabled)
Comment #5
mariuss commentedYes, using core upload module.
Comment #6
duntuk commentedhave the same problem on my end...
however, after the error, if i go to the admin ad listing, i see the ad was added...
however, it does not show up in the selected block (as a few others have noted)...
when debugging as noted:
http://YOURSITE.com/sites/all/modules/ad/adserve.php?g=group1t&c=none&p=...
i get this error:
Group: 'group1t'
Cache: 'none'
Quantity: '1'
Host: ''
Path: 'files'
Nids: ''
Files: '3'
Ad module installed in '/home/gnamxco/domains/gnamx.com/public_html/atwood/sites/all/modules/ad'.
Root drupal directory '/home/gnamxco/domains/gnamx.com/public_html/atwood'.
Using no cache.
Drupal bootstrap '7'.
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/gnamxco/domains/gnamx.com/public_html/atwood/sites/all/modules/ad/adserve.php:365) in /home/gnamxco/domains/gnamx.com/public_html/atwood/includes/bootstrap.inc on line 811
Warning: Cannot modify header information - headers already sent by (output started at /home/gnamxco/domains/gnamx.com/public_html/atwood/sites/all/modules/ad/adserve.php:365) in /home/gnamxco/domains/gnamx.com/public_html/atwood/includes/bootstrap.inc on line 488
Warning: Cannot modify header information - headers already sent by (output started at /home/gnamxco/domains/gnamx.com/public_html/atwood/sites/all/modules/ad/adserve.php:365) in /home/gnamxco/domains/gnamx.com/public_html/atwood/includes/bootstrap.inc on line 489
Warning: Cannot modify header information - headers already sent by (output started at /home/gnamxco/domains/gnamx.com/public_html/atwood/sites/all/modules/ad/adserve.php:365) in /home/gnamxco/domains/gnamx.com/public_html/atwood/includes/bootstrap.inc on line 490
Warning: Cannot modify header information - headers already sent by (output started at /home/gnamxco/domains/gnamx.com/public_html/atwood/sites/all/modules/ad/adserve.php:365) in /home/gnamxco/domains/gnamx.com/public_html/atwood/includes/bootstrap.inc on line 491
document.write('')
Comment #7
mariuss commentedI just verified that the $file structure is an array, not an object. I don't know why it's an object for you.
Still having this issue, need to patch every time there is a new version. Looked at the code again and just around the area where I patch, on line 292, there is the following statement:
$image = ad_image_validate_size((object)$file, $node->gid);which clearly shows that $file is used as an object (also look into ad_image_validate_size).
duntuk, the ad is added for me as well, even if I see the error. But there is a row in the ad_image table which is not added because of the error, and this prevents the ad from working properly. You can add that row manually (aid is the corresponding id from the ads table and fid is the file id from the files table) or just apply my patch.
Marius
Comment #8
jeremy commentedThis problem has been reported by enough people, I've gone ahead and checked these changes into the 4.7.x and 5.x development trees.
Comment #9
dries commented