When the hell php naming normalizes ?

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
jankidudel
Forum Commoner
Posts: 91
Joined: Sat Oct 16, 2010 4:30 pm
Location: Lithuania, Vilnius

When the hell php naming normalizes ?

Post by jankidudel »

PHP has very good arsenal of funcions, but who named them ?

Example: strip_tags , stripslashes ? why 1 function is separated & second isn't ?

And, can someone explain me why in this function there is so many filtering, i think half of them isn't necessary.

Code: Select all

function filter($data) {
	$data = trim(htmlentities(strip_tags($data)));
	
	if (get_magic_quotes_gpc())
		$data = stripslashes($data);
	
	$data = mysql_real_escape_string($data);
	
	return $data;
}
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: When the hell php naming normalizes ?

Post by alex.barylski »

PHP suffers from an adhoc development approach, at least it did, things probably have improved somewhat since day one.

Cheers,
Alex
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: When the hell php naming normalizes ?

Post by josh »

That filter() function you post really has nothing to do with PHP, as in its not a built in function. You'd have to ask whoever wrote it. Although I can say GPC magic quotes was a feature that "magically" escaped things, so it looks like the developer checks if this is enabled before manually escaping a value.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: When the hell php naming normalizes ?

Post by Christopher »

jankidudel wrote:PHP has very good arsenal of funcions, but who named them ?

Example: strip_tags , stripslashes ? why 1 function is separated & second isn't ?
Many PHP's function names simply follow the underlying library's naming. That follows PHP Share Nothing philosophy which unlike other language (Java being a prime example) does not recreate everything with pleasing names. PHP just uses existing subsystems assuming that their builders knew better -- hence the "good arsenal."
jankidudel wrote:And, can someone explain me why in this function there is so many filtering, i think half of them isn't necessary.
There is a reason for every line in that function. It is sort of a primer in PHP web security for MySQL database values. ;)
(#10850)
Post Reply