News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Problems in images...

Started by JuhaS14, March 16, 2004, 05:09:27 PM

Previous topic - Next topic

JuhaS14

Hi!

I get lots of gdlib-errors, likes these:

2: getimagesize: Unable to open 'http://www.kolumbus.fi/dima.skeber/diskus.gif'; for reading.
Tiedosto: /var/www/forum/Sources/Subs.php
Rivi: 1425

2: getimagesize: Unable to open 'http://koti.welho.com/taskola/Nismo/s13tne1.jpg'; for reading.
Tiedosto: /var/www/forum/Sources/Subs.php
Rivi: 1425


Lots of those errors..


Example topic:

http://www.dnsf.org/forum/index.php?topic=3799.0   

Oldiesmann

When I click on the links for those images, I get a "404" error (the general "Page cannot be displayed" message). Make sure that those images actually exist.
Michael Eshom
Christian Metal Fans

JuhaS14

Yeah, but if the image is not exist, it shouldn't give error message. So is it better to @ that gdlib-function?

[Unknown]

An @ is being used, your PHP is just not listening.

-[Unknown]

Chris Cromer

[Unknown] the problem isn't PHP, I found a bug in the SMF Public beta just now that is ignoring the @ in the error handler.

This line:
if ($errno & error_reporting() == 0) in Errors.php needs to be changed to this:

if ($errno && error_reporting() == 0)

After I did so it started to properly ignore things with @ like it should be.
Chris Cromer

"I was here, here I was, was I here, sure I was" - The little voice in my head.

JuhaS14

Quote from: Chris Cromer on March 18, 2004, 03:35:02 AM
[Unknown] the problem isn't PHP, I found a bug in the SMF Public beta just now that is ignoring the @ in the error handler.

This line:
if ($errno & error_reporting() == 0) in Errors.php needs to be changed to this:

if ($errno && error_reporting() == 0)

After I did so it started to properly ignore things with @ like it should be.

Yeah, I notice same. I turn php.ini display_errors = Off and still it repeating that error:

my Subs.php line 1412 is:

$fp = @fsockopen($match[1], 80, $temp, $temp, 1);

YEah, thanks for you tip. I try that...

[Unknown]

Sorry, wrong.  I posted that it was wrong elsewhere..

Quote from: [Unknown] on March 18, 2004, 03:50:41 AM
Umm, that's not a good thing :P.

if ($errno & error_reporting() == 0)

Means: if $errno AND error_reporting().... equals 0, then...

if ($errno && error_reporting() == 0)

Means: if $errno is true, and error_reporting() equals 0, then...

-[Unknown]

And, yes, it is a PHP problem.  What that line does is checks that $errno is an error we should report - not if it is true and error_reporting is 0.

Otherwise, it won't report ANY errors unless you put:

error_reporting(0);

And then it will report any error.  Obviously bad behavior.

-[Unknown]

JuhaS14

Ok, I think the solution is editing php.ini error level...

Yeah, now I understand that editing Errors.php is not good!

JuhaS14

Quote from: JuhaS14 on March 18, 2004, 04:04:01 AM
Ok, I think the solution is editing php.ini error level...

Yeah, now I understand that editing Errors.php is not good!

Error level modifications didn't help...

Anyone good hints? ;)

JuhaS14

And same problem in line 1425 in Subs.php... ;(

"return @getimagesize($url);"

@ doesn't help or otherwise I have some php.ini configuration error. ;(

Chris Cromer

#10
Um isn't $errno always 1 or higher and always set since it is a required parameter when setting an error handler? So why the heck do you even need to check it... it pretty much has to be set unless PHP is acting screwy or if you call the function manually which isn't something you would normally be doing anyway.

So wouldn't if (error_reporting() == 0) be the best solution? Or is there some purpose behind seeing if that variable is set that I am just not seeing?
Chris Cromer

"I was here, here I was, was I here, sure I was" - The little voice in my head.

[Unknown]

Okay, let me explain this quickly and simply:

error_reporting is a value in php.ini.  It uses BIT logic, like so:

1010101 <-- the second 1 might mean notices, as an example.

So, we're checking if the error number (which is yes always greater than zero) matches the error_reporting value, like so:

1000000
1010101
---------------
1000000

So yes it does; thus we display it.

The & operator means "bitwise AND" and this is exactly what we want.  If it equals zero, that means they DO NOT MATCH, so we should NOT show the error message.

-[Unknown]

Chris Cromer

#12
So if I am understanding this correctly. It is trying to make sure that the error being sent to the handler are the only of the kind specified by the php.ini value for error reporting?

Sorry if I am missunderstanding this, but it is 4 a.m. here...
Chris Cromer

"I was here, here I was, was I here, sure I was" - The little voice in my head.

[Unknown]

Basically, yes.. changing it to && is a bad thing.

-[Unknown]

Chris Cromer

PHP automatically checks that though... you don't have to. :-X

It only sends the types of errors to the handler that is specified in the php.ini directive... so that check to make sure that they are is pretty much useless since php already has checked and not sent them to the function.
Chris Cromer

"I was here, here I was, was I here, sure I was" - The little voice in my head.

[Unknown]

Actually, without the check there it will display any error, so I guess you're wrong :P.

-[Unknown]

Chris Cromer

Well it didn't on php 4.3.4... I tested it last night. :-\
Chris Cromer

"I was here, here I was, was I here, sure I was" - The little voice in my head.

[Unknown]

Okay, try:

if (($errno & error_reporting()) == 0)

-[Unknown]

Chris Cromer

Chris Cromer

"I was here, here I was, was I here, sure I was" - The little voice in my head.

JuhaS14

Quote from: [Unknown] on March 18, 2004, 10:05:14 PM
Okay, try:

if (($errno & error_reporting()) == 0)

-[Unknown]

It's works me too... Thanks Unknown ;)

Advertisement: