ceo@l-i-e.com wrote:
keeping. I'll lay money that NOONE is relying on this, and I
challenge
any of you to prove me wrong on that count.Errrr.
You may want to re-think that bet...
Surely somebody out there has:
<?php
$field_X = fgets($file, 10); //get the next 9 bytes
$field_Y = fgets($file, 4); //get the next 3 bytes
?>
Sorry, I meant to say "Noone with an IQ higher than twelve is relying on
this."
Or change the docs and the variable name to something other than
maxchars is a perfect solution. :-)
Yes, and that's what I said both in this thread and on IRC before the
thread started.
-Sara
Sorry, I meant to say "Noone with an IQ higher than twelve is relying on
this."
PHP Developer 1: Let's change functionality for some widely-used
function and break BC, because we can and it is so much fun!
PHP Developer 2: You know, breaking BC is not nice, people really rely
on it and try to write code which works in all PHP versions...
P1: What people, nobody uses this functionality anyway!
P2: I think there might be people using it, we have a lot of developers
and apps out there now, and the manual explicitly says it works like
that, so maybe we should leave it alone?
P1: I bet you money nobody uses it!
P2: Here are code examples of real applications using it.
P1: Those people are dumb, we are smart, so we'll break BC anyway
because we can't care for all stupid people reading the manual and
expecting PHP to work according to it! They should read the source for
PHP version they run and figure the stuff out from the source!
P2: So, you say reading manual and programming according to the docs is bad?
P1: Ouch, those bureaucrats... OK, if you insist, you got it - we'll
change the manual too!
P2: But what about BC?
P1: If you are too dumb or lazy to reread the manual every week - it's
your fault, you are too dumb to use PHP! Go use C where they keep all
the stuff back from 70s!
What's wrong with this dialogue?
Or change the docs and the variable name to something other than
maxchars is a perfect solution. :-)
Yes, you only forgot the part about going back in time 10 years and
doing it back then :)
--
Stanislav Malyshev, Zend Products Engineer
stas@zend.com http://www.zend.com/
At 13:04 15/11/2006, Sara Golemon wrote:
ceo@l-i-e.com wrote:
keeping. I'll lay money that NOONE is relying on this, and I
challenge
any of you to prove me wrong on that count.
Errrr.
You may want to re-think that bet...
Surely somebody out there has:
<?php
$field_X = fgets($file, 10); //get the next 9 bytes
$field_Y = fgets($file, 4); //get the next 3 bytes
?>
Sorry, I meant to say "Noone with an IQ higher than twelve is
relying on this."
Sara,
My IQ is higher than 12, and I don't see how defensive coding could
have defended against this BC break. This code is missing error
checking, but that could be quite reasonable (e.g. if you check ahead
of time that the file is big enough to match the format you're
expecting - so it's not perfect, but it's quite reasonable). But
even if it did have error checking, it would look something like this:
$field_X = fgets($file, 10);
if (strlen($field_X) != 9) {
barf();
}
So, after the BC break, it'd barf. There's really no way to protect
against this BC break, and it's pretty clear this behavior is being
relied upon.
Or change the docs and the variable name to something other than
maxchars is a perfect solution. :-)
Yes, and that's what I said both in this thread and on IRC before
the thread started.
That's fine by me, but I think it's a different issue. The BC break
should be reverted irregardless...
Zeev
Surely somebody out there has:
<?php
$field_X = fgets($file, 10); //get the next 9 bytes
$field_Y = fgets($file, 4); //get the next 3 bytes
?>Sorry, I meant to say "Noone with an IQ higher than twelve is relying
on
this."
While I don't know the IQ chart well, nor its applicability to this
discussion, it would seem that there are more than a few scripts "out
there" that relied on the documented behaviour...
I don't really care what a person's IQ is -- I've seen some horribly
designed, written, and executed scripts that did some pretty nifty and
amazing and creative things.
I believe that one of PHP's strengths is that almost anybody can latch
onto it and start using it, whether they have any idea how to work it
properly or not.
Obviously, this has caused problems in the past, and will cause
problems in the future -- But I think the problems are worth it, as it
has also cause a wealth of community, of users, of creative
[mis-]applications of PHP that is sorely lacking in some other "less
fun" languages.
If you want to have an IQ-filter before a user can play with a
language, send them off to use C++ or something. :-)
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?