golden hour
/opt/alt/tests/alt-php71-pecl-igbinary_3.2.15-1.el9/tests
⬆️ Go Up
Upload
File/Folder
Size
Actions
__serialize_001.phpt
848 B
Del
OK
__serialize_002.phpt
478 B
Del
OK
__serialize_003.phpt
1.7 KB
Del
OK
__serialize_004.phpt
2.68 KB
Del
OK
__serialize_005.phpt
1.57 KB
Del
OK
__serialize_006.phpt
1.2 KB
Del
OK
__serialize_007.phpt
1.48 KB
Del
OK
__serialize_008.phpt
1.56 KB
Del
OK
__serialize_009.phpt
2.2 KB
Del
OK
__serialize_010.phpt
1.52 KB
Del
OK
__serialize_011.phpt
2.72 KB
Del
OK
__serialize_012.phpt
1.08 KB
Del
OK
__serialize_013.phpt
2.77 KB
Del
OK
__serialize_013_php8.phpt
2.77 KB
Del
OK
__serialize_014.phpt
1.53 KB
Del
OK
__serialize_014_php8.phpt
1.43 KB
Del
OK
__serialize_015.phpt
2.44 KB
Del
OK
__serialize_016.phpt
3.46 KB
Del
OK
__serialize_016_php8.phpt
3.91 KB
Del
OK
__serialize_017.phpt
931 B
Del
OK
__serialize_018.phpt
2.3 KB
Del
OK
__serialize_019.phpt
1.33 KB
Del
OK
__serialize_020.phpt
16.43 KB
Del
OK
__serialize_021.phpt
1.02 KB
Del
OK
__serialize_022.phpt
1023 B
Del
OK
igbinary_001.phpt
555 B
Del
OK
igbinary_002.phpt
720 B
Del
OK
igbinary_003.phpt
1.01 KB
Del
OK
igbinary_004.phpt
1.08 KB
Del
OK
igbinary_005.phpt
839 B
Del
OK
igbinary_006.phpt
886 B
Del
OK
igbinary_007.phpt
1.11 KB
Del
OK
igbinary_008.phpt
1.03 KB
Del
OK
igbinary_009.phpt
1.44 KB
Del
OK
igbinary_009b.phpt
2.55 KB
Del
OK
igbinary_009b_php8.phpt
2.99 KB
Del
OK
igbinary_010.phpt
951 B
Del
OK
igbinary_012.phpt
1.27 KB
Del
OK
igbinary_013.phpt
1024 B
Del
OK
igbinary_014.phpt
662 B
Del
OK
igbinary_015.phpt
1.33 KB
Del
OK
igbinary_015b.phpt
1.35 KB
Del
OK
igbinary_015c.phpt
1.35 KB
Del
OK
igbinary_016.phpt
1.18 KB
Del
OK
igbinary_017.phpt
1019 B
Del
OK
igbinary_018.phpt
1.32 KB
Del
OK
igbinary_020.phpt
1.13 KB
Del
OK
igbinary_021.phpt
1.35 KB
Del
OK
igbinary_022.phpt
1.97 KB
Del
OK
igbinary_022_php82.phpt
2.93 KB
Del
OK
igbinary_023.phpt
999 B
Del
OK
igbinary_024.phpt
2.22 KB
Del
OK
igbinary_025.phpt
2 KB
Del
OK
igbinary_025b.phpt
647 B
Del
OK
igbinary_026.phpt
1.26 KB
Del
OK
igbinary_026_php8.phpt
1.6 KB
Del
OK
igbinary_026b.phpt
954 B
Del
OK
igbinary_026b_php8.phpt
1.33 KB
Del
OK
igbinary_027.phpt
1.52 KB
Del
OK
igbinary_028.phpt
2.34 KB
Del
OK
igbinary_029.phpt
452 B
Del
OK
igbinary_030_php7.phpt
1.17 KB
Del
OK
igbinary_030_php72.phpt
1.17 KB
Del
OK
igbinary_031.phpt
1.78 KB
Del
OK
igbinary_032.phpt
1.37 KB
Del
OK
igbinary_033.phpt
900 B
Del
OK
igbinary_034.phpt
627 B
Del
OK
igbinary_040.phpt
1.61 KB
Del
OK
igbinary_041.phpt
2.05 KB
Del
OK
igbinary_043.phpt
1020 B
Del
OK
igbinary_044.phpt
4.64 KB
Del
OK
igbinary_045b.phpt
552 B
Del
OK
igbinary_045c.phpt
1.65 KB
Del
OK
igbinary_046.phpt
482 B
Del
OK
igbinary_046b.phpt
705 B
Del
OK
igbinary_046c.phpt
651 B
Del
OK
igbinary_046d.phpt
1.22 KB
Del
OK
igbinary_047.phpt
2.04 KB
Del
OK
igbinary_048.phpt
552 B
Del
OK
igbinary_048b.phpt
534 B
Del
OK
igbinary_049.phpt
1.8 KB
Del
OK
igbinary_049b.phpt
1.41 KB
Del
OK
igbinary_050.phpt
1.02 KB
Del
OK
igbinary_051.phpt
815 B
Del
OK
igbinary_052.phpt
1.67 KB
Del
OK
igbinary_054.phpt
1.4 KB
Del
OK
igbinary_055.phpt
669 B
Del
OK
igbinary_057.phpt
999 B
Del
OK
igbinary_058.phpt
1.36 KB
Del
OK
igbinary_058b.phpt
1.37 KB
Del
OK
igbinary_059.phpt
1.24 KB
Del
OK
igbinary_062.phpt
1.22 KB
Del
OK
igbinary_063_php7.phpt
1.2 KB
Del
OK
igbinary_063_php72.phpt
1.19 KB
Del
OK
igbinary_064.phpt
2.18 KB
Del
OK
igbinary_065.phpt
1.53 KB
Del
OK
igbinary_066.phpt
1.12 KB
Del
OK
igbinary_067.phpt
822 B
Del
OK
igbinary_068.phpt
461 B
Del
OK
igbinary_069.phpt
359 B
Del
OK
igbinary_070.phpt
802 B
Del
OK
igbinary_071.phpt
2.42 KB
Del
OK
igbinary_071_php8.phpt
2.34 KB
Del
OK
igbinary_072.phpt
1.51 KB
Del
OK
igbinary_073.phpt
1.67 KB
Del
OK
igbinary_074.phpt
1.05 KB
Del
OK
igbinary_075.phpt
943 B
Del
OK
igbinary_076.phpt
570 B
Del
OK
igbinary_077.phpt
2.33 KB
Del
OK
igbinary_078.phpt
591 B
Del
OK
igbinary_079.phpt
1.01 KB
Del
OK
igbinary_080.phpt
587 B
Del
OK
igbinary_081.phpt
1.05 KB
Del
OK
igbinary_082.phpt
513 B
Del
OK
igbinary_082_php74.phpt
835 B
Del
OK
igbinary_083.phpt
939 B
Del
OK
igbinary_084.phpt
598 B
Del
OK
igbinary_084b.phpt
930 B
Del
OK
igbinary_085.phpt
818 B
Del
OK
igbinary_086.phpt
767 B
Del
OK
igbinary_087.phpt
6.12 KB
Del
OK
igbinary_088.phpt
997 B
Del
OK
igbinary_089.phpt
911 B
Del
OK
igbinary_089_32bit.phpt
494 B
Del
OK
igbinary_090.phpt
684 B
Del
OK
igbinary_091.phpt
843 B
Del
OK
igbinary_092.phpt
1016 B
Del
OK
igbinary_093.phpt
664 B
Del
OK
igbinary_094.phpt
924 B
Del
OK
igbinary_095.phpt
2.33 KB
Del
OK
igbinary_096.phpt
513 B
Del
OK
igbinary_097.phpt
1.06 KB
Del
OK
igbinary_098.phpt
956 B
Del
OK
igbinary_099.phpt
908 B
Del
OK
igbinary_bug54662.phpt
549 B
Del
OK
igbinary_bug72134.phpt
549 B
Del
OK
igbinary_enums_1.phpt
1023 B
Del
OK
igbinary_enums_2.phpt
1.8 KB
Del
OK
igbinary_enums_3.phpt
470 B
Del
OK
igbinary_enums_3_php83.phpt
511 B
Del
OK
php82_suppress_dynamic_properties_warning.inc
677 B
Del
OK
sleep_mangled_name_clash.phpt
494 B
Del
OK
typed_property_ref_assignment_failure.phpt
733 B
Del
OK
typed_property_ref_overwrite.phpt
776 B
Del
OK
typed_property_ref_overwrite2.phpt
833 B
Del
OK
typed_property_refs.phpt
2.3 KB
Del
OK
typed_property_refs_php74.phpt
2.32 KB
Del
OK
Edit: __serialize_020.phpt
--TEST-- issue when serializing/deserializing nested objects with __serialize --SKIPIF-- <?php if (PHP_VERSION_ID < 70100) { echo "skip uses php 7.1 syntax\n"; } ?> --FILE-- <?php // Based on bug report seen in a Symfony codebase - https://github.com/igbinary/igbinary/issues/287 // NOTE: This test would also pass in older php versions, where igbinary doesn't call __serialize, // just because we're returning the same data we fetch. // (However, the serialized data generated before/after 7.4 would be incompatible if saved to memcache, etc.) class Event { } class MessageEvents { private $events = []; private $transports = []; public function add(MessageEvent $event): void { $this->events[] = $event; $this->transports[$event->getTransport()] = true; } public function getEvents(string $name = null): array { return $this->events; } } final class MessageEvent extends Event { private $propagationStopped = false; private $message; private $envelope; private $transport; private $queued; public function __construct(RawMessage $message, Envelope $envelope, string $transport, bool $queued = false) { $this->message = $message; $this->envelope = $envelope; $this->transport = $transport; $this->queued = $queued; } public function getTransport(): string { return $this->transport; } public function getMessage(): RawMessage { return $this->message; } } class Envelope { protected $sender; protected $recipients = []; protected $senderSet = false; protected $recipientsSet = false; protected $message; public function __construct(Address $sender, array $recipients) { $this->setSender($sender); $this->setRecipients($recipients); } public static function create(RawMessage $message): self { return new DelayedEnvelope($message); } public function setSender(Address $sender): void { $this->sender = $sender; } public function setRecipients(array $recipients): void { $this->recipients = []; foreach ($recipients as $recipient) { $this->recipients[] = new Address($recipient->getAddress()); } } public function getRecipients(): array { return $this->recipients; } } final class DelayedEnvelope extends Envelope { public function __construct(Message $message) { $this->message = $message; } public function setSender(Address $sender): void { parent::setSender($sender); $this->senderSet = true; } public function setRecipients(array $recipients): void { parent::setRecipients($recipients); $this->recipientsSet = parent::getRecipients(); } } final class Address { private $address; private $name; public function __construct(string $address, string $name = '') { $this->address = trim($address); $this->name = trim(str_replace(["\n", "\r"], '', $name)); } /** * @param Address|string $address */ public static function create($address): self { if ($address instanceof self) { return $address; } if (\is_string($address)) { if (false === strpos($address, '<')) { return new self($address); } return new self($matches['addrSpec'], trim($matches['displayName'], ' \'"')); } throw new InvalidArgumentException(sprintf('An address can be an instance of Address or a string ("%s" given).', get_debug_type($address))); } public static function createArray(array $addresses): array { $addrs = []; foreach ($addresses as $address) { $addrs[] = self::create($address); } return $addrs; } } abstract class AbstractHeader { private static $encoder; private $name; private $lineLength = 76; private $lang; private $charset = 'utf-8'; protected $addresses = []; public function __construct(string $name) { $this->name = $name; } public function getName() { return $this->name; } } final class Headers { private $headers = []; private $lineLength = 76; public function __construct(...$headers) { foreach ($headers as $header) { $this->add($header); } } public function __clone() { foreach ($this->headers as $name => $collection) { foreach ($collection as $i => $header) { $this->headers[$name][$i] = clone $header; } } } public function addMailboxListHeader(string $name, array $addresses): self { return $this->add(new MailboxListHeader($name, Address::createArray($addresses))); } public function add($header): self { self::checkHeaderClass($header); $name = strtolower($header->getName()); $this->headers[$name][] = $header; return $this; } public function get(string $name) { $name = strtolower($name); if (!isset($this->headers[$name])) { return null; } $values = array_values($this->headers[$name]); return array_shift($values); } public function all(string $name = null): iterable { if (null === $name) { foreach ($this->headers as $name => $collection) { foreach ($collection as $header) { yield $name => $header; } } } elseif (isset($this->headers[strtolower($name)])) { foreach ($this->headers[strtolower($name)] as $header) { yield $header; } } } public static function checkHeaderClass($header): void { $name = strtolower($header->getName()); } } final class MailboxListHeader extends AbstractHeader { public function __construct(string $name, array $addresses) { parent::__construct($name); $this->addAddresses($addresses); } public function addAddresses(array $addresses) { foreach ($addresses as $address) { $this->addAddress($address); } } /** * @throws RfcComplianceException */ public function addAddress(Address $address) { $this->addresses[] = $address; } } class RawMessage { protected $message; protected $headers; protected $body; protected $text; protected $textCharset; protected $html; protected $htmlCharset; protected $attachments = []; public function __construct($message) { $this->message = $message; } public function __serialize(): array { return [$this->message]; } public function __unserialize(array $data): void { [$this->message] = $data; } } class Message extends RawMessage { public function __construct(Headers $headers = null, AbstractPart $body = null) { $this->headers = $headers ? clone $headers : new Headers(); $this->body = $body; } public function __clone() { $this->headers = clone $this->headers; if (null !== $this->body) { $this->body = clone $this->body; } } public function getHeaders(): Headers { return $this->headers; } public function __serialize(): array { return [$this->headers]; } public function __unserialize(array $data): void { [$this->headers] = $data; } } class Email extends Message { public function to(...$addresses) { return $this->setListAddressHeaderBody('To', $addresses); } private function setListAddressHeaderBody(string $name, array $addresses) { $addresses = Address::createArray($addresses); $headers = $this->getHeaders(); $headers->addMailboxListHeader($name, $addresses); return $this; } /** * @internal */ public function __serialize(): array { return [$this->text, $this->textCharset, $this->html, $this->htmlCharset, $this->attachments, parent::__serialize()]; } /** * @internal */ public function __unserialize(array $data): void { [$this->text, $this->textCharset, $this->html, $this->htmlCharset, $this->attachments, $parentData] = $data; parent::__unserialize($parentData); } } $messageEvents = new MessageEvents(); $messageEvents->add(new MessageEvent($message1 = (new Email())->to('alice@example.com'), Envelope::create($message1), 'null://null')); $messageEvents->add(new MessageEvent($message2 = (new Email())->to('bob@example.com'), Envelope::create($message2), 'null://null')); var_dump($messageEvents); // Comment/uncomment to trigger the bug var_dump('headers_before', $messageEvents->getEvents()[0]->getMessage()->getHeaders() === $messageEvents->getEvents()[1]->getMessage()->getHeaders()); $ser = igbinary_serialize($messageEvents); $messageEvents = igbinary_unserialize($ser); // should dump "false", but dumps "true" the "var_dump($messageEvents)" is not commented var_dump('headers_after', $messageEvents->getEvents()[0]->getMessage()->getHeaders() === $messageEvents->getEvents()[1]->getMessage()->getHeaders()); ?> --EXPECT-- object(MessageEvents)#1 (2) { ["events":"MessageEvents":private]=> array(2) { [0]=> object(MessageEvent)#2 (5) { ["propagationStopped":"MessageEvent":private]=> bool(false) ["message":"MessageEvent":private]=> object(Email)#3 (8) { ["message":protected]=> NULL ["headers":protected]=> object(Headers)#4 (2) { ["headers":"Headers":private]=> array(1) { ["to"]=> array(1) { [0]=> object(MailboxListHeader)#6 (5) { ["name":"AbstractHeader":private]=> string(2) "To" ["lineLength":"AbstractHeader":private]=> int(76) ["lang":"AbstractHeader":private]=> NULL ["charset":"AbstractHeader":private]=> string(5) "utf-8" ["addresses":protected]=> array(1) { [0]=> object(Address)#5 (2) { ["address":"Address":private]=> string(17) "alice@example.com" ["name":"Address":private]=> string(0) "" } } } } } ["lineLength":"Headers":private]=> int(76) } ["body":protected]=> NULL ["text":protected]=> NULL ["textCharset":protected]=> NULL ["html":protected]=> NULL ["htmlCharset":protected]=> NULL ["attachments":protected]=> array(0) { } } ["envelope":"MessageEvent":private]=> object(DelayedEnvelope)#7 (5) { ["sender":protected]=> NULL ["recipients":protected]=> array(0) { } ["senderSet":protected]=> bool(false) ["recipientsSet":protected]=> bool(false) ["message":protected]=> object(Email)#3 (8) { ["message":protected]=> NULL ["headers":protected]=> object(Headers)#4 (2) { ["headers":"Headers":private]=> array(1) { ["to"]=> array(1) { [0]=> object(MailboxListHeader)#6 (5) { ["name":"AbstractHeader":private]=> string(2) "To" ["lineLength":"AbstractHeader":private]=> int(76) ["lang":"AbstractHeader":private]=> NULL ["charset":"AbstractHeader":private]=> string(5) "utf-8" ["addresses":protected]=> array(1) { [0]=> object(Address)#5 (2) { ["address":"Address":private]=> string(17) "alice@example.com" ["name":"Address":private]=> string(0) "" } } } } } ["lineLength":"Headers":private]=> int(76) } ["body":protected]=> NULL ["text":protected]=> NULL ["textCharset":protected]=> NULL ["html":protected]=> NULL ["htmlCharset":protected]=> NULL ["attachments":protected]=> array(0) { } } } ["transport":"MessageEvent":private]=> string(11) "null://null" ["queued":"MessageEvent":private]=> bool(false) } [1]=> object(MessageEvent)#8 (5) { ["propagationStopped":"MessageEvent":private]=> bool(false) ["message":"MessageEvent":private]=> object(Email)#9 (8) { ["message":protected]=> NULL ["headers":protected]=> object(Headers)#10 (2) { ["headers":"Headers":private]=> array(1) { ["to"]=> array(1) { [0]=> object(MailboxListHeader)#12 (5) { ["name":"AbstractHeader":private]=> string(2) "To" ["lineLength":"AbstractHeader":private]=> int(76) ["lang":"AbstractHeader":private]=> NULL ["charset":"AbstractHeader":private]=> string(5) "utf-8" ["addresses":protected]=> array(1) { [0]=> object(Address)#11 (2) { ["address":"Address":private]=> string(15) "bob@example.com" ["name":"Address":private]=> string(0) "" } } } } } ["lineLength":"Headers":private]=> int(76) } ["body":protected]=> NULL ["text":protected]=> NULL ["textCharset":protected]=> NULL ["html":protected]=> NULL ["htmlCharset":protected]=> NULL ["attachments":protected]=> array(0) { } } ["envelope":"MessageEvent":private]=> object(DelayedEnvelope)#13 (5) { ["sender":protected]=> NULL ["recipients":protected]=> array(0) { } ["senderSet":protected]=> bool(false) ["recipientsSet":protected]=> bool(false) ["message":protected]=> object(Email)#9 (8) { ["message":protected]=> NULL ["headers":protected]=> object(Headers)#10 (2) { ["headers":"Headers":private]=> array(1) { ["to"]=> array(1) { [0]=> object(MailboxListHeader)#12 (5) { ["name":"AbstractHeader":private]=> string(2) "To" ["lineLength":"AbstractHeader":private]=> int(76) ["lang":"AbstractHeader":private]=> NULL ["charset":"AbstractHeader":private]=> string(5) "utf-8" ["addresses":protected]=> array(1) { [0]=> object(Address)#11 (2) { ["address":"Address":private]=> string(15) "bob@example.com" ["name":"Address":private]=> string(0) "" } } } } } ["lineLength":"Headers":private]=> int(76) } ["body":protected]=> NULL ["text":protected]=> NULL ["textCharset":protected]=> NULL ["html":protected]=> NULL ["htmlCharset":protected]=> NULL ["attachments":protected]=> array(0) { } } } ["transport":"MessageEvent":private]=> string(11) "null://null" ["queued":"MessageEvent":private]=> bool(false) } } ["transports":"MessageEvents":private]=> array(1) { ["null://null"]=> bool(true) } } string(14) "headers_before" bool(false) string(13) "headers_after" bool(false)
Save