Beispiel #1
0
 public function convertToPHPValue($value, AbstractPlatform $platform)
 {
     if (null === $value) {
         return null;
     }
     try {
         return Coder::decode($value);
     } catch (\Exception $e) {
         throw ConversionException::conversionFailed($value, $this->getName());
     }
 }
Beispiel #2
0
 public function testMemoryUsage()
 {
     $var = ['a' => 'b', 'c' => null, 'd' => 'e"e', 'f' => str_repeat('0', 1024)];
     // allocate zval's
     $before = 0;
     $after = 0;
     $real_before = 0;
     $real_after = 0;
     $before = memory_get_usage();
     $real_before = memory_get_usage(true);
     for ($i = 0; $i < 10000; $i++) {
         Coder::decode(Coder::encode($var));
     }
     unset($i);
     gc_collect_cycles();
     $after = memory_get_usage();
     $real_after = memory_get_usage(true);
     if ($after > $before) {
         $this->fail(sprintf("Memory is corrupted (%d bytes not cleared)", $after - $before));
     }
     if ($real_after > $real_before) {
         $this->fail(sprintf("Real memory is corrupted (%d bytes not cleared)", $real_after - $real_before));
     }
 }
Beispiel #3
0
 public static function addHStore($label, $value)
 {
     self::$tests[$label] = [Coder::decode($value), $value];
 }