subreddit stringclasses 7
values | author stringlengths 3 20 | id stringlengths 5 7 | content stringlengths 67 30.4k | score int64 0 140k |
|---|---|---|---|---|
lolphp | maweki | d04u3hu | <|sols|><|sot|>Typofixing commit in Mersenne twister RNG code is reverted (because code might depend on it)<|eot|><|sol|>https://github.com/php/php-src/commit/a0724d30817600540946b41e40f4cfc2a0c30f80<|eol|><|sor|>This commit is unfortunately not wrong. Producing repeatable sequences of pseudorandom numbers is an important part of a PRNG's job. It's time for another real_. <|eor|><|soopr|>Repeatable in the sense that the original implementation does not repeat the numbers as the algorithm defines.<|eoopr|><|eols|><|endoftext|> | 13 |
lolphp | audaxxx | d05420j | <|sols|><|sot|>Typofixing commit in Mersenne twister RNG code is reverted (because code might depend on it)<|eot|><|sol|>https://github.com/php/php-src/commit/a0724d30817600540946b41e40f4cfc2a0c30f80<|eol|><|sor|>/u/the_alias_of_andrea predicted that: https://www.reddit.com/r/lolphp/comments/467ykt/oops_theres_a_typo_in_the_mersenne_twister_rng/d03r1a2
real_this_time_it_probably_works_rand_that_should_return_an_int()<|eor|><|eols|><|endoftext|> | 11 |
lolphp | the_alias_of_andrea | d054cnu | <|sols|><|sot|>Typofixing commit in Mersenne twister RNG code is reverted (because code might depend on it)<|eot|><|sol|>https://github.com/php/php-src/commit/a0724d30817600540946b41e40f4cfc2a0c30f80<|eol|><|sor|>Why remove the test, instead of changing it to match the current output? <|eor|><|sor|>I've gone and restored the test, but with the current output: https://github.com/php/php-src/commit/a50c31da1917bb07b3c11f229125ab8d1f0b9b70<|eor|><|eols|><|endoftext|> | 11 |
lolphp | phoshi | d055688 | <|sols|><|sot|>Typofixing commit in Mersenne twister RNG code is reverted (because code might depend on it)<|eot|><|sol|>https://github.com/php/php-src/commit/a0724d30817600540946b41e40f4cfc2a0c30f80<|eol|><|sor|>This commit is unfortunately not wrong. Producing repeatable sequences of pseudorandom numbers is an important part of a PRNG's job. It's time for another real_. <|eor|><|soopr|>Repeatable in the sense that the original implementation does not repeat the numbers as the algorithm defines.<|eoopr|><|sor|>Yes. I can 100% guarantee it that there's software out there relying on the repeatable nature of the prng, and for good, purposeful reason. <|eor|><|sor|>That's why if you really need that you should own the code. A LCG is pretty simple to implement, and if you're feeling fancy you can roll your own MT and make sure its parameters stay the same.<|eor|><|sor|>But that's absurd. Being predictably random is literally one of the primary qualities of a prng. It's the point of them. That it exposes the ability to provide a seed is putting this functionality as part of the interface, because otherwise there's no point to it.
This is php, and having to question the basic contracts of your standard library is actually par for the course, but that doesn't make it right. Some bugs you just can't fix. <|eor|><|eols|><|endoftext|> | 11 |
lolphp | ilogik | d04wvip | <|sols|><|sot|>Typofixing commit in Mersenne twister RNG code is reverted (because code might depend on it)<|eot|><|sol|>https://github.com/php/php-src/commit/a0724d30817600540946b41e40f4cfc2a0c30f80<|eol|><|sor|>Why remove the test, instead of changing it to match the current output? <|eor|><|eols|><|endoftext|> | 9 |
lolphp | the_alias_of_andrea | d0552tb | <|sols|><|sot|>Typofixing commit in Mersenne twister RNG code is reverted (because code might depend on it)<|eot|><|sol|>https://github.com/php/php-src/commit/a0724d30817600540946b41e40f4cfc2a0c30f80<|eol|><|sor|>Did anyone check the output of the broken Mersenne-Twister if it's even random?
(to the point that statistical tests exist that can check this)<|eor|><|sor|>Here's 10000 points plotted in a 256x256 square:
http://i.imgur.com/q2tkb9z.png
It looks fairly uniform. This isn't a proper test, though.
And here's the frequency of different results for `(mt_rand() % 256)`:
http://i.imgur.com/ZycBqTs.png
The standard deviation, according to Excel, is 61.034738.
Seems to fit the frequency test, then.
EDIT: /u/leighzaru did a better analysis: https://www.reddit.com/r/lolphp/comments/46fxi8/typofixing_commit_in_mersenne_twister_rng_code_is/d05zwgg<|eor|><|eols|><|endoftext|> | 9 |
lolphp | maweki | d05b6ik | <|sols|><|sot|>Typofixing commit in Mersenne twister RNG code is reverted (because code might depend on it)<|eot|><|sol|>https://github.com/php/php-src/commit/a0724d30817600540946b41e40f4cfc2a0c30f80<|eol|><|sor|>Why remove the test, instead of changing it to match the current output? <|eor|><|sor|>I've gone and restored the test, but with the current output: https://github.com/php/php-src/commit/a50c31da1917bb07b3c11f229125ab8d1f0b9b70<|eor|><|soopr|>> this test actually checks to make sure that PHP's behaviour is wrong, but consistently so
Instead of the usual inconsistently (but persistently) wrong behavior <|eoopr|><|eols|><|endoftext|> | 9 |
lolphp | LeThrownAway | d051iq5 | <|sols|><|sot|>Typofixing commit in Mersenne twister RNG code is reverted (because code might depend on it)<|eot|><|sol|>https://github.com/php/php-src/commit/a0724d30817600540946b41e40f4cfc2a0c30f80<|eol|><|sor|>https://xkcd.com/1172/<|eor|><|eols|><|endoftext|> | 8 |
lolphp | leighzaru | d05zwgg | <|sols|><|sot|>Typofixing commit in Mersenne twister RNG code is reverted (because code might depend on it)<|eot|><|sol|>https://github.com/php/php-src/commit/a0724d30817600540946b41e40f4cfc2a0c30f80<|eol|><|sor|>Did anyone check the output of the broken Mersenne-Twister if it's even random?
(to the point that statistical tests exist that can check this)<|eor|><|sor|>you can do it youareself
https://www.fourmilab.ch/random/<|eor|><|sor|>I ran formilab's entropy measuring program over a gigabyte of data from `mt_rand()` both with and without the proposed fix, just for a quick analysis of whether randomness seems to be severely impared. This obviously isn't enough to measure whether the period (2**19937 - 1) is affected, but does give an indication of whether the output is suitable as a general purpose PRNG.
The tests were made using a simple program to convert a series of 31 bit outputs from PHP's `mt_rand()` into a stream of complete bytes. Results are below, but the upshot is, they both appear to be equally random.
<?php
$bytes = 1024 * 1024 * 1024;
$bits = 0;
$buffer = 0;
while ($bytes -= 4) {
while ($bits < 32) {
$buffer |= (mt_rand() << $bits);
$bits += 31;
}
print pack('V', $buffer);
$buffer >>= 32;
$bits -= 32;
}
**Current implementation**
$ ~/php-src/sapi/cli/php mt_stream.php | random/ent
Entropy = 8.000000 bits per byte.
Optimum compression would reduce the size
of this 1073741824 byte file by 0 percent.
Chi square distribution for 1073741824 samples is 265.41, and randomly
would exceed this value 31.40 percent of the times.
Arithmetic mean value of data bytes is 127.5014 (127.5 = random).
Monte Carlo value for Pi is 3.141541053 (error 0.00 percent).
Serial correlation coefficient is -0.000043 (totally uncorrelated = 0.0).
**Correct implementation**
$ ~/php-src/sapi/cli/php mt_stream.php | random/ent
Entropy = 8.000000 bits per byte.
Optimum compression would reduce the size
of this 1073741824 byte file by 0 percent.
Chi square distribution for 1073741824 samples is 229.13, and randomly
would exceed this value 87.64 percent of the times.
Arithmetic mean value of data bytes is 127.5006 (127.5 = random).
Monte Carlo value for Pi is 3.141650264 (error 0.00 percent).
Serial correlation coefficient is 0.000017 (totally uncorrelated = 0.0).<|eor|><|eols|><|endoftext|> | 8 |
lolphp | the_alias_of_andrea | d05q7y4 | <|sols|><|sot|>Typofixing commit in Mersenne twister RNG code is reverted (because code might depend on it)<|eot|><|sol|>https://github.com/php/php-src/commit/a0724d30817600540946b41e40f4cfc2a0c30f80<|eol|><|sor|>Did anyone check the output of the broken Mersenne-Twister if it's even random?
(to the point that statistical tests exist that can check this)<|eor|><|sor|>For some time it didn't return even numbers so I guess there is a bit of bias in that regard, aside from that not really sure.<|eor|><|sor|>Judging by 3v4l, it's always returned even and odd numbers. Are you thinking of the issue when scaling up the number? (it's only a 32-bit Mersenne Twister implementation, so if you ask for anything larger, it gets scaled up by multiplication, thus you may get only even numbers with a multiple-of-two factor)<|eor|><|eols|><|endoftext|> | 5 |
lolphp | Scaliwag | d056ahl | <|sols|><|sot|>Typofixing commit in Mersenne twister RNG code is reverted (because code might depend on it)<|eot|><|sol|>https://github.com/php/php-src/commit/a0724d30817600540946b41e40f4cfc2a0c30f80<|eol|><|sor|>This commit is unfortunately not wrong. Producing repeatable sequences of pseudorandom numbers is an important part of a PRNG's job. It's time for another real_. <|eor|><|soopr|>Repeatable in the sense that the original implementation does not repeat the numbers as the algorithm defines.<|eoopr|><|sor|>Yes. I can 100% guarantee it that there's software out there relying on the repeatable nature of the prng, and for good, purposeful reason. <|eor|><|sor|>That's why if you really need that you should own the code. A LCG is pretty simple to implement, and if you're feeling fancy you can roll your own MT and make sure its parameters stay the same.<|eor|><|sor|>But that's what libraries are for. You're not going to rewrite something that can be as fiddly and critical as a PRNG if you can help it. <|eor|><|sor|>Well yes, if it allows you to configure the constants of the PRNG then I guess it's ok. Said that a LCG is one line to implement, and while a bit worse than MT, it's still better than a MT you don't have control over, *if consistent results are that critical for you*.<|eor|><|eols|><|endoftext|> | 5 |
lolphp | jdiez17 | 27tvkw | <|sols|><|sot|>Code coverage: 0.3%. Expected Test Failures: 40. Test Failures: 103. Build Status: OK<|eot|><|sol|>http://gcov.php.net/viewer.php?version=PHP_5_6<|eol|><|eols|><|endoftext|> | 88 |
lolphp | captainramen | ci4kpew | <|sols|><|sot|>Code coverage: 0.3%. Expected Test Failures: 40. Test Failures: 103. Build Status: OK<|eot|><|sol|>http://gcov.php.net/viewer.php?version=PHP_5_6<|eol|><|sor|>It's a (display) bug. They are working on it.
http://marc.info/?t=140191255500004&r=1&w=2
<|eor|><|sor|>Let me guess, that page is written in php<|eor|><|eols|><|endoftext|> | 29 |
lolphp | ajmarks | ci4dwfm | <|sols|><|sot|>Code coverage: 0.3%. Expected Test Failures: 40. Test Failures: 103. Build Status: OK<|eot|><|sol|>http://gcov.php.net/viewer.php?version=PHP_5_6<|eol|><|sor|>Hey, in their defense they exceeded the number of expected failures by less than 200%, so that's something novel and unexpected.<|eor|><|eols|><|endoftext|> | 23 |
lolphp | ajmarks | ci4sr40 | <|sols|><|sot|>Code coverage: 0.3%. Expected Test Failures: 40. Test Failures: 103. Build Status: OK<|eot|><|sol|>http://gcov.php.net/viewer.php?version=PHP_5_6<|eol|><|sor|>The actual code coverage is 70%, as listed on http://gcov.php.net/viewer.php?version=PHP_5_4. The display for the newer versions is just broken.
It should also be pointed out that many gcov failures are just incorrect configuration of the test environment (nobody bothers to fix that up). PHP's main CI is Travis, where all tests should pass. Gcov is there to run some heavy tests like memory error detection (which can easily take a whole day for a single build).
Of course it would be nice to fix gcov to pass all tests as well.<|eor|><|sor|>> The actual code coverage is 70%
Not actually any better.<|eor|><|sor|>Have an upvote. 70% coverage is fine for some random internal enterprise application. It is not ok for a jumbo jet. I am unsure why people think language design is closer to the former rather than the latter.<|eor|><|sor|>Because dude like php is just something rassledazzle through together for his personal homepage. Like, it's not fair to expect to like reliable or reasonable over a dozen years later. <|eor|><|eols|><|endoftext|> | 19 |
lolphp | nikic | ci4mn75 | <|sols|><|sot|>Code coverage: 0.3%. Expected Test Failures: 40. Test Failures: 103. Build Status: OK<|eot|><|sol|>http://gcov.php.net/viewer.php?version=PHP_5_6<|eol|><|sor|>The actual code coverage is 70%, as listed on http://gcov.php.net/viewer.php?version=PHP_5_4. The display for the newer versions is just broken.
It should also be pointed out that many gcov failures are just incorrect configuration of the test environment (nobody bothers to fix that up). PHP's main CI is Travis, where all tests should pass. Gcov is there to run some heavy tests like memory error detection (which can easily take a whole day for a single build).
Of course it would be nice to fix gcov to pass all tests as well.<|eor|><|eols|><|endoftext|> | 17 |
lolphp | captainramen | ci4skp0 | <|sols|><|sot|>Code coverage: 0.3%. Expected Test Failures: 40. Test Failures: 103. Build Status: OK<|eot|><|sol|>http://gcov.php.net/viewer.php?version=PHP_5_6<|eol|><|sor|>The actual code coverage is 70%, as listed on http://gcov.php.net/viewer.php?version=PHP_5_4. The display for the newer versions is just broken.
It should also be pointed out that many gcov failures are just incorrect configuration of the test environment (nobody bothers to fix that up). PHP's main CI is Travis, where all tests should pass. Gcov is there to run some heavy tests like memory error detection (which can easily take a whole day for a single build).
Of course it would be nice to fix gcov to pass all tests as well.<|eor|><|sor|>> The actual code coverage is 70%
Not actually any better.<|eor|><|sor|>Have an upvote. 70% coverage is fine for some random internal enterprise application. It is not ok for a jumbo jet. I am unsure why people think language design is closer to the former rather than the latter.<|eor|><|eols|><|endoftext|> | 17 |
lolphp | cbraga | ci4quva | <|sols|><|sot|>Code coverage: 0.3%. Expected Test Failures: 40. Test Failures: 103. Build Status: OK<|eot|><|sol|>http://gcov.php.net/viewer.php?version=PHP_5_6<|eol|><|sor|>The actual code coverage is 70%, as listed on http://gcov.php.net/viewer.php?version=PHP_5_4. The display for the newer versions is just broken.
It should also be pointed out that many gcov failures are just incorrect configuration of the test environment (nobody bothers to fix that up). PHP's main CI is Travis, where all tests should pass. Gcov is there to run some heavy tests like memory error detection (which can easily take a whole day for a single build).
Of course it would be nice to fix gcov to pass all tests as well.<|eor|><|sor|>> The actual code coverage is 70%
Not actually any better.<|eor|><|eols|><|endoftext|> | 15 |
lolphp | DoctorWaluigiTime | ci4gkrx | <|sols|><|sot|>Code coverage: 0.3%. Expected Test Failures: 40. Test Failures: 103. Build Status: OK<|eot|><|sol|>http://gcov.php.net/viewer.php?version=PHP_5_6<|eol|><|sor|>The code coverage metric doesn't bother me so much. Gotta start somewhere, after all.
Any "OK" status concerning failing tests greater than 0 is inexcusable, though.<|eor|><|eols|><|endoftext|> | 8 |
lolphp | Reddy360 | 31nnji | <|soss|><|sot|>So, I checked my error logs<|eot|><|sost|>PHP Warning: Unknown: function '-1' not found or invalid function name in Unknown on line 0<|eost|><|eoss|><|endoftext|> | 90 |
lolphp | cite-reader | cq3bvv1 | <|soss|><|sot|>So, I checked my error logs<|eot|><|sost|>PHP Warning: Unknown: function '-1' not found or invalid function name in Unknown on line 0<|eost|><|sor|>I... wait... *What?*
***How?***
(Brain explodes.)
----
Actually, it could be variable-function redirection.
<?php
function hi()
{?><b>Hello!</b><?php}
// ...
$func = 'hi'; // Replace w/ '-1' to [probably] replicate the given error.
// ...
$func();
?><|eor|><|sor|>Nah, can't be that. "Unknown on line 0" indicates the warning was generated internally to the engine; if you have warnings in ini files and the appropriate error reporting level, you'll see the same thing when you're initializing.
Calling a nonexistent function is a fatal error, anyway. To get this kind of thing as a warning... I dunno. Something has gone *especially* awry here.<|eor|><|eoss|><|endoftext|> | 24 |
lolphp | redfacedquark | cq3eaoo | <|soss|><|sot|>So, I checked my error logs<|eot|><|sost|>PHP Warning: Unknown: function '-1' not found or invalid function name in Unknown on line 0<|eost|><|sor|>I... wait... *What?*
***How?***
(Brain explodes.)
----
Actually, it could be variable-function redirection.
<?php
function hi()
{?><b>Hello!</b><?php}
// ...
$func = 'hi'; // Replace w/ '-1' to [probably] replicate the given error.
// ...
$func();
?><|eor|><|sor|>Nah, can't be that. "Unknown on line 0" indicates the warning was generated internally to the engine; if you have warnings in ini files and the appropriate error reporting level, you'll see the same thing when you're initializing.
Calling a nonexistent function is a fatal error, anyway. To get this kind of thing as a warning... I dunno. Something has gone *especially* awry here.<|eor|><|sor|>True.
This is... really odd.<|eor|><|sor|>True.
But this is...php<|eor|><|eoss|><|endoftext|> | 24 |
lolphp | OneWingedShark | cq39tx0 | <|soss|><|sot|>So, I checked my error logs<|eot|><|sost|>PHP Warning: Unknown: function '-1' not found or invalid function name in Unknown on line 0<|eost|><|sor|>I... wait... *What?*
***How?***
(Brain explodes.)
----
Actually, it could be variable-function redirection.
<?php
function hi()
{?><b>Hello!</b><?php}
// ...
$func = 'hi'; // Replace w/ '-1' to [probably] replicate the given error.
// ...
$func();
?><|eor|><|eoss|><|endoftext|> | 17 |
lolphp | fiskfisk | cq3en8j | <|soss|><|sot|>So, I checked my error logs<|eot|><|sost|>PHP Warning: Unknown: function '-1' not found or invalid function name in Unknown on line 0<|eost|><|sor|>I... wait... *What?*
***How?***
(Brain explodes.)
----
Actually, it could be variable-function redirection.
<?php
function hi()
{?><b>Hello!</b><?php}
// ...
$func = 'hi'; // Replace w/ '-1' to [probably] replicate the given error.
// ...
$func();
?><|eor|><|sor|>Nah, can't be that. "Unknown on line 0" indicates the warning was generated internally to the engine; if you have warnings in ini files and the appropriate error reporting level, you'll see the same thing when you're initializing.
Calling a nonexistent function is a fatal error, anyway. To get this kind of thing as a warning... I dunno. Something has gone *especially* awry here.<|eor|><|sor|>"Unknown on line 0" usually means "this callback was registered to be run outside of the normal request flow" where there no longer is an active connection to the browser, which usually is register_shutdown_function or something similar (ob_* etc.)<|eor|><|eoss|><|endoftext|> | 11 |
lolphp | OneWingedShark | cq3crft | <|soss|><|sot|>So, I checked my error logs<|eot|><|sost|>PHP Warning: Unknown: function '-1' not found or invalid function name in Unknown on line 0<|eost|><|sor|>I... wait... *What?*
***How?***
(Brain explodes.)
----
Actually, it could be variable-function redirection.
<?php
function hi()
{?><b>Hello!</b><?php}
// ...
$func = 'hi'; // Replace w/ '-1' to [probably] replicate the given error.
// ...
$func();
?><|eor|><|sor|>Nah, can't be that. "Unknown on line 0" indicates the warning was generated internally to the engine; if you have warnings in ini files and the appropriate error reporting level, you'll see the same thing when you're initializing.
Calling a nonexistent function is a fatal error, anyway. To get this kind of thing as a warning... I dunno. Something has gone *especially* awry here.<|eor|><|sor|>True.
This is... really odd.<|eor|><|eoss|><|endoftext|> | 9 |
lolphp | shvelo | cq3wv5f | <|soss|><|sot|>So, I checked my error logs<|eot|><|sost|>PHP Warning: Unknown: function '-1' not found or invalid function name in Unknown on line 0<|eost|><|sor|>I... wait... *What?*
***How?***
(Brain explodes.)
----
Actually, it could be variable-function redirection.
<?php
function hi()
{?><b>Hello!</b><?php}
// ...
$func = 'hi'; // Replace w/ '-1' to [probably] replicate the given error.
// ...
$func();
?><|eor|><|sor|>I didn't know you could embed HTML in a function, eww<|eor|><|eoss|><|endoftext|> | 7 |
lolphp | OneWingedShark | cq42s9i | <|soss|><|sot|>So, I checked my error logs<|eot|><|sost|>PHP Warning: Unknown: function '-1' not found or invalid function name in Unknown on line 0<|eost|><|sor|>I... wait... *What?*
***How?***
(Brain explodes.)
----
Actually, it could be variable-function redirection.
<?php
function hi()
{?><b>Hello!</b><?php}
// ...
$func = 'hi'; // Replace w/ '-1' to [probably] replicate the given error.
// ...
$func();
?><|eor|><|sor|>I didn't know you could embed HTML in a function, eww<|eor|><|sor|>Yes, yes you can.
(And yes, eww.)<|eor|><|eoss|><|endoftext|> | 5 |
lolphp | rifter5000 | cqa68za | <|soss|><|sot|>So, I checked my error logs<|eot|><|sost|>PHP Warning: Unknown: function '-1' not found or invalid function name in Unknown on line 0<|eost|><|sor|>I... wait... *What?*
***How?***
(Brain explodes.)
----
Actually, it could be variable-function redirection.
<?php
function hi()
{?><b>Hello!</b><?php}
// ...
$func = 'hi'; // Replace w/ '-1' to [probably] replicate the given error.
// ...
$func();
?><|eor|><|sor|>I didn't know you could embed HTML in a function, eww<|eor|><|sor|>You can embed HTML everywhere. <|eor|><|eoss|><|endoftext|> | 5 |
lolphp | petdance | qeq7k | <|sols|><|sot|>PHP 5.4.0 ships with 82 failing tests in the suite. Why bother having a test suite at all?<|eot|><|sol|>http://gcov.php.net/viewer.php?version=PHP_5_4<|eol|><|eols|><|endoftext|> | 90 |
lolphp | petdance | c3x1hkx | <|sols|><|sot|>PHP 5.4.0 ships with 82 failing tests in the suite. Why bother having a test suite at all?<|eot|><|sol|>http://gcov.php.net/viewer.php?version=PHP_5_4<|eol|><|sor|>Of which are 44 "expected" test failures. Sometimes, you need this. But not when your tests are triggering segfaults on script execution.
Yes.
They mark segfault bugs as "expected".<|eor|><|soopr|>Looks to me that the 44 expected are not included in the 82 test failures.
http://gcov.php.net/viewer.php?version=PHP_5_4&func=expected_tests
vs.
http://gcov.php.net/viewer.php?version=PHP_5_4&func=tests<|eoopr|><|eols|><|endoftext|> | 24 |
lolphp | petdance | c3x6u7a | <|sols|><|sot|>PHP 5.4.0 ships with 82 failing tests in the suite. Why bother having a test suite at all?<|eot|><|sol|>http://gcov.php.net/viewer.php?version=PHP_5_4<|eol|><|sor|>I think you're being unfair, or in the least, you didn't investigate it much.
Here's the results of investigating just a few of the [failures](http://gcov.php.net/viewer.php?version=PHP_5_4&func=tests):
* less than 20 are php core (the rest are extensions)
* only 1 in the lot is for the Zend engine, and it actually [looks like a segfault fix](http://gcov.php.net/viewer.php?version=PHP_5_4&func=tests&file=Zend%2Ftests%2Fbug55509.phpt) (so the test probably needs to be updated for regressions)
* 5 are for the new CLI server, and AFAICT, 4 actually look like misconfigured tests and the last looks like another possible [segfault bug fix](http://gcov.php.net/viewer.php?version=PHP_5_4&func=tests&file=sapi%2Fcli%2Ftests%2Fphp_cli_server_014.phpt).
* of the extensions, many are exts I've very rarely, if ever, used in over 5 years of PHP: dba, imap, interbase, intl, ldap, mysqli, oci8, odbc, pdo_firebird, snmp, wddx, and pdo_odbc (which has 22...unixODBC and IBM DB2? blegh).
* [this core failure](http://gcov.php.net/viewer.php?version=PHP_5_4&func=tests&file=tests%2Ffunc%2F010.phpt) looks like it could be a test setup (permissions) problem, but not sure...
I'll stop there, but I'm not seeing anything too alarming. Also, it was [talked](http://markmail.org/message/5bomcxgysp3v4re2?q=list:net%2Ephp%2Elists%2Einternals+lerdorf+tests+from:%22Rasmus+Lerdorf%22+order:date-backward&page=7) about [quite a bit](http://markmail.org/thread/5uzvfvnptmdoyn4j#query:+page:1+mid:vnu6sn6hdkzfy7yk+state:results) before release. Consesus I think was that most tests were bogus, outdated, or otherwise not worth the effort. Considering that it's a fully-volunteer operation, you have to focus your efforts where it counts.
Personally, I'm happy about all of the love that Zend Engine got (Zeev was mostly responsible, I think) and that the time wasn't instead spent chasing dragons in _some\_random\_extension_.
EDIT: Oops, sorry, didn't realize this was r/lolphp. I guess you guys are just looking for reasons to bash them.<|eor|><|soopr|>> less than 20 are php core
Fine. I could change the headline to "PHP 5.4.0 ships with 20 failing tests in the core. Why bother having a test suite at all?"
The only valid number of failing tests to ship with is zero.
> I guess you guys are just looking for reasons to bash them.
I'm not bashing them. I'm pointing out facts. I hardly had to look for this.<|eoopr|><|eols|><|endoftext|> | 23 |
lolphp | rdude | c3xxe1c | <|sols|><|sot|>PHP 5.4.0 ships with 82 failing tests in the suite. Why bother having a test suite at all?<|eot|><|sol|>http://gcov.php.net/viewer.php?version=PHP_5_4<|eol|><|sor|>Hey, at least it's an improvement from 5.3.0:
http://gcov.php.net/viewer.php?version=PHP_5_3
>**Compile Errors:** 1
The real magic is that any of the tests *passed*.<|eor|><|eols|><|endoftext|> | 11 |
lolphp | petdance | c3x7ble | <|sols|><|sot|>PHP 5.4.0 ships with 82 failing tests in the suite. Why bother having a test suite at all?<|eot|><|sol|>http://gcov.php.net/viewer.php?version=PHP_5_4<|eol|><|sor|>I think you're being unfair, or in the least, you didn't investigate it much.
Here's the results of investigating just a few of the [failures](http://gcov.php.net/viewer.php?version=PHP_5_4&func=tests):
* less than 20 are php core (the rest are extensions)
* only 1 in the lot is for the Zend engine, and it actually [looks like a segfault fix](http://gcov.php.net/viewer.php?version=PHP_5_4&func=tests&file=Zend%2Ftests%2Fbug55509.phpt) (so the test probably needs to be updated for regressions)
* 5 are for the new CLI server, and AFAICT, 4 actually look like misconfigured tests and the last looks like another possible [segfault bug fix](http://gcov.php.net/viewer.php?version=PHP_5_4&func=tests&file=sapi%2Fcli%2Ftests%2Fphp_cli_server_014.phpt).
* of the extensions, many are exts I've very rarely, if ever, used in over 5 years of PHP: dba, imap, interbase, intl, ldap, mysqli, oci8, odbc, pdo_firebird, snmp, wddx, and pdo_odbc (which has 22...unixODBC and IBM DB2? blegh).
* [this core failure](http://gcov.php.net/viewer.php?version=PHP_5_4&func=tests&file=tests%2Ffunc%2F010.phpt) looks like it could be a test setup (permissions) problem, but not sure...
I'll stop there, but I'm not seeing anything too alarming. Also, it was [talked](http://markmail.org/message/5bomcxgysp3v4re2?q=list:net%2Ephp%2Elists%2Einternals+lerdorf+tests+from:%22Rasmus+Lerdorf%22+order:date-backward&page=7) about [quite a bit](http://markmail.org/thread/5uzvfvnptmdoyn4j#query:+page:1+mid:vnu6sn6hdkzfy7yk+state:results) before release. Consesus I think was that most tests were bogus, outdated, or otherwise not worth the effort. Considering that it's a fully-volunteer operation, you have to focus your efforts where it counts.
Personally, I'm happy about all of the love that Zend Engine got (Zeev was mostly responsible, I think) and that the time wasn't instead spent chasing dragons in _some\_random\_extension_.
EDIT: Oops, sorry, didn't realize this was r/lolphp. I guess you guys are just looking for reasons to bash them.<|eor|><|soopr|>> less than 20 are php core
Fine. I could change the headline to "PHP 5.4.0 ships with 20 failing tests in the core. Why bother having a test suite at all?"
The only valid number of failing tests to ship with is zero.
> I guess you guys are just looking for reasons to bash them.
I'm not bashing them. I'm pointing out facts. I hardly had to look for this.<|eoopr|><|sor|>Eh, they could just delete the tests if it'd make you feel any better, but that wouldn't change the quality of the code in any way. It'd actually probably make it worse in the long run.
Do you use PHP?<|eor|><|soopr|>> Do you use PHP?
Unfortunately, yes.<|eoopr|><|eols|><|endoftext|> | 11 |
lolphp | ealf | c3xcvh4 | <|sols|><|sot|>PHP 5.4.0 ships with 82 failing tests in the suite. Why bother having a test suite at all?<|eot|><|sol|>http://gcov.php.net/viewer.php?version=PHP_5_4<|eol|><|sor|>http://gcov.php.net/viewer.php?version=PHP_5_4&func=tests&file=ext%2Fcurl%2Ftests%2Fcurl_file_deleted_before_curl_close.phpt
Wow<|eor|><|eols|><|endoftext|> | 9 |
lolphp | big_trike | c3z0vva | <|sols|><|sot|>PHP 5.4.0 ships with 82 failing tests in the suite. Why bother having a test suite at all?<|eot|><|sol|>http://gcov.php.net/viewer.php?version=PHP_5_4<|eol|><|sor|>I've never had all tests pass in the 11 years I've been using PHP.<|eor|><|eols|><|endoftext|> | 8 |
lolphp | Takeoded | epjogv | <|sols|><|sot|>php should add DateTime::REAL_ISO8601<|eot|><|sol|>https://i.redd.it/3va17h6uc5b41.png<|eol|><|eols|><|endoftext|> | 87 |
lolphp | Takeoded | fejqm00 | <|sols|><|sot|>php should add DateTime::REAL_ISO8601<|eot|><|sol|>https://i.redd.it/3va17h6uc5b41.png<|eol|><|soopr|>(.. i just had to write a bugreport explaining why one should not use PHP's DateTime::ISO8601)<|eoopr|><|eols|><|endoftext|> | 21 |
lolphp | sproingie | felu01n | <|sols|><|sot|>php should add DateTime::REAL_ISO8601<|eot|><|sol|>https://i.redd.it/3va17h6uc5b41.png<|eol|><|sor|>Even better, `DateTime::ATOM` can't parse microseconds in the timestamp. So look forward to `DateTime::REAL_ATOM` sometime.<|eor|><|eols|><|endoftext|> | 21 |
lolphp | badmonkey0001 | fekk1iy | <|sols|><|sot|>php should add DateTime::REAL_ISO8601<|eot|><|sol|>https://i.redd.it/3va17h6uc5b41.png<|eol|><|sor|>ISO 8601 has had 5 major revisions over the past 22 years. It's a moving target. 8061 also contains multiple standardized formats, [which do not always agree](https://devland.at/a/iso-8601-dates-in-php-and-browsers).
> The first edition of the ISO 8601 standard was published as ISO 8601:1988 in 1988. It unified and replaced a number of older ISO standards on various aspects of date and time notation: ISO 2014, ISO 2015, ISO 2711, ISO 3307, and ISO 4031.[3] It has been superseded by a second edition ISO 8601:2000 in 2000, by a third edition ISO 8601:2004 published on 1 December 2004, and withdrawn and revised by ISO 8601-1:2019 and ISO 8601-2:2019 on 25 February 2019 (or: 2019-02-25). ISO 8601 was prepared by,[4] and is under the direct responsibility of, ISO Technical Committee TC 154.[5]
https://en.wikipedia.org/wiki/ISO_8601#History<|eor|><|sor|>Thats irrelevant. PHP is not compatible with any spec, new or old. Its just called that because some php dev had heard it somewere else, or seen it in some other language. Copied the name, not the behavior in a typical php fashion.<|eor|><|sor|>You got a source on that or are you just speculating?<|eor|><|eols|><|endoftext|> | 14 |
lolphp | badmonkey0001 | fekcmaa | <|sols|><|sot|>php should add DateTime::REAL_ISO8601<|eot|><|sol|>https://i.redd.it/3va17h6uc5b41.png<|eol|><|sor|>ISO 8601 has had 5 major revisions over the past 22 years. It's a moving target. 8061 also contains multiple standardized formats, [which do not always agree](https://devland.at/a/iso-8601-dates-in-php-and-browsers).
> The first edition of the ISO 8601 standard was published as ISO 8601:1988 in 1988. It unified and replaced a number of older ISO standards on various aspects of date and time notation: ISO 2014, ISO 2015, ISO 2711, ISO 3307, and ISO 4031.[3] It has been superseded by a second edition ISO 8601:2000 in 2000, by a third edition ISO 8601:2004 published on 1 December 2004, and withdrawn and revised by ISO 8601-1:2019 and ISO 8601-2:2019 on 25 February 2019 (or: 2019-02-25). ISO 8601 was prepared by,[4] and is under the direct responsibility of, ISO Technical Committee TC 154.[5]
https://en.wikipedia.org/wiki/ISO_8601#History<|eor|><|soopr|>Does anyone of them allow specifying hhmm without separating hh and mm with : ? I believe the answer is no, and if the answer actually is no, then PHP's DateTime::ISO8601 is incompatible with everything single one of them...<|eoopr|><|sor|>That's basic format rather than extended format.
> 4.2.2.2 Complete representations
> When the application identifies the need for an expression of local time then the complete representation shall be a single numeric expression comprising six digits in the basic format, where [hh]
represents hours, [mm] minutes and [ss] seconds.
> Basic format: hhmmss Example: 232050
> Extended format: hh:mm:ss Example: 23:20:50
http://www.loc.gov/standards/datetime/iso-tc154-wg5_n0038_iso_wd_8601-1_2016-02-16.pdf<|eor|><|eols|><|endoftext|> | 13 |
lolphp | badmonkey0001 | fekbwwf | <|sols|><|sot|>php should add DateTime::REAL_ISO8601<|eot|><|sol|>https://i.redd.it/3va17h6uc5b41.png<|eol|><|sor|>ISO 8601 has had 5 major revisions over the past 22 years. It's a moving target. 8061 also contains multiple standardized formats, [which do not always agree](https://devland.at/a/iso-8601-dates-in-php-and-browsers).
> The first edition of the ISO 8601 standard was published as ISO 8601:1988 in 1988. It unified and replaced a number of older ISO standards on various aspects of date and time notation: ISO 2014, ISO 2015, ISO 2711, ISO 3307, and ISO 4031.[3] It has been superseded by a second edition ISO 8601:2000 in 2000, by a third edition ISO 8601:2004 published on 1 December 2004, and withdrawn and revised by ISO 8601-1:2019 and ISO 8601-2:2019 on 25 February 2019 (or: 2019-02-25). ISO 8601 was prepared by,[4] and is under the direct responsibility of, ISO Technical Committee TC 154.[5]
https://en.wikipedia.org/wiki/ISO_8601#History<|eor|><|eols|><|endoftext|> | 9 |
lolphp | orondf343 | fekw98e | <|sols|><|sot|>php should add DateTime::REAL_ISO8601<|eot|><|sol|>https://i.redd.it/3va17h6uc5b41.png<|eol|><|sor|>r/iso8601<|eor|><|eols|><|endoftext|> | 8 |
lolphp | Miserable_Fuck | feldr5o | <|sols|><|sot|>php should add DateTime::REAL_ISO8601<|eot|><|sol|>https://i.redd.it/3va17h6uc5b41.png<|eol|><|sor|>ISO 8601 has had 5 major revisions over the past 22 years. It's a moving target. 8061 also contains multiple standardized formats, [which do not always agree](https://devland.at/a/iso-8601-dates-in-php-and-browsers).
> The first edition of the ISO 8601 standard was published as ISO 8601:1988 in 1988. It unified and replaced a number of older ISO standards on various aspects of date and time notation: ISO 2014, ISO 2015, ISO 2711, ISO 3307, and ISO 4031.[3] It has been superseded by a second edition ISO 8601:2000 in 2000, by a third edition ISO 8601:2004 published on 1 December 2004, and withdrawn and revised by ISO 8601-1:2019 and ISO 8601-2:2019 on 25 February 2019 (or: 2019-02-25). ISO 8601 was prepared by,[4] and is under the direct responsibility of, ISO Technical Committee TC 154.[5]
https://en.wikipedia.org/wiki/ISO_8601#History<|eor|><|sor|>Thats irrelevant. PHP is not compatible with any spec, new or old. Its just called that because some php dev had heard it somewere else, or seen it in some other language. Copied the name, not the behavior in a typical php fashion.<|eor|><|sor|>You got a source on that or are you just speculating?<|eor|><|sor|>No source. IIRC there was some discussion about this waaay back. They decided no one would care and kept it. This is what PHP has done and is doing still. Bugs are upgraded to features and cruft and old baggage keep piling up. In the end, its all just a messy bag of crap.<|eor|><|sor|>How long ago was this?<|eor|><|eols|><|endoftext|> | 8 |
lolphp | CarnivorousSociety | fek3t7d | <|sols|><|sot|>php should add DateTime::REAL_ISO8601<|eot|><|sol|>https://i.redd.it/3va17h6uc5b41.png<|eol|><|soopr|>(.. i just had to write a bugreport explaining why one should not use PHP's DateTime::ISO8601)<|eoopr|><|sor|>Should link it<|eor|><|eols|><|endoftext|> | 6 |
lolphp | sproingie | femwqvj | <|sols|><|sot|>php should add DateTime::REAL_ISO8601<|eot|><|sol|>https://i.redd.it/3va17h6uc5b41.png<|eol|><|sor|>ISO 8601 has had 5 major revisions over the past 22 years. It's a moving target. 8061 also contains multiple standardized formats, [which do not always agree](https://devland.at/a/iso-8601-dates-in-php-and-browsers).
> The first edition of the ISO 8601 standard was published as ISO 8601:1988 in 1988. It unified and replaced a number of older ISO standards on various aspects of date and time notation: ISO 2014, ISO 2015, ISO 2711, ISO 3307, and ISO 4031.[3] It has been superseded by a second edition ISO 8601:2000 in 2000, by a third edition ISO 8601:2004 published on 1 December 2004, and withdrawn and revised by ISO 8601-1:2019 and ISO 8601-2:2019 on 25 February 2019 (or: 2019-02-25). ISO 8601 was prepared by,[4] and is under the direct responsibility of, ISO Technical Committee TC 154.[5]
https://en.wikipedia.org/wiki/ISO_8601#History<|eor|><|sor|>Most languages have a date library that fixes bugs, not maintains them for all time in the name of compatibility. Carbon is a good start with PHP, but it still inherits the misbehaviors from \DateTime from which it inherits.<|eor|><|eols|><|endoftext|> | 6 |
lolphp | grimnebulin | 3cswmr | <|sols|><|sot|>Here's one that's been sitting on my desktop for awhile I like to call it "February doesn't count"<|eot|><|sol|>http://i.imgur.com/CAkt9S5.png<|eol|><|eols|><|endoftext|> | 88 |
lolphp | galaktos | csyv7ww | <|sols|><|sot|>Here's one that's been sitting on my desktop for awhile I like to call it "February doesn't count"<|eot|><|sol|>http://i.imgur.com/CAkt9S5.png<|eol|><|sor|>https://secure.php.net/manual/en/datetime.createfromformat.php
If format does not contain the character ! then portions of the generated time which are not specified in format will be set to the current system time.
If format contains the character !, then portions of the generated time not provided in format, as well as values to the left-hand side of the !, will be set to corresponding values from the Unix epoch.
var_dump(DateTime::createFromFormat('!n', '2'));<|eor|><|sor|>> secure.php.net
A separate subdomain for HTTPS? Is that still a thing that we do? Okay then.<|eor|><|eols|><|endoftext|> | 25 |
lolphp | soIheard | csymi55 | <|sols|><|sot|>Here's one that's been sitting on my desktop for awhile I like to call it "February doesn't count"<|eot|><|sol|>http://i.imgur.com/CAkt9S5.png<|eol|><|sor|>https://secure.php.net/manual/en/datetime.createfromformat.php
If format does not contain the character ! then portions of the generated time which are not specified in format will be set to the current system time.
If format contains the character !, then portions of the generated time not provided in format, as well as values to the left-hand side of the !, will be set to corresponding values from the Unix epoch.
var_dump(DateTime::createFromFormat('!n', '2'));<|eor|><|eols|><|endoftext|> | 21 |
lolphp | Rhomboid | csyoynt | <|sols|><|sot|>Here's one that's been sitting on my desktop for awhile I like to call it "February doesn't count"<|eot|><|sol|>http://i.imgur.com/CAkt9S5.png<|eol|><|sor|>It's setting the day to 30 in each case, and 2-30 is normalized to 3-2. You must have run this on the 30th day of the month. The documentation does say that it sets fields without format specifiers to the current values. It's a rather contrived example because the idea of creating a Datetime from only a month is complete nonsense. We can certainly ding PHP for allowing that to happen without complaining.<|eor|><|eols|><|endoftext|> | 13 |
lolphp | grimnebulin | csyp5bs | <|sols|><|sot|>Here's one that's been sitting on my desktop for awhile I like to call it "February doesn't count"<|eot|><|sol|>http://i.imgur.com/CAkt9S5.png<|eol|><|sor|>It's setting the day to 30 in each case, and 2-30 is normalized to 3-2. You must have run this on the 30th day of the month. The documentation does say that it sets fields without format specifiers to the current values. It's a rather contrived example because the idea of creating a Datetime from only a month is complete nonsense. We can certainly ding PHP for allowing that to happen without complaining.<|eor|><|soopr|>> We can certainly ding PHP for allowing that to happen without complaining.
That's the really unforgivable part, yes. Using the system time for unspecified portions of the generated time is documented behavior, if a bit surprising, but the happenstance makes this example a lot funnier than:
DateTime::createFromFormat('n d', '2 30')<|eoopr|><|eols|><|endoftext|> | 12 |
lolphp | galaktos | cszoax2 | <|sols|><|sot|>Here's one that's been sitting on my desktop for awhile I like to call it "February doesn't count"<|eot|><|sol|>http://i.imgur.com/CAkt9S5.png<|eol|><|sor|>https://secure.php.net/manual/en/datetime.createfromformat.php
If format does not contain the character ! then portions of the generated time which are not specified in format will be set to the current system time.
If format contains the character !, then portions of the generated time not provided in format, as well as values to the left-hand side of the !, will be set to corresponding values from the Unix epoch.
var_dump(DateTime::createFromFormat('!n', '2'));<|eor|><|sor|>> secure.php.net
A separate subdomain for HTTPS? Is that still a thing that we do? Okay then.<|eor|><|sor|>> Is that still a thing that we do?
- DENIC, `.de` registrar: https://www.secure.denic.de; `secure.denic.de` has no IP address and `denic.de` doesnt answer on port 443
- PIR, `.org` registrar: as far as I can tell, no HTTPS support *at all*
- Neustar, `.us` registrar: https://neustar.us/ sends certificate thats only valid for neustar**.biz**
If the fucking **registrars** cant get it right, who am I to criticize PHP for that shit? *slowly and sadly bangs head against desk*<|eor|><|eols|><|endoftext|> | 12 |
lolphp | ZiggyTheHamster | csyuixz | <|sols|><|sot|>Here's one that's been sitting on my desktop for awhile I like to call it "February doesn't count"<|eot|><|sol|>http://i.imgur.com/CAkt9S5.png<|eol|><|sor|>It's setting the day to 30 in each case, and 2-30 is normalized to 3-2. You must have run this on the 30th day of the month. The documentation does say that it sets fields without format specifiers to the current values. It's a rather contrived example because the idea of creating a Datetime from only a month is complete nonsense. We can certainly ding PHP for allowing that to happen without complaining.<|eor|><|soopr|>> We can certainly ding PHP for allowing that to happen without complaining.
That's the really unforgivable part, yes. Using the system time for unspecified portions of the generated time is documented behavior, if a bit surprising, but the happenstance makes this example a lot funnier than:
DateTime::createFromFormat('n d', '2 30')<|eoopr|><|sor|>I'd still argue that this is wrong behavior. Unspecified values should be initialized to sane values - thus giving you 2015-02-01 00:00:00.00 - and this is how it works in basically every other programming language. Ruby, for example:
2.2.0 :007 > Time.strptime('2', '%m')
=> 2015-02-01 00:00:00 -0800
You can, of course, change the default timezone behavior.<|eor|><|eols|><|endoftext|> | 12 |
lolphp | ZiggyTheHamster | csyv93t | <|sols|><|sot|>Here's one that's been sitting on my desktop for awhile I like to call it "February doesn't count"<|eot|><|sol|>http://i.imgur.com/CAkt9S5.png<|eol|><|sor|>It's setting the day to 30 in each case, and 2-30 is normalized to 3-2. You must have run this on the 30th day of the month. The documentation does say that it sets fields without format specifiers to the current values. It's a rather contrived example because the idea of creating a Datetime from only a month is complete nonsense. We can certainly ding PHP for allowing that to happen without complaining.<|eor|><|soopr|>> We can certainly ding PHP for allowing that to happen without complaining.
That's the really unforgivable part, yes. Using the system time for unspecified portions of the generated time is documented behavior, if a bit surprising, but the happenstance makes this example a lot funnier than:
DateTime::createFromFormat('n d', '2 30')<|eoopr|><|sor|>I'd still argue that this is wrong behavior. Unspecified values should be initialized to sane values - thus giving you 2015-02-01 00:00:00.00 - and this is how it works in basically every other programming language. Ruby, for example:
2.2.0 :007 > Time.strptime('2', '%m')
=> 2015-02-01 00:00:00 -0800
You can, of course, change the default timezone behavior.<|eor|><|soopr|>> I'd still argue that this is wrong behavior.
Well, it works as intended (i.e. the documentation matches up with the functionality) so it's not technically wrong behavior. Definitely a strange design decision though.<|eoopr|><|sor|>Yeah, but "works as intended" "works as expected"<|eor|><|eols|><|endoftext|> | 12 |
lolphp | Kwpolska | ct0jh9e | <|sols|><|sot|>Here's one that's been sitting on my desktop for awhile I like to call it "February doesn't count"<|eot|><|sol|>http://i.imgur.com/CAkt9S5.png<|eol|><|sor|>It's setting the day to 30 in each case, and 2-30 is normalized to 3-2. You must have run this on the 30th day of the month. The documentation does say that it sets fields without format specifiers to the current values. It's a rather contrived example because the idea of creating a Datetime from only a month is complete nonsense. We can certainly ding PHP for allowing that to happen without complaining.<|eor|><|soopr|>> We can certainly ding PHP for allowing that to happen without complaining.
That's the really unforgivable part, yes. Using the system time for unspecified portions of the generated time is documented behavior, if a bit surprising, but the happenstance makes this example a lot funnier than:
DateTime::createFromFormat('n d', '2 30')<|eoopr|><|sor|>I'd still argue that this is wrong behavior. Unspecified values should be initialized to sane values - thus giving you 2015-02-01 00:00:00.00 - and this is how it works in basically every other programming language. Ruby, for example:
2.2.0 :007 > Time.strptime('2', '%m')
=> 2015-02-01 00:00:00 -0800
You can, of course, change the default timezone behavior.<|eor|><|sor|>Interface that _allows_ you to create incorrect dates (like 30.02.2015) without any complaint is broken by design. Look, how python handles this:
You can't create `datetime` without specifying year and day:
>>> datetime.datetime(month=12)
TypeError: Required argument 'year' (pos 1) not found
And it forbids creating 30.02 dates (because they do not exist):
>>> datetime.datetime(2015, 02, 30)
ValueError: day is out of range for month
>>> datetime.datetime.strptime('30 2', '%d %m')
ValueError: day is out of range for month
UPD: You better explain, why PHP allows to use '42' as a day, but not '111' (probably because it doesn't expect three digits as day number):
php -r "var_dump(DateTime::createFromFormat('n d', '2 100'));"
bool(false)
php -r "var_dump(DateTime::createFromFormat('n d', '2 99'));"
object(DateTime)#1 (3) {
["date"]=>
string(26) "2015-05-10 22:44:48.000000"
["timezone_type"]=>
int(3)
["timezone"]=>
string(3) "UTC"
}
<|eor|><|sor|>PHP uses rollover for its dates. Its a very fancy way of saying 98 days after February 1st. In a sane *explicit is better than implicit language*, you would add a `datetime.timedelta` object to accomplish this.<|eor|><|eols|><|endoftext|> | 8 |
lolphp | myaut | csz4sfq | <|sols|><|sot|>Here's one that's been sitting on my desktop for awhile I like to call it "February doesn't count"<|eot|><|sol|>http://i.imgur.com/CAkt9S5.png<|eol|><|sor|>It's setting the day to 30 in each case, and 2-30 is normalized to 3-2. You must have run this on the 30th day of the month. The documentation does say that it sets fields without format specifiers to the current values. It's a rather contrived example because the idea of creating a Datetime from only a month is complete nonsense. We can certainly ding PHP for allowing that to happen without complaining.<|eor|><|soopr|>> We can certainly ding PHP for allowing that to happen without complaining.
That's the really unforgivable part, yes. Using the system time for unspecified portions of the generated time is documented behavior, if a bit surprising, but the happenstance makes this example a lot funnier than:
DateTime::createFromFormat('n d', '2 30')<|eoopr|><|sor|>I'd still argue that this is wrong behavior. Unspecified values should be initialized to sane values - thus giving you 2015-02-01 00:00:00.00 - and this is how it works in basically every other programming language. Ruby, for example:
2.2.0 :007 > Time.strptime('2', '%m')
=> 2015-02-01 00:00:00 -0800
You can, of course, change the default timezone behavior.<|eor|><|sor|>Interface that _allows_ you to create incorrect dates (like 30.02.2015) without any complaint is broken by design. Look, how python handles this:
You can't create `datetime` without specifying year and day:
>>> datetime.datetime(month=12)
TypeError: Required argument 'year' (pos 1) not found
And it forbids creating 30.02 dates (because they do not exist):
>>> datetime.datetime(2015, 02, 30)
ValueError: day is out of range for month
>>> datetime.datetime.strptime('30 2', '%d %m')
ValueError: day is out of range for month
UPD: You better explain, why PHP allows to use '42' as a day, but not '111' (probably because it doesn't expect three digits as day number):
php -r "var_dump(DateTime::createFromFormat('n d', '2 100'));"
bool(false)
php -r "var_dump(DateTime::createFromFormat('n d', '2 99'));"
object(DateTime)#1 (3) {
["date"]=>
string(26) "2015-05-10 22:44:48.000000"
["timezone_type"]=>
int(3)
["timezone"]=>
string(3) "UTC"
}
<|eor|><|eols|><|endoftext|> | 7 |
lolphp | Mmarco94 | 6145pc | <|sols|><|sot|>Obviously<|eot|><|sol|>https://i.redd.it/upw6y8vso7ny.png<|eol|><|eols|><|endoftext|> | 86 |
lolphp | suspiciously_calm | dfbjqw7 | <|sols|><|sot|>Obviously<|eot|><|sol|>https://i.redd.it/upw6y8vso7ny.png<|eol|><|sor|>Well at least that is actually an equivalence relation.<|eor|><|eols|><|endoftext|> | 26 |
lolphp | the_alias_of_andrea | dfcu5io | <|sols|><|sot|>Obviously<|eot|><|sol|>https://i.redd.it/upw6y8vso7ny.png<|eol|><|sor|>I wondered if it maybe used that unusual rule because it was sticking all the values into another array as keys (and thus converting them to strings).
[Yep.](https://github.com/php/php-src/blob/56269af46c8f6d2863ec94d2d79f0c3656ef1cab/ext/standard/array.c#L4460)<|eor|><|eols|><|endoftext|> | 12 |
lolphp | Mmarco94 | dfir64s | <|sols|><|sot|>Obviously<|eot|><|sol|>https://i.redd.it/upw6y8vso7ny.png<|eol|><|sor|>So, what's the better approach? Only be able to compare objects that implement a compare interface?<|eor|><|soopr|>Using == (or, even better ===) like in every other method<|eoopr|><|eols|><|endoftext|> | 6 |
lolphp | sim642 | 3fq8su | <|sols|><|sot|>the following comment *may be* factually incorrect<|eot|><|sol|>https://secure.php.net/manual/en/function.uksort.php#116662<|eol|><|eols|><|endoftext|> | 86 |
lolphp | iWaterPlants | ctr3jc6 | <|sols|><|sot|>the following comment *may be* factually incorrect<|eot|><|sol|>https://secure.php.net/manual/en/function.uksort.php#116662<|eol|><|sor|>This made me laugh harder than it should.<|eor|><|eols|><|endoftext|> | 22 |
lolphp | freeaddition | ctrbs3u | <|sols|><|sot|>the following comment *may be* factually incorrect<|eot|><|sol|>https://secure.php.net/manual/en/function.uksort.php#116662<|eol|><|sor|>[deleted]<|eor|><|sor|>You should create a microservice hosted in a UK datacenter, and then sort your arrays by passing them off to the sorting service. That way you can easily change to chinasort() when you scale.<|eor|><|eols|><|endoftext|> | 18 |
lolphp | maweki | cts49rs | <|sols|><|sot|>the following comment *may be* factually incorrect<|eot|><|sol|>https://secure.php.net/manual/en/function.uksort.php#116662<|eol|><|sor|>The real wtf is, that the php docs even have a comments section. Even more wtf, that it is often times needed.<|eor|><|eols|><|endoftext|> | 16 |
lolphp | TheBuzzSaw | ctr3zf8 | <|sols|><|sot|>the following comment *may be* factually incorrect<|eot|><|sol|>https://secure.php.net/manual/en/function.uksort.php#116662<|eol|><|sor|>Well, when are we going to receive verification that it is or is not?<|eor|><|eols|><|endoftext|> | 11 |
lolphp | polish_niceguy | ctronex | <|sols|><|sot|>the following comment *may be* factually incorrect<|eot|><|sol|>https://secure.php.net/manual/en/function.uksort.php#116662<|eol|><|sor|>Poor uasort(), annexed by Putin :(<|eor|><|eols|><|endoftext|> | 9 |
lolphp | FionaSarah | ctumwpe | <|sols|><|sot|>the following comment *may be* factually incorrect<|eot|><|sol|>https://secure.php.net/manual/en/function.uksort.php#116662<|eol|><|sor|>The real wtf is, that the php docs even have a comments section. Even more wtf, that it is often times needed.<|eor|><|sor|>A bigger wtf is the number of php devs that cite it as a really great thing! <|eor|><|eols|><|endoftext|> | 9 |
lolphp | myaut | cts74vh | <|sols|><|sot|>the following comment *may be* factually incorrect<|eot|><|sol|>https://secure.php.net/manual/en/function.uksort.php#116662<|eol|><|sor|>If you want to write cross-_country_ code, do not use `uksort()`.<|eor|><|eols|><|endoftext|> | 8 |
lolphp | Tychuz | ctrtow0 | <|sols|><|sot|>the following comment *may be* factually incorrect<|eot|><|sol|>https://secure.php.net/manual/en/function.uksort.php#116662<|eol|><|sor|>What's funny (or sad, if you're a PHP developer) - I actually wouldn't be surprised if some functions starting with uk would be tailored just for UK...<|eor|><|eols|><|endoftext|> | 7 |
lolphp | CornPlanter | ctr4lrq | <|sols|><|sot|>the following comment *may be* factually incorrect<|eot|><|sol|>https://secure.php.net/manual/en/function.uksort.php#116662<|eol|><|sor|>My buddy lives in UK and he confirms he can use uksort!<|eor|><|eols|><|endoftext|> | 6 |
lolphp | sli | ctref37 | <|sols|><|sot|>the following comment *may be* factually incorrect<|eot|><|sol|>https://secure.php.net/manual/en/function.uksort.php#116662<|eol|><|sor|>[deleted]<|eor|><|sor|>You should create a microservice hosted in a UK datacenter, and then sort your arrays by passing them off to the sorting service. That way you can easily change to chinasort() when you scale.<|eor|><|sor|>Maybe build it using Node so it's asynchronous. It would probably cut down on the code, too.
Now I kind of want to port uksort to Node as a joke.<|eor|><|eols|><|endoftext|> | 5 |
lolphp | re_anon | 6mexg9 | <|sols|><|sot|>Because PHP's implementation contains a bug. Thus, this test actually checks to make sure that PHP's behaviour is wrong, but consistently so.<|eot|><|sol|>https://github.com/php/php-src/blob/a50c31da1917bb07b3c11f229125ab8d1f0b9b70/ext/standard/tests/math/mt_rand_value.phpt#L20<|eol|><|eols|><|endoftext|> | 86 |
lolphp | graingert | dk1mkyy | <|sols|><|sot|>Because PHP's implementation contains a bug. Thus, this test actually checks to make sure that PHP's behaviour is wrong, but consistently so.<|eot|><|sol|>https://github.com/php/php-src/blob/a50c31da1917bb07b3c11f229125ab8d1f0b9b70/ext/standard/tests/math/mt_rand_value.phpt#L20<|eol|><|sor|>If your application depends on predictable values being returned from a pseudo RNG, you have bigger problems than it being written in PHP.<|eor|><|sor|>Seeded RNGs must be predictable<|eor|><|eols|><|endoftext|> | 32 |
lolphp | the_alias_of_andrea | dk1pzxt | <|sols|><|sot|>Because PHP's implementation contains a bug. Thus, this test actually checks to make sure that PHP's behaviour is wrong, but consistently so.<|eot|><|sol|>https://github.com/php/php-src/blob/a50c31da1917bb07b3c11f229125ab8d1f0b9b70/ext/standard/tests/math/mt_rand_value.phpt#L20<|eol|><|sor|>If your application depends on predictable values being returned from a pseudo RNG, you have bigger problems than it being written in PHP.<|eor|><|sor|>If PRNGs weren't deterministic and reproducible, procedural generation wouldn't be a thing.<|eor|><|eols|><|endoftext|> | 22 |
lolphp | rabidferret | dk1eo9e | <|sols|><|sot|>Because PHP's implementation contains a bug. Thus, this test actually checks to make sure that PHP's behaviour is wrong, but consistently so.<|eot|><|sol|>https://github.com/php/php-src/blob/a50c31da1917bb07b3c11f229125ab8d1f0b9b70/ext/standard/tests/math/mt_rand_value.phpt#L20<|eol|><|sor|>That's because PHP takes backward compatibility seriously.<|eor|><|sor|>Taking backwards compatibility seriously is good. Refusing to fix bugs due to backwards compat is not. What is or isn't a bug might be variable (e.g. someone could argue that the example at https://youtu.be/u2xzRUYrsWA?t=592 is a bug), but when it's clear the behavior is different than what was intended, it should be fixed.<|eor|><|eols|><|endoftext|> | 21 |
lolphp | graingert | dk1w963 | <|sols|><|sot|>Because PHP's implementation contains a bug. Thus, this test actually checks to make sure that PHP's behaviour is wrong, but consistently so.<|eot|><|sol|>https://github.com/php/php-src/blob/a50c31da1917bb07b3c11f229125ab8d1f0b9b70/ext/standard/tests/math/mt_rand_value.phpt#L20<|eol|><|sor|>If your application depends on predictable values being returned from a pseudo RNG, you have bigger problems than it being written in PHP.<|eor|><|sor|>Seeded RNGs must be predictable<|eor|><|sor|>If your application's using a predictable seed for it's PRNG...
In any case, if you do need fast, cryptographically insecure values generated by a canonical Mersenne Twister implementation rather than PHP's flawed one, mt_srand() has a $mode param that can be used to specify it since 7.1.0.<|eor|><|sor|>It's very common to use a predictable seed. Eg statistical simulations<|eor|><|eols|><|endoftext|> | 19 |
lolphp | the_alias_of_andrea | dk1ws6f | <|sols|><|sot|>Because PHP's implementation contains a bug. Thus, this test actually checks to make sure that PHP's behaviour is wrong, but consistently so.<|eot|><|sol|>https://github.com/php/php-src/blob/a50c31da1917bb07b3c11f229125ab8d1f0b9b70/ext/standard/tests/math/mt_rand_value.phpt#L20<|eol|><|sor|>That's because PHP takes backward compatibility seriously.<|eor|><|sor|>Taking backwards compatibility seriously is good. Refusing to fix bugs due to backwards compat is not. What is or isn't a bug might be variable (e.g. someone could argue that the example at https://youtu.be/u2xzRUYrsWA?t=592 is a bug), but when it's clear the behavior is different than what was intended, it should be fixed.<|eor|><|sor|>> Taking backwards compatibility seriously is good. Refusing to fix bugs due to backwards compat is not.
But we did fix it.<|eor|><|sor|>The fact that the test is still there would imply that it's not been fixed<|eor|><|sor|>The test is still there in PHP 7.1, but its content is different. The version linked in the OP is not the latest version, it's frozen in time at a particular commit.<|eor|><|eols|><|endoftext|> | 19 |
lolphp | the_alias_of_andrea | dk1q1as | <|sols|><|sot|>Because PHP's implementation contains a bug. Thus, this test actually checks to make sure that PHP's behaviour is wrong, but consistently so.<|eot|><|sol|>https://github.com/php/php-src/blob/a50c31da1917bb07b3c11f229125ab8d1f0b9b70/ext/standard/tests/math/mt_rand_value.phpt#L20<|eol|><|sor|>Why didn't they just write the correct test for the real implementation, then add it into the [expected test failures](http://gcov.php.net/viewer.php?version=PHP_7_0&func=expected_tests) list?<|eor|><|sor|>Because it's not the correct implementation that compatibility needs to be maintained with.<|eor|><|eols|><|endoftext|> | 18 |
lolphp | iluuu | dk14tvy | <|sols|><|sot|>Because PHP's implementation contains a bug. Thus, this test actually checks to make sure that PHP's behaviour is wrong, but consistently so.<|eot|><|sol|>https://github.com/php/php-src/blob/a50c31da1917bb07b3c11f229125ab8d1f0b9b70/ext/standard/tests/math/mt_rand_value.phpt#L20<|eol|><|sor|>That's because PHP takes backward compatibility seriously.<|eor|><|eols|><|endoftext|> | 17 |
lolphp | the_alias_of_andrea | dk1pxmm | <|sols|><|sot|>Because PHP's implementation contains a bug. Thus, this test actually checks to make sure that PHP's behaviour is wrong, but consistently so.<|eot|><|sol|>https://github.com/php/php-src/blob/a50c31da1917bb07b3c11f229125ab8d1f0b9b70/ext/standard/tests/math/mt_rand_value.phpt#L20<|eol|><|sor|>Ah, someone noticed my commit :3
It was fixed in 7.1.<|eor|><|eols|><|endoftext|> | 15 |
lolphp | pilif | dk275sq | <|sols|><|sot|>Because PHP's implementation contains a bug. Thus, this test actually checks to make sure that PHP's behaviour is wrong, but consistently so.<|eot|><|sol|>https://github.com/php/php-src/blob/a50c31da1917bb07b3c11f229125ab8d1f0b9b70/ext/standard/tests/math/mt_rand_value.phpt#L20<|eol|><|sor|>If your application depends on predictable values being returned from a pseudo RNG, you have bigger problems than it being written in PHP.<|eor|><|sor|>Seeded RNGs must be predictable<|eor|><|sor|>If your application's using a predictable seed for it's PRNG...
In any case, if you do need fast, cryptographically insecure values generated by a canonical Mersenne Twister implementation rather than PHP's flawed one, mt_srand() has a $mode param that can be used to specify it since 7.1.0.<|eor|><|sor|>It's very common to use a predictable seed. Eg statistical simulations<|eor|><|sor|>And games too<|eor|><|eols|><|endoftext|> | 14 |
lolphp | iheartrms | dk1t1rq | <|sols|><|sot|>Because PHP's implementation contains a bug. Thus, this test actually checks to make sure that PHP's behaviour is wrong, but consistently so.<|eot|><|sol|>https://github.com/php/php-src/blob/a50c31da1917bb07b3c11f229125ab8d1f0b9b70/ext/standard/tests/math/mt_rand_value.phpt#L20<|eol|><|sor|>Why didn't they just write the correct test for the real implementation, then add it into the [expected test failures](http://gcov.php.net/viewer.php?version=PHP_7_0&func=expected_tests) list?<|eor|><|sor|>Because it's not the correct implementation that compatibility needs to be maintained with.<|eor|><|sor|>This is why we can't have nice things.<|eor|><|eols|><|endoftext|> | 13 |
lolphp | the_alias_of_andrea | dk1py75 | <|sols|><|sot|>Because PHP's implementation contains a bug. Thus, this test actually checks to make sure that PHP's behaviour is wrong, but consistently so.<|eot|><|sol|>https://github.com/php/php-src/blob/a50c31da1917bb07b3c11f229125ab8d1f0b9b70/ext/standard/tests/math/mt_rand_value.phpt#L20<|eol|><|sor|>That's because PHP takes backward compatibility seriously.<|eor|><|sor|>Taking backwards compatibility seriously is good. Refusing to fix bugs due to backwards compat is not. What is or isn't a bug might be variable (e.g. someone could argue that the example at https://youtu.be/u2xzRUYrsWA?t=592 is a bug), but when it's clear the behavior is different than what was intended, it should be fixed.<|eor|><|sor|>> Taking backwards compatibility seriously is good. Refusing to fix bugs due to backwards compat is not.
But we did fix it.<|eor|><|eols|><|endoftext|> | 12 |
lolphp | wibblewafs | dk1l5me | <|sols|><|sot|>Because PHP's implementation contains a bug. Thus, this test actually checks to make sure that PHP's behaviour is wrong, but consistently so.<|eot|><|sol|>https://github.com/php/php-src/blob/a50c31da1917bb07b3c11f229125ab8d1f0b9b70/ext/standard/tests/math/mt_rand_value.phpt#L20<|eol|><|sor|>Why didn't they just write the correct test for the real implementation, then add it into the [expected test failures](http://gcov.php.net/viewer.php?version=PHP_7_0&func=expected_tests) list?<|eor|><|eols|><|endoftext|> | 9 |
lolphp | Danack | dktfb8j | <|sols|><|sot|>Because PHP's implementation contains a bug. Thus, this test actually checks to make sure that PHP's behaviour is wrong, but consistently so.<|eot|><|sol|>https://github.com/php/php-src/blob/a50c31da1917bb07b3c11f229125ab8d1f0b9b70/ext/standard/tests/math/mt_rand_value.phpt#L20<|eol|><|sor|>If your application depends on predictable values being returned from a pseudo RNG, you have bigger problems than it being written in PHP.<|eor|><|sor|>If PRNGs weren't deterministic and reproducible, procedural generation wouldn't be a thing.<|eor|><|sor|>That reminds me - Pixar forgot to store the seed numbers for the procedurally generated objects in Finding Nemo, and so encountered problems when they wanted to re-render the film for higher resolution releases: http://www.tested.com/art/movies/449542-finding-nemo-3d-interview/
> "One thing we tried but couldn't quite perfectly emulate are some of the procedural things put in the film," says Whitehill. He gives an example: the sea grass on Nemo's reefs moved and swayed based on data created by a random number generator. The "seed number," as Whitehill calls it, controlled the movement speed of the sea grass. But there was no way to retrieve the exact digit created by the random number generator for Nemo's final render in 2003. The only solution was to watch the original film and match it as closely as reasonably possible.<|eor|><|eols|><|endoftext|> | 8 |
lolphp | the_alias_of_andrea | dk3k4o1 | <|sols|><|sot|>Because PHP's implementation contains a bug. Thus, this test actually checks to make sure that PHP's behaviour is wrong, but consistently so.<|eot|><|sol|>https://github.com/php/php-src/blob/a50c31da1917bb07b3c11f229125ab8d1f0b9b70/ext/standard/tests/math/mt_rand_value.phpt#L20<|eol|><|sor|>That's because PHP takes backward compatibility seriously.<|eor|><|sor|>Taking backwards compatibility seriously is good. Refusing to fix bugs due to backwards compat is not. What is or isn't a bug might be variable (e.g. someone could argue that the example at https://youtu.be/u2xzRUYrsWA?t=592 is a bug), but when it's clear the behavior is different than what was intended, it should be fixed.<|eor|><|sor|>> Taking backwards compatibility seriously is good. Refusing to fix bugs due to backwards compat is not.
But we did fix it.<|eor|><|sor|>The fact that the test is still there would imply that it's not been fixed<|eor|><|sor|>The test is still there in PHP 7.1, but its content is different. The version linked in the OP is not the latest version, it's frozen in time at a particular commit.<|eor|><|sor|>On master the test still says the impl is wrong<|eor|><|sor|>Yep! 7.1 maintains the old behaviour behind a flag, just in case it's needed. But it's no longer the default.<|eor|><|eols|><|endoftext|> | 6 |
lolphp | mikeputerbaugh | dk1gcuy | <|sols|><|sot|>Because PHP's implementation contains a bug. Thus, this test actually checks to make sure that PHP's behaviour is wrong, but consistently so.<|eot|><|sol|>https://github.com/php/php-src/blob/a50c31da1917bb07b3c11f229125ab8d1f0b9b70/ext/standard/tests/math/mt_rand_value.phpt#L20<|eol|><|sor|>If your application depends on predictable values being returned from a pseudo RNG, you have bigger problems than it being written in PHP.<|eor|><|eols|><|endoftext|> | 5 |
lolphp | BilgeXA | dk1e1jk | <|sols|><|sot|>Because PHP's implementation contains a bug. Thus, this test actually checks to make sure that PHP's behaviour is wrong, but consistently so.<|eot|><|sol|>https://github.com/php/php-src/blob/a50c31da1917bb07b3c11f229125ab8d1f0b9b70/ext/standard/tests/math/mt_rand_value.phpt#L20<|eol|><|sor|>That's because PHP takes backward compatibility seriously.<|eor|><|sor|>You say that like it's a bad thing.<|eor|><|eols|><|endoftext|> | 5 |
lolphp | rabidferret | dk3k7sf | <|sols|><|sot|>Because PHP's implementation contains a bug. Thus, this test actually checks to make sure that PHP's behaviour is wrong, but consistently so.<|eot|><|sol|>https://github.com/php/php-src/blob/a50c31da1917bb07b3c11f229125ab8d1f0b9b70/ext/standard/tests/math/mt_rand_value.phpt#L20<|eol|><|sor|>That's because PHP takes backward compatibility seriously.<|eor|><|sor|>Taking backwards compatibility seriously is good. Refusing to fix bugs due to backwards compat is not. What is or isn't a bug might be variable (e.g. someone could argue that the example at https://youtu.be/u2xzRUYrsWA?t=592 is a bug), but when it's clear the behavior is different than what was intended, it should be fixed.<|eor|><|sor|>> Taking backwards compatibility seriously is good. Refusing to fix bugs due to backwards compat is not.
But we did fix it.<|eor|><|sor|>The fact that the test is still there would imply that it's not been fixed<|eor|><|sor|>The test is still there in PHP 7.1, but its content is different. The version linked in the OP is not the latest version, it's frozen in time at a particular commit.<|eor|><|sor|>On master the test still says the impl is wrong<|eor|><|sor|>Yep! 7.1 maintains the old behaviour behind a flag, just in case it's needed. But it's no longer the default.<|eor|><|sor|>Ah. That sounds surprisingly reasonable<|eor|><|eols|><|endoftext|> | 5 |
lolphp | perkia | 4tfmf3 | <|sols|><|sot|>In retrospect having the function return an integer maybe wasn't the best idea<|eot|><|sol|>https://secure.php.net/manual/en/function.crc32.php<|eol|><|eols|><|endoftext|> | 86 |
lolphp | kafoso | d5gxu3r | <|sols|><|sot|>In retrospect having the function return an integer maybe wasn't the best idea<|eot|><|sol|>https://secure.php.net/manual/en/function.crc32.php<|eol|><|sor|>At least someone had the courtesy of making a big **BASICALLY, DON'T USE THIS** disclaimer in the API. And even if you must use it, there's a detailed description of how to get around the 32 vs 64 bit problem.
It's easy to judge legacy features and code. ;)<|eor|><|eols|><|endoftext|> | 36 |
lolphp | perkia | d5gyk2w | <|sols|><|sot|>In retrospect having the function return an integer maybe wasn't the best idea<|eot|><|sol|>https://secure.php.net/manual/en/function.crc32.php<|eol|><|sor|>At least someone had the courtesy of making a big **BASICALLY, DON'T USE THIS** disclaimer in the API. And even if you must use it, there's a detailed description of how to get around the 32 vs 64 bit problem.
It's easy to judge legacy features and code. ;)<|eor|><|soopr|>> It's easy to judge legacy features and code. ;)
Isn't it the whole point of this sub? :p<|eoopr|><|eols|><|endoftext|> | 23 |
lolphp | n0t0ri0us9 | d5gzf8l | <|sols|><|sot|>In retrospect having the function return an integer maybe wasn't the best idea<|eot|><|sol|>https://secure.php.net/manual/en/function.crc32.php<|eol|><|sor|>At least someone had the courtesy of making a big **BASICALLY, DON'T USE THIS** disclaimer in the API. And even if you must use it, there's a detailed description of how to get around the 32 vs 64 bit problem.
It's easy to judge legacy features and code. ;)<|eor|><|sor|>>BASICALLY, DON'T USE THIS disclaimer in the API..
Would have been great if they put it in the header of php.net, for the whole language..<|eor|><|eols|><|endoftext|> | 21 |
lolphp | siplux | d5haopg | <|sols|><|sot|>In retrospect having the function return an integer maybe wasn't the best idea<|eot|><|sol|>https://secure.php.net/manual/en/function.crc32.php<|eol|><|sor|>At least someone had the courtesy of making a big **BASICALLY, DON'T USE THIS** disclaimer in the API. And even if you must use it, there's a detailed description of how to get around the 32 vs 64 bit problem.
It's easy to judge legacy features and code. ;)<|eor|><|sor|>>BASICALLY, DON'T USE THIS disclaimer in the API..
Would have been great if they put it in the header of php.net, for the whole language..<|eor|><|sor|>Haters gonna hate. The world would've been a very different place without the PHP language. Mistakes were made, indeed, but it more than makes up for it in availability, open-source projects, high-profile websites running it, etc.<|eor|><|sor|>The fact that people have written templating languages within a templating language just to get around how awful the original templating language is, is an endless source of amusement for me. <|eor|><|sor|>That is such a misunderstanding of what PHP is - today. And someone always throws it in because they read it somewhere and found it to be funny.
The circumstances has shifted dramatically over the past 21 years. Lerdorf did create PHP as a manageable means of handling logic and outputting data to a web page, commonly viewed as HTML. Today (2016), PHP is a colossal language with a tremendous number of extensions and libraries, most of which may be utilized free-of-charge. PHP handles everything from simple homepages to complex business logic for some of the highest earning companies in the world.
Other people have picked up the torched and made some fast, manageable solutions for templating engines (including Twig, Moustache, and React), DBALs, caching, and much more.<|eor|><|sor|>If we're being serious, I would argue that PHP's success has very little to do with its merits, and is the most prominent case of "[worse is better](https://www.jwz.org/doc/worse-is-better.html)" that I'm aware of. The PHP of today, as it was 10 years ago, is still a clusterfuck of a language. There is literally no reason to pick PHP in 2016 for a new project other than some unfortunate external constraint (and I say this as a person who is _forced_ to use it on a nearly daily basis) . It's costs far outweigh its benefits. I will admit there are a plethora of convenient CMS frameworks written in PHP, but I would never advocate their use of save for client demands.
[An oldie, but goodie](https://www.reddit.com/r/programming/comments/dst56/today_i_learned_about_php_variable_variables/)<|eor|><|eols|><|endoftext|> | 21 |
lolphp | ioctl79 | d5h5aq8 | <|sols|><|sot|>In retrospect having the function return an integer maybe wasn't the best idea<|eot|><|sol|>https://secure.php.net/manual/en/function.crc32.php<|eol|><|sor|>At least someone had the courtesy of making a big **BASICALLY, DON'T USE THIS** disclaimer in the API. And even if you must use it, there's a detailed description of how to get around the 32 vs 64 bit problem.
It's easy to judge legacy features and code. ;)<|eor|><|sor|>> a big BASICALLY, DON'T USE THIS disclaimer
It does not say deprecated or "don't use this" explicitly in the "disclaimer", it's just a warning box that sounds more like a vague blog post, I think most beginners will simply ignore it because it's just a huge wall of text. And the most upvoted comment is just herp derp.<|eor|><|sor|>That's because it is a perfectly valid and working function. One just has to be aware that it does funky stuff between 32 and 64 bit systems.
Being inexperienced doesn't give you carte blanche to skip - or fail to understand - important information.<|eor|><|sor|>Having an API with this many sharp edges is reason enough to deprecate, especially when there is a fully functional replacement.<|eor|><|eols|><|endoftext|> | 17 |
lolphp | siplux | d5h8z90 | <|sols|><|sot|>In retrospect having the function return an integer maybe wasn't the best idea<|eot|><|sol|>https://secure.php.net/manual/en/function.crc32.php<|eol|><|sor|>At least someone had the courtesy of making a big **BASICALLY, DON'T USE THIS** disclaimer in the API. And even if you must use it, there's a detailed description of how to get around the 32 vs 64 bit problem.
It's easy to judge legacy features and code. ;)<|eor|><|sor|>>BASICALLY, DON'T USE THIS disclaimer in the API..
Would have been great if they put it in the header of php.net, for the whole language..<|eor|><|sor|>Haters gonna hate. The world would've been a very different place without the PHP language. Mistakes were made, indeed, but it more than makes up for it in availability, open-source projects, high-profile websites running it, etc.<|eor|><|sor|>The fact that people have written templating languages within a templating language just to get around how awful the original templating language is, is an endless source of amusement for me. <|eor|><|eols|><|endoftext|> | 16 |
lolphp | Miserable_Fuck | d5ho948 | <|sols|><|sot|>In retrospect having the function return an integer maybe wasn't the best idea<|eot|><|sol|>https://secure.php.net/manual/en/function.crc32.php<|eol|><|sor|>At least someone had the courtesy of making a big **BASICALLY, DON'T USE THIS** disclaimer in the API. And even if you must use it, there's a detailed description of how to get around the 32 vs 64 bit problem.
It's easy to judge legacy features and code. ;)<|eor|><|soopr|>> It's easy to judge legacy features and code. ;)
Isn't it the whole point of this sub? :p<|eoopr|><|sor|>You must be new here. This sub exists to bait php criticism out of unsuspecting users and then scolding them for making fun of php. I think it's an ego thing.<|eor|><|eols|><|endoftext|> | 10 |
lolphp | DoctorWaluigiTime | d5i037t | <|sols|><|sot|>In retrospect having the function return an integer maybe wasn't the best idea<|eot|><|sol|>https://secure.php.net/manual/en/function.crc32.php<|eol|><|sor|>At least someone had the courtesy of making a big **BASICALLY, DON'T USE THIS** disclaimer in the API. And even if you must use it, there's a detailed description of how to get around the 32 vs 64 bit problem.
It's easy to judge legacy features and code. ;)<|eor|><|soopr|>> It's easy to judge legacy features and code. ;)
Isn't it the whole point of this sub? :p<|eoopr|><|sor|>I agree this sub is for funny, quirky, and even sad things in the language. But when documentation like this is provided I really don't see the problem. Granted, many, who just grab the first response off of Stackoverflow and similar webistes, without actually checking up on the function they're about to use, may get run over by this. However, in my eyes, that is their own fault.<|eor|><|sor|>> But when documentation like this is provided I really don't see the problem.
Sorry, documentation doesn't excuse the silliness/badness/etc. of the language. I *definitely* see a problem with broken or buggy built-in code/functions/etc. "But it's documented" is not an excuse. "It's being fixed" would be one.<|eor|><|eols|><|endoftext|> | 10 |
lolphp | the_alias_of_andrea | d5gy8n9 | <|sols|><|sot|>In retrospect having the function return an integer maybe wasn't the best idea<|eot|><|sol|>https://secure.php.net/manual/en/function.crc32.php<|eol|><|sor|>Yeah, PHP's lack of unsigned integers mixed with C programmers pretending they exist anyway when writing PHP extensions has led to a few embarrassing places like this.
Luckily, this case, and a few others (but not all) like it, slowly fix themselves over time. Any *nix server worth its salt is running a 64-bit OS now and gets 64-bit integers, and with PHP 7 adding a workaround for NT's strange 64-bit ABI^(), Windows Servers will now be using 64-bit integers too.
----
^() On most (all?) unices, C's `long` type is 64-bit on AMD64. PHP 5 used this type for its integers, so when compiled on a 64-bit Linux, you got 64-bit integers for free. However, unlike its Unixen pretended brethren, Windows makes `long` 32-bit on x86_64, so you need to use a different type (`long long` these days) to get those nice 8-byte words. 7 was the first PHP version to go through the entire codebase and replace every single `long` with a fancy typedef that gets us 64-bit integers on 64-bit Microsoft platforms. So while UNIX has had 64-bit integers in PHP for 12 years or so, WinNT has had to wait until the end of last year.<|eor|><|eols|><|endoftext|> | 9 |
lolphp | Rainfly_X | d5i6cxc | <|sols|><|sot|>In retrospect having the function return an integer maybe wasn't the best idea<|eot|><|sol|>https://secure.php.net/manual/en/function.crc32.php<|eol|><|sor|>At least someone had the courtesy of making a big **BASICALLY, DON'T USE THIS** disclaimer in the API. And even if you must use it, there's a detailed description of how to get around the 32 vs 64 bit problem.
It's easy to judge legacy features and code. ;)<|eor|><|soopr|>> It's easy to judge legacy features and code. ;)
Isn't it the whole point of this sub? :p<|eoopr|><|sor|>I agree this sub is for funny, quirky, and even sad things in the language. But when documentation like this is provided I really don't see the problem. Granted, many, who just grab the first response off of Stackoverflow and similar webistes, without actually checking up on the function they're about to use, may get run over by this. However, in my eyes, that is their own fault.<|eor|><|sor|>Patching a thousand potholes with documentation is one of the PHP attitudes we like to make fun of here.
Backward compatibility can absolutely be a good thing, but not when it's applied both mindlessly and perpetually. PHP is legend for doing everything wrong the first time, and then sticking to that idiot interface for eternity, using documentation as an excuse. Any healthy language would work actively to cut out or fix misleading tools, and document it in the *release notes.* For examples of a healthier compromise between legacy and clarity, look at almost any other language.<|eor|><|eols|><|endoftext|> | 8 |
lolphp | mort96 | d5hxg59 | <|sols|><|sot|>In retrospect having the function return an integer maybe wasn't the best idea<|eot|><|sol|>https://secure.php.net/manual/en/function.crc32.php<|eol|><|sor|>Or they could have just had it return signed on both 32 and 64 bit.<|eor|><|sor|>They do return signed on both 32 and 64 bit, but 64 bit signed numbers support values up to 2^64-1. The docs talk about the possibility of making the number wrap around as if it was a signed 32 bit number, but the manual talks about why they didn't do that:
> Having 64bit installations also return negative integers for higher result values was considered but would break the hexadecimal conversion as negatives would get an extra 0xFFFFFFFF######## offset then. As hexadecimal representation seems to be the most common use case we decided to not break this even if it breaks direct decimal comparisons in about 50% of the cases when moving from 32 to 64bits. <|eor|><|eols|><|endoftext|> | 7 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.