HEX
Server: Apache/2.4.41 (Amazon) OpenSSL/1.0.2k-fips PHP/5.6.40
System: Linux ip-172-31-40-18 4.14.146-93.123.amzn1.x86_64 #1 SMP Tue Sep 24 00:45:23 UTC 2019 x86_64
User: apache (48)
PHP: 5.6.40
Disabled: NONE
Upload Files
File: //usr/share/pear/test/igbinary/tests/tests/igbinary_042.phpt
--TEST--
Closure
--SKIPIF--
<?php
if(!extension_loaded('igbinary')) {
	echo "skip no igbinary";
}

if (version_compare(PHP_VERSION, '5.3.0') < 0) {
	echo "skip closures only for PHP 5.3.0+";
}
--FILE--
<?php 

$closure = function ($x) {
	return $x + 1;
};

class Foo implements Serializable {
	public function serialize() {
		echo "Should not be run.\n";
	}

	public function unserialize($str) {
		echo "Should not be run.\n";
	}
}

$array = array($closure, new Foo());

try {
	$ser = igbinary_serialize($array);
	echo "Serialized closure.\n";
	$unser = igbinary_unserialize($ser);
	echo "Unserialized closure.\n";
	var_dump($unser);
} catch (Exception $e) {
	echo "Got exception.\n";
}
--EXPECT--
Got exception.