xref: /PHP-7.1/ext/date/tests/bug68942_2.phpt (revision 771e5cc2)
1--TEST--
2Bug #68942 (Use after free vulnerability in unserialize() with DateTime).
3--FILE--
4<?php
5$data = unserialize('a:2:{i:0;O:8:"DateTime":3:{s:4:"date";s:26:"2000-01-01 00:00:00.000000";s:13:"timezone_type";a:2:{i:0;i:1;i:1;i:2;}s:8:"timezone";s:1:"A";}i:1;R:5;}');
6var_dump($data);
7?>
8--EXPECTF--
9Fatal error: Uncaught Error: Invalid serialization data for DateTime object in %sbug68942_2.php:%d
10Stack trace:
11#0 [internal function]: DateTime->__wakeup()
12#1 %sbug68942_2.php(%d): unserialize('a:2:{i:0;O:8:"D...')
13#2 {main}
14  thrown in %sbug68942_2.php on line %d
15