xref: /PHP-7.1/ext/mcrypt/tests/bug72535.phpt (revision 8ad71bc1)
1--TEST--
2Bug #72535 arcfour encryption stream filter crashes php
3--SKIPIF--
4<?php if (!extension_loaded("mcrypt")) print "skip"; ?>
5--FILE--
6<?php
7$passphrase = 'My secret';
8$plaintext = 'Secret secret secret data';
9
10$iv = substr(md5('iv' . $passphrase, true), 0, 8);
11$key = substr(md5('pass1' . $passphrase, true) .
12	              md5('pass2' . $passphrase, true), 0, 24);
13$opts = array('iv' => $iv, 'key' => $key, 'mode' => 'stream');
14
15$expected = substr($plaintext . $plaintext, 0, 48);
16
17$fp = fopen('php://memory', 'wb+');
18stream_filter_append($fp, 'mcrypt.arcfour', STREAM_FILTER_WRITE, $opts);
19fwrite($fp, $plaintext);
20?>
21==NOCRASH==
22--EXPECTF--
23Deprecated: stream_filter_append(): mcrypt and mdecrypt stream filters have been deprecated in %s on line %d
24==NOCRASH==
25