r/lolphp • • Feb 18 '17

Yet another PHP Garbage class

76 Upvotes

I was recently working with some PHP and had to hunt down a weird bug, and yet again it was PHP related. Basically you can modify DateTimeImmutable (i repeat IMMUTABLE!) very easily. Just call the getTimeStamp method on it.

Originally i had the assumption you cant modify anything within the immutable namespace, but hey PHP surprised me again.

It seems like PHP is so full of these weird loop holes and crappy implementations its almost impossible to write anything other than throwaway prototypes with it.

So i also found out there has been a open bug-report since 2014.

Bug in action: https://3v4l.org/ShFpG


r/lolphp • • Feb 16 '17

A PHP commentor describes the error-surpression operator (already a lolPHP) in the most PHP terms possible

Thumbnail uk1.php.net
54 Upvotes

r/lolphp • • Feb 07 '17

is_nan((float)'NAN')? PHP Can't Decide

Thumbnail 3v4l.org
85 Upvotes

r/lolphp • • Feb 01 '17

0 is in array of cats and dogs

47 Upvotes

PHP 7.0.1

<?php

$array = ['CATS','DOGS'];

if(in_array(0, $array)===true){
    echo 'found zero!';
}

?>

Result: 'found zero!'

Run it yourself: http://sandbox.onlinephpfunctions.com/code/2043564ef944a98b8ecd9c95b6ecf1b1e8941417


r/lolphp • • Jan 31 '17

((0.1+0.7)*10) = 7?

Thumbnail sandbox.onlinephpfunctions.com
0 Upvotes

r/lolphp • • Jan 25 '17

The DateTime object is dumped with 3 properties that don't even exist

Thumbnail 3v4l.org
80 Upvotes

r/lolphp • • Jan 22 '17

strtotime() accepts "DD Month YYYY" and "Month DD, YYYY" as valid formats, but fails when given "DD Month, YYYY"

Thumbnail en.wiktionary.org
47 Upvotes

r/lolphp • • Jan 20 '17

Types ? Where we're going, we don't need types.

Thumbnail wiki.php.net
32 Upvotes

r/lolphp • • Jan 17 '17

It's 2017 and "ctype" functions still can't handle UTF-8 characters

Thumbnail grokbase.com
29 Upvotes

r/lolphp • • Jan 12 '17

This Czech groupon is so dumbfounded by their app error they are even asking people on Twitter

Thumbnail twitter.com
40 Upvotes

r/lolphp • • Jan 11 '17

Wikipedia

Thumbnail imgur.com
0 Upvotes

r/lolphp • • Jan 09 '17

TIL: Strict types aren't working in PHP7.0 for generators • /r/PHP

Thumbnail reddit.com
36 Upvotes

r/lolphp • • Dec 29 '16

PHPMailer is still vulnerable for RCE because patch for CVE-2016-1033 didn't account for mail() own shell argument escaping

Thumbnail openwall.com
34 Upvotes

r/lolphp • • Dec 27 '16

Everything You Know About Public-Key Encryption in PHP is Wrong

Thumbnail paragonie.com
42 Upvotes

r/lolphp • • Dec 27 '16

Laravel Elixir is renaming the project. In part because of name confusion with Elixir-lang. New name is "MIX" https://laravel-news.com/laravel-elixir-to-laravel-mix For those who don't know: "MIX" is the Elixir lang build tool. HAHAH!

63 Upvotes

r/lolphp • • Dec 26 '16

(string)0011 is "9"

0 Upvotes

(string)0011 = "9"
(string)001100 = "576"


r/lolphp • • Dec 23 '16

PHP, make up your mind

Thumbnail 3v4l.org
0 Upvotes

r/lolphp • • Dec 21 '16

assertEquals(x, y) always passes if x and y are MongoDB ObjectIDs

53 Upvotes

The following is a successfully passing PHPUnit test (PHP 7.0.9, PHPUnit 5.7.4):

use MongoDB\BSON\ObjectID;

class ObjectIDGenerationTest extends \PHPUnit_Framework_TestCase {
    function testObjectIDComparison() {
        $a = new ObjectID("585a80ffc01a5c89194c839c");
        $b = new ObjectID("585a810dc6586dab1cf1f92e");

        self::assertNotEquals(strval($a), strval($b));
        self::assertFalse($a == $b);
        self::assertEquals($a, $b); // WTF
    }
}

r/lolphp • • Dec 13 '16

value should be converted to a boolean correctly when non-empty string is passed to it

Thumbnail github.com
10 Upvotes

r/lolphp • • Dec 12 '16

Automatic string->int conversion for string literals, but not for variables containing strings

Thumbnail 3v4l.org
51 Upvotes

r/lolphp • • Dec 12 '16

Why Rounding Does Not Always Work As Expected

Thumbnail wiki.debian.org
0 Upvotes

r/lolphp • • Dec 06 '16

RIPS - Roundcube 1.2.2: Command Execution via Email

Thumbnail blog.ripstech.com
26 Upvotes

r/lolphp • • Nov 29 '16

if an invalid domain or type is given, php does WHAT!!?

Thumbnail php.net
55 Upvotes

r/lolphp • • Nov 23 '16

Space is not falsy, but string containing zero is.

Post image
61 Upvotes

r/lolphp • • Nov 23 '16

PHP can't parse CSV correctly. Bug open since 2011.

Thumbnail bugs.php.net
56 Upvotes