Support Forum

Undefined offset?

MY Michael Yakutis
Michael Yakutis
Member

I’m getting the following errors above some of my forum threads:

Undefined offset: 1 in webcomicunderdogs.com/wp-content/plugins/simple-press/sp-api/sp-api-filters.php on line 1749

Here’s what’s on line 1749:

return ‘<img src=”‘.$src[1].'”‘.$display_width.$display_height.’ title=”‘.$title[1].'” alt=”‘.$alt[1].'” />’;

Any ideas why this notice is cropping up? Thanks!

16 Answers

New Answer

MP Mr Papa
Mr Papa
Member

its not an error…  its a notice (harmless)…  and you really shouldnt be displaying notices, warnings or errors on a production site…  you should turn them off in php…

that said, not sure what the issue is…  is the image in the post valid html?

MY Michael Yakutis
Michael Yakutis
Member

Sorry, I meant “notice”. I didn’t know I could turn them off in php – I’ll have to look into that. The notice seems to appear in image-heavy threads, so one of them must be setting it off.

MY Michael Yakutis
Michael Yakutis
Member

I can’t seem to figure this out – can you tell me how to keep notices from displaying? 

YS Yellow Swordfish
Yellow Swordfish
Member

It is set in your php.ini file. If you are in control of the php.ini file the easiest thing to do is open it, search for, say, E_NOTICE, and then read the comments in the error reporting section and change the settings to suit. It will usually have good examples of what to set for a production, live site v what to set for development, private use.

As you the notice you are getting, are any of the images missing or messed up?

MP Mr Papa
Mr Papa
Member

my guess is its this post:  http://www.webcomicunderdogs.com/forum/art-talk/show-us-your-work-space/#p4112

two warnings and that has two images.. plus its form a tinypic site, so it might be returning/blocking requests for the file image size…  might be a cdn or cache of some sorts…  and oddly the images have a link to the same image…  kind of confusing…

biggest problem is the notice message isnt helpful…  as you can see in the code, several items have an index of 1 referenced.. we can see about adding some special guards, but that info should really be there…

and you should block those notice, warning and error displays on your production site… its done in your php.ini file…

MY Michael Yakutis
Michael Yakutis
Member

I wish I could, but I have no idea how to block the notices. After not being able to locate the php.ini file, I did some research but could not figure out how to locate it. Numerous places suggest creating the file yourself, which does not make sense to me. 

MP Mr Papa
Mr Papa
Member

check with your host – they will know…  do you not have some sort of control panel, like cpanel?

also in your wp-config.php, try adding these settings:

define(‘WP_DEBUG’, true);
define(‘WP_DEBUG_DISPLAY’, false);

MY Michael Yakutis
Michael Yakutis
Member

I was told by a developer:

“If you really want to get rid of the errors (note that this is like turning off your body’s pain receptors, if something serious were to happen), you can insert these lines in wordpress-config.php
 

error_reporting(0);

@ini_set(‘display_errors’, 0);”
 
So I am hesitant to add these settings to wp-config. Does this concern have any merit?
MP Mr Papa
Mr Papa
Member

did you try what I said?

you can do what you posted, but it might not work – some hosts wont let you update them like that… but cant hurt to try…

MP Mr Papa
Mr Papa
Member

and agree with the dev – on a dev site or staging site, but not production…

MY Michael Yakutis
Michael Yakutis
Member

Okay, update. The notices are finally not displaying. I tried the following, but nothing changed:

define(‘WP_DEBUG’, true);
define(‘WP_DEBUG_DISPLAY’, false);

This code ended up working for me, though:

error_reporting(0);
@ini_set(‘display_errors’, 0);

 

Thanks for your help!

MP Mr Papa
Mr Papa
Member

good to hear…  thanks for update…  we will do some more checking on that notice… when the harmless notices popup, we still like to correct them…

MP Mr Papa
Mr Papa
Member

actually, looking at this bit closer, its cause by a user’s signature…  missed the actual routine name since its similar code to another section…

looking at the signatures now, would guess its the mcmasters signature since he has done something quite weird pasting in actual image data vice using a file…  probably had it a while since we have tried to block such content recently… 

but since its quite different to do that, guessing its not passing the image validation stuff so the notices… and why its the only report of it…