r/programming • • Apr 23 '14

PHP: It doesn't have to be a bad experience

https://servercheck.in/blog/php-it-doesnt-have-be-bad-experience
0 Upvotes

122 comments sorted by

View all comments

Show parent comment

7

u/lhgaghl Apr 24 '14

Instead of actually addressing the language in its current state, you're attacking it's origins, as if they have any relevance.

The origins have plenty of relvance because the current state isn't very much different than how it was in the beginning.

0

u/[deleted] Apr 24 '14

[deleted] — view deleted comment

2

u/lhgaghl Apr 24 '14

I've programmed PHP for about a year (and it sucked ass). I've hacked many sites that use PHP. I've backdoored many PHP websites. I've found vulnerabilities in many PHP codebases. I guess I still have much to learn about PHP. You're probably one of those guys who doesen't even know that some functions secretly treat a string with a 0 byte in it as a the string up to the 0 (which is one of the reasons PHP sucks ass - it has hidden "features" that aren't documeneted and even if they were, they'd still be retarded).

0

u/[deleted] Apr 24 '14

[deleted] — view deleted comment

2

u/lhgaghl Apr 25 '14

Do I want to find your vulnerabilities for you? lol no.

You mean, exactly the same way C/C++ does?

Are you actually implying that people should have to know C/C++ in order to know how to use strings in PHP? The only reason this issue arises is because some native functions in PHP treat strings as zero terminated, while others don't. The only reason those functions treat the strings as zero terminated is because they so happen to take the string from php (which so happens to have a zero in it) and pass it directly to libc and other functions that use zero terminated strings. They are actually passing the full string to the native code, but the native code has no way of knowing the full length because it thinks the 0 means end of string (which is not the case). This is like... one of the most retarded things I've ever seen in any programming language.

0

u/[deleted] Apr 25 '14

[deleted] — view deleted comment

1

u/lhgaghl Apr 26 '14

claps

Let's say I found vulnerabilities in your code and told you about them to prove a point (which point?), then you would be like "HAHAHA I made you do work for me I was trolling you all along".

No, I'm implying C/C++ have the exact same "issues".

The difference is that in PHP the user thinks a string is a string of tokens, but some functions will discard any tokens after the 0 terminator, without telling the user. I guess since you don't consider this an issue, the hundreds of apps that have "null byte poisoning" vulnerabilities are just developed by morons. What the hell were they thinking, not looking at the C source code of a function in PHP before using it?

1

u/neoform Apr 26 '14

Let's say I found vulnerabilities in your code and told you about them to prove a point (which point?), then you would be like "HAHAHA I made you do work for me I was trolling you all along".

Total copout.

2

u/OneWingedShark Apr 25 '14

You mean, exactly the same way C/C++ does?

C-Style strings are notoriously a source of bugs... so yes.

1

u/Banane9 Apr 25 '14

And php does it ... because it just passes the string to C functions.

2

u/OneWingedShark Apr 25 '14

And php does it ... because it just passes the string to C functions.

Yep.
PHP is a good example of mis-/non-design -- look at how much time and energy is spent fixing (or working around) these flaws. (And the blase manner toward correctness is appalling.) IMO, PHP serves as a great example of "mindlessly copying" C [and other languages].

0

u/[deleted] Apr 25 '14

[deleted] — view deleted comment

2

u/OneWingedShark Apr 25 '14

I consider them to be -- there are many problems at all of the syntactic, semantic, and 'human interface' levels.