Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@..

Decoded Output download

<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <[email protected]>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Ldap\Tests;

use PHPUnit\Framework\TestCase;
use Symfony\Component\Ldap\Entry;

class EntryTest extends TestCase
{
    public function testCaseSensitiveAttributeAccessors()
    {
        $mail = '[email protected]';
        $givenName = 'Fabien Potencier';

        $entry = new Entry('cn=fabpot,dc=symfony,dc=com', [
            'mail' => [$mail],
            'givenName' => [$givenName],
        ]);

        $this->assertFalse($entry->hasAttribute('givenname'));
        $this->assertTrue($entry->hasAttribute('givenname', false));

        $this->assertNull($entry->getAttribute('givenname'));
        $this->assertSame($givenName, $entry->getAttribute('givenname', false)[0]);

        $firstName = 'Fabien';

        $entry->setAttribute('firstName', [$firstName]);
        $this->assertSame($firstName, $entry->getAttribute('firstname', false)[0]);
        $entry->removeAttribute('firstName');
        $this->assertFalse($entry->hasAttribute('firstname', false));
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <[email protected]>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Ldap\Tests;

use PHPUnit\Framework\TestCase;
use Symfony\Component\Ldap\Entry;

class EntryTest extends TestCase
{
    public function testCaseSensitiveAttributeAccessors()
    {
        $mail = '[email protected]';
        $givenName = 'Fabien Potencier';

        $entry = new Entry('cn=fabpot,dc=symfony,dc=com', [
            'mail' => [$mail],
            'givenName' => [$givenName],
        ]);

        $this->assertFalse($entry->hasAttribute('givenname'));
        $this->assertTrue($entry->hasAttribute('givenname', false));

        $this->assertNull($entry->getAttribute('givenname'));
        $this->assertSame($givenName, $entry->getAttribute('givenname', false)[0]);

        $firstName = 'Fabien';

        $entry->setAttribute('firstName', [$firstName]);
        $this->assertSame($firstName, $entry->getAttribute('firstname', false)[0]);
        $entry->removeAttribute('firstName');
        $this->assertFalse($entry->hasAttribute('firstname', false));
    }
}

Function Calls

None

Variables

None

Stats

MD5 547bf0debafb3e4aaeb5b829ec1a90ba
Eval Count 0
Decode Time 106 ms