Advertisement:

Author Topic: Problems in images...  (Read 17558 times)

Offline JuhaS14

  • Jr. Member
  • **
  • Posts: 228
  • Gender: Male
    • Free Joomla templates
Problems in images...
« on: March 16, 2004, 05:09:27 PM »
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   

Offline Oldiesmann

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 24,904
  • Gender: Male
  • Ask me about the function DB :)
    • oldiesmann on Facebook
    • Oldiesmann on GitHub
    • https://www.linkedin.com/in/michaeleshom on LinkedIn
    • @oldiesmann on Twitter
    • Archie Comics Fan Forum
Re: Problems in images...
« Reply #1 on: March 17, 2004, 01:46:19 PM »
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
Cincy Space - now open!

Offline JuhaS14

  • Jr. Member
  • **
  • Posts: 228
  • Gender: Male
    • Free Joomla templates
Re: Problems in images...
« Reply #2 on: March 18, 2004, 03:05:59 AM »
Yeah, but if the image is not exist, it shouldn't give error message. So is it better to @ that gdlib-function?

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Problems in images...
« Reply #3 on: March 18, 2004, 03:12:03 AM »
An @ is being used, your PHP is just not listening.

-[Unknown]

Offline Chris Cromer

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 1,745
  • Gender: Male
  • I am just a figment of your imagination!
    • Chris's AGI Web Site
Re: Problems in images...
« Reply #4 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:
Code: [Select]
if ($errno & error_reporting() == 0) in Errors.php needs to be changed to this:

Code: [Select]
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.

Offline JuhaS14

  • Jr. Member
  • **
  • Posts: 228
  • Gender: Male
    • Free Joomla templates
Re: Problems in images...
« Reply #5 on: March 18, 2004, 03:40:25 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:
Code: [Select]
if ($errno & error_reporting() == 0) in Errors.php needs to be changed to this:

Code: [Select]
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...

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Problems in images...
« Reply #6 on: March 18, 2004, 03:53:51 AM »
Sorry, wrong.  I posted that it was wrong elsewhere..

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]

Offline JuhaS14

  • Jr. Member
  • **
  • Posts: 228
  • Gender: Male
    • Free Joomla templates
Re: Problems in images...
« Reply #7 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!

Offline JuhaS14

  • Jr. Member
  • **
  • Posts: 228
  • Gender: Male
    • Free Joomla templates
Re: Problems in images...
« Reply #8 on: March 18, 2004, 04:13:06 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? ;)

Offline JuhaS14

  • Jr. Member
  • **
  • Posts: 228
  • Gender: Male
    • Free Joomla templates
Re: Problems in images...
« Reply #9 on: March 18, 2004, 04:19:06 AM »
And same problem in line 1425 in Subs.php... ;(

"return @getimagesize($url);"

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

Offline Chris Cromer

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 1,745
  • Gender: Male
  • I am just a figment of your imagination!
    • Chris's AGI Web Site
Re: Problems in images...
« Reply #10 on: March 18, 2004, 04:36:47 AM »
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?
« Last Edit: March 18, 2004, 04:42:05 AM by Chris Cromer »
Chris Cromer

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

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Problems in images...
« Reply #11 on: March 18, 2004, 04:49:35 AM »
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]

Offline Chris Cromer

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 1,745
  • Gender: Male
  • I am just a figment of your imagination!
    • Chris's AGI Web Site
Re: Problems in images...
« Reply #12 on: March 18, 2004, 05:28:11 AM »
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...
« Last Edit: March 18, 2004, 05:29:54 AM by Chris Cromer »
Chris Cromer

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

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Problems in images...
« Reply #13 on: March 18, 2004, 02:03:10 PM »
Basically, yes.. changing it to && is a bad thing.

-[Unknown]

Offline Chris Cromer

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 1,745
  • Gender: Male
  • I am just a figment of your imagination!
    • Chris's AGI Web Site
Re: Problems in images...
« Reply #14 on: March 18, 2004, 08:42:12 PM »
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.

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Problems in images...
« Reply #15 on: March 18, 2004, 09:12:35 PM »
Actually, without the check there it will display any error, so I guess you're wrong :P.

-[Unknown]

Offline Chris Cromer

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 1,745
  • Gender: Male
  • I am just a figment of your imagination!
    • Chris's AGI Web Site
Re: Problems in images...
« Reply #16 on: March 18, 2004, 09:23:46 PM »
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.

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Problems in images...
« Reply #17 on: March 18, 2004, 10:05:14 PM »
Okay, try:

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

-[Unknown]

Offline Chris Cromer

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 1,745
  • Gender: Male
  • I am just a figment of your imagination!
    • Chris's AGI Web Site
Re: Problems in images...
« Reply #18 on: March 18, 2004, 10:11:29 PM »
Yeah that works.
Chris Cromer

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

Offline JuhaS14

  • Jr. Member
  • **
  • Posts: 228
  • Gender: Male
    • Free Joomla templates
Re: Problems in images...
« Reply #19 on: March 19, 2004, 01:29:29 AM »
Okay, try:

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

-[Unknown]

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