~ufirst/phpredis/igbinary

« back to all changes in this revision

Viewing changes to igbinary-1.2.1/tests/igbinary_015b.phpt

  • Committer: Michael Ruoss
  • Date: 2015-03-18 14:12:19 UTC
  • Revision ID: git-v1:c591bdc61de714458440ff13454bc51d94ab5f3d
new build info structure

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
--TEST--
 
2
Check for serialization handler, ini-directive
 
3
--SKIPIF--
 
4
<?php
 
5
if (!extension_loaded('session')) {
 
6
        exit('skip session extension not loaded');
 
7
}
 
8
 
 
9
ob_start(); 
 
10
phpinfo(INFO_MODULES);
 
11
$str = ob_get_clean();
 
12
 
 
13
$array = explode("\n", $str); 
 
14
$array = preg_grep('/^igbinary session support.*yes/', $array); 
 
15
if (!$array) {
 
16
        exit('skip igbinary session handler not available');
 
17
}
 
18
 
 
19
--INI--
 
20
--FILE--
 
21
<?php 
 
22
ini_set('session.serialize_handler', 'igbinary');
 
23
 
 
24
$output = '';
 
25
 
 
26
function open($path, $name) {
 
27
        return true;
 
28
}
 
29
 
 
30
function close() {
 
31
        return true;
 
32
}
 
33
 
 
34
function read($id) {
 
35
        global $output;
 
36
        return pack('H*', '0000000214011103666f6f0601');
 
37
}
 
38
 
 
39
function write($id, $data) {
 
40
        global $output;
 
41
        $output .= substr(bin2hex($data), 8). "\n";
 
42
        return true;
 
43
}
 
44
 
 
45
function destroy($id) {
 
46
        return true;
 
47
}
 
48
 
 
49
function gc($time) {
 
50
        return true;
 
51
}
 
52
 
 
53
session_set_save_handler('open', 'close', 'read', 'write', 'destroy', 'gc');
 
54
 
 
55
session_start();
 
56
 
 
57
echo ++$_SESSION['foo'], "\n";
 
58
 
 
59
session_write_close();
 
60
 
 
61
echo $output;
 
62
 
 
63
/*
 
64
 * you can add regression tests for your extension here
 
65
 *
 
66
 * the output of your test code has to be equal to the
 
67
 * text in the --EXPECT-- section below for the tests
 
68
 * to pass, differences between the output and the
 
69
 * expected text are interpreted as failure
 
70
 *
 
71
 * see php5/README.TESTING for further information on
 
72
 * writing regression tests
 
73
 */
 
74
?>
 
75
--EXPECT--
 
76
2
 
77
14011103666f6f0602