Jump to content

No ending delimiter '^' found in ...


rendsonn

Recommended Posts

I'm having trouble with a role in a wordpress site that I made

I think the script was that I installed another version, so I

some adjustments in it, among those changes have modified this function

 

if (@$_GET['src'] && !@$PHPTHUMB_CONFIG['allow_local_http_src'] && eregi('^http://'.@$_SERVER['HTTP_HOST'].'(.+)', @$_GET['src'], $matches)) {

$phpThumb->ErrorImage('It is MUCH better to specify the "src" parameter as "'.$matches[1].'" instead of "'.$matches[0].'".'."\n\n".'If you really must do it this way, enable "allow_local_http_src" in phpThumb.config.php');

}

for this:

(@$_GET['src'] && !@$PHPTHUMB_CONFIG['allow_local_http_src'] && preg_match('^http://'.@$_SERVER['HTTP_HOST'].'(.+)', @$_GET['src'], $matches)) {

$phpThumb->ErrorImage('It is MUCH better to specify the "src" parameter as "'.$matches[1].'" instead of "'.$matches[0].'".'."\n\n".'If you really must do it this way, enable "allow_local_http_src" in phpThumb.config.php');

}

 

 

It was supposed to make some images appear as thumbnails on the home page

my site, but they do not appear and I got the following error:

Warning: preg_match() [function.preg-match]: No ending delimiter '^' found in /home/pontocom/public_html/wp-content/themes/Comfy/scripts/phpThumb/phpThumb.php on line 160

 

Is there some way that I can take to fix this error?

 

Link to comment
https://forums.phpfreaks.com/topic/214446-no-ending-delimiter-found-in/
Share on other sites

Why do people do this:@$_GET['src'] I never quite understand why people do this, why suppress errors? Surely you want to know EVERYTHING that could be erroneous with your code... The only exception I know to this 'rule' is some of the XML functions, that even php.net documentation state, that in order to get it to functional you will need to use the @ symbol to get the desired functionality.

 

Secondly: Word of advice (though using older versions should be ok) If you put error_reporting(E_ALL|E_DEPRECATED); on in the file you are working on, you should get a notice to say that ereg_ functions are now deprecated, this means that, should you come to migrate servers in the future, some of the functionality of you code won't or wouldn't perform as desired.

 

[EDIT] Then I re read the first post and wish I had pressed preview instead of post! Read some preg stuff from the manual

 

Rw

I think his problem stemmed from the fact that he just got rid of the eregi() and is replacing it with preg_match(). I agree with universally and summarily ripping all the error suppression '@'s out of all code, however.

use

('/^http://'.@$_SERVER['HTTP_HOST'].'(.+)/',

 

because you started your regexp with ^ it expect it to end the pattern with ^

that's why people mostly use / pattern / or  ~ pattern ~

 

I get this:

Warning: preg_match() [function.preg-match]: Unknown modifier '/' in

 

I'll read the manual and see if I can find another way to insert this script, anything I post here again

You need to escape the slashes in the pattern now that someone decided you should use slashes as a delimiter.

Otherwise, to help keep it readable, change the delimiters to tilde ~ (or some other non-alphanumeric character that doesn't appear in the pattern).

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.