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