php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13386 problem supressing errors by '@' and including files
Submitted: 2001-09-22 07:53 UTC Modified: 2002-01-05 16:48 UTC
From: kapp at bigping dot de Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0.6 OS: SuSE Linux 7.1
Private report: No CVE-ID: None
 [2001-09-22 07:53 UTC] kapp at bigping dot de
Hi Folks!

Pls. look at the following problem: I have a database 
application which
returns me up to n datasets containing 40 data fields each.
Every field can hold an URL to an image or anything else. 
To detect
if it is an image, I check the image size (which I need 
anyway) and if
the test returns TRUE, then it returns an anchor tag to the 
calling
application. So far so good...
It works fine until I have less than 13 sets. If I have 
more, the PHP
parser returns a warning at every include() I use, telling 
me not beeing
able to include the file.  Very strange, isn't it?
If I don't use the 

if ($img_size_array = @getimagesize 
($image_dir.$input_array[$i])

to check if there's an image or not, the problem doesn't 
happen. It
seems to be a problem of too much errors or warnings 
(supressed by
the '@'). Maybe a stack overflow or something like this?


This is the function I use:
(p.s.: I already have a workaround, so the problem is not 
urgent)

<?
function get_img_tags($input_array) {
	include ("bcontent.php");
	$img_tag = array();
	for ($i = 0; $i <= count($input_array); $i++) {
		$img_sp1 = $img_space1;
		$img_sp2 = $img_space2;
		if (preg_match ("(\Apdf)", $input_array[$i])) {
				$img_tag[$i] = $img_sp1."<a 
href=\"".$image_url.$input_array[$i]."\" 
alt=\"".$input_array[$i+1]."\">".$input_array[$i+1]."</a>".
$img_sp2;		
		} else if ($img_size_array = @getimagesize 
($image_dir.$input_array[$i])) {
			$img_tag[$i] = $img_sp1."<img 
src=\"".$image_url.$input_array[$i]."\" 
".$img_size_array[3]." 
alt=\"".$input_array[$i+1]."\">".$img_sp2;
		}
	}
	return ($img_tag);
}
?>

Kind regards,

Ulrich S. Kapp

BIGPiNG! oHG
Raamkamp 8
22397 Hamburg

phone: 0049 40 608892-77
  fax: 0049 40 608892-88
  
eMail: kapp@bigping.de

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-12-14 14:25 UTC] yohgaki@php.net
Is your problem is too much error message for getimagesize()?

If you write too much, chances are high that is ignored. Please try to be precise.
 [2002-01-05 16:48 UTC] lobbin@php.net
No feedback. Closing.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jun 03 11:01:33 2024 UTC