mirror of
https://github.com/php/php-src.git
synced 2025-08-18 06:58:55 +02:00

This patch adds missing newlines, trims multiple redundant final newlines into a single one, and trims redundant leading newlines in all *.phpt sections. According to POSIX, a line is a sequence of zero or more non-' <newline>' characters plus a terminating '<newline>' character. [1] Files should normally have at least one final newline character. C89 [2] and later standards [3] mention a final newline: "A source file that is not empty shall end in a new-line character, which shall not be immediately preceded by a backslash character." Although it is not mandatory for all files to have a final newline fixed, a more consistent and homogeneous approach brings less of commit differences issues and a better development experience in certain text editors and IDEs. [1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206 [2] https://port70.net/~nsz/c/c89/c89-draft.html#2.1.1.2 [3] https://port70.net/~nsz/c/c99/n1256.html#5.1.1.2
81 lines
1.8 KiB
PHP
81 lines
1.8 KiB
PHP
--TEST--
|
|
Test basic function : variation2
|
|
--INI--
|
|
session.use_strict_mode=1
|
|
session.save_handler=files
|
|
session.hash_bits_per_character=4
|
|
session.gc_probability=1
|
|
session.gc_divisor=1000
|
|
session.gc_maxlifetime=300
|
|
session.save_path=
|
|
session.sid_length=32
|
|
session.name=PHPSESSID
|
|
--SKIPIF--
|
|
<?php include('skipif.inc'); ?>
|
|
--FILE--
|
|
<?php
|
|
|
|
ob_start();
|
|
|
|
/*
|
|
* Prototype : session.use_strict_mode=1
|
|
* Description : Test basic functionality.
|
|
* Source code : ext/session/session.c, ext/session/mod_files.c
|
|
*/
|
|
|
|
echo "*** Testing basic session functionality : variation2 ***\n";
|
|
|
|
$session_id = 'testid';
|
|
session_id($session_id);
|
|
$path = dirname(__FILE__);
|
|
var_dump(session_save_path($path));
|
|
|
|
echo "*** Without lazy_write ***\n";
|
|
var_dump(session_id($session_id));
|
|
var_dump(session_start(['lazy_write'=>FALSE]));
|
|
$session_id_new1 = session_id();
|
|
var_dump($session_id_new1 !== $session_id);
|
|
var_dump(session_write_close());
|
|
var_dump(session_id());
|
|
|
|
echo "*** With lazy_write ***\n";
|
|
var_dump(session_id($session_id));
|
|
var_dump(session_start(['lazy_write'=>TRUE]));
|
|
$session_id_new2 = session_id();
|
|
var_dump($session_id_new1 !== $session_id_new2);
|
|
var_dump(session_commit());
|
|
var_dump(session_id());
|
|
|
|
echo "*** Cleanup ***\n";
|
|
ini_set('session.use_strict_mode',0);
|
|
var_dump(session_id($session_id_new1));
|
|
var_dump(session_start());
|
|
var_dump(session_destroy());
|
|
var_dump(session_id($session_id_new2));
|
|
var_dump(session_start());
|
|
var_dump(session_destroy());
|
|
|
|
ob_end_flush();
|
|
?>
|
|
--EXPECTF--
|
|
*** Testing basic session functionality : variation2 ***
|
|
string(0) ""
|
|
*** Without lazy_write ***
|
|
string(6) "testid"
|
|
bool(true)
|
|
bool(true)
|
|
bool(true)
|
|
string(32) "%s"
|
|
*** With lazy_write ***
|
|
string(32) "%s"
|
|
bool(true)
|
|
bool(true)
|
|
bool(true)
|
|
string(32) "%s"
|
|
*** Cleanup ***
|
|
string(32) "%s"
|
|
bool(true)
|
|
bool(true)
|
|
string(0) ""
|
|
bool(true)
|
|
bool(true)
|