403Webshell
Server IP : 192.158.238.246  /  Your IP : 3.14.131.159
Web Server : LiteSpeed
System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64
User : jenniferflocom ( 1321)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/cpanel/ea-php80/root/usr/share/tests/pecl/igbinary/tests/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/cpanel/ea-php80/root/usr/share/tests/pecl/igbinary/tests/igbinary_058.phpt
--TEST--
Should not call __destruct if __wakeup throws an exception
--INI--
igbinary.compact_strings = On
--FILE--
<?php
class Thrower {
	public $id;
	public $throws;
	public $dynamic;
	public function __construct($id, $throws = false) {
		$this->id = $id;
		$this->throws = $throws;
		$this->dynamic = "original";
	}
	public function __wakeup() {
		printf("Calling __wakeup %s\n", $this->id);
		$this->dynamic = "copy";
		if ($this->throws) {
			throw new Exception("__wakeup threw");
		}
	}

	public function __destruct() {
		printf("Calling __destruct %s dynamic=%s\n", $this->id, $this->dynamic);
	}
}
function main() {
	$a = new Thrower("a", true);
	$serialized = igbinary_serialize($a);
	try {
		igbinary_unserialize($serialized);
	} catch (Exception $e) {
		printf("Caught %s\n", $e->getMessage());
	}
	$a = null;
	print("Done a\n");
	$b = new Thrower("b", false);
	$serialized = igbinary_serialize($b);
	$bCopy = igbinary_unserialize($serialized);
	print("Unserialized b\n");
	var_dump($bCopy);

	$bCopy = null;
	$b = null;
	print("Done b\n");
}
main();
--EXPECT--
Calling __wakeup a
Caught __wakeup threw
Calling __destruct a dynamic=original
Done a
Calling __wakeup b
Unserialized b
object(Thrower)#2 (3) {
  ["id"]=>
  string(1) "b"
  ["throws"]=>
  bool(false)
  ["dynamic"]=>
  string(4) "copy"
}
Calling __destruct b dynamic=copy
Calling __destruct b dynamic=original
Done b

Youez - 2016 - github.com/yon3zu
LinuXploit