php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75817 Fatal in calling session_start()
Submitted: 2018-01-15 09:44 UTC Modified: 2021-03-28 04:22 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: chensl6588 at gmail dot com Assigned: cmb (profile)
Status: No Feedback Package: *General Issues
PHP Version: 7.2.1 OS: FreeBSD-10.2-i386
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2018-01-15 09:44 UTC] chensl6588 at gmail dot com
Description:
------------
While PHP is running in FPM with chroot safe_mode, and the session.save_handler is "files".

#ext/session/mod_files.c: PS_CREATE_SID_FUNC(files)
{{
    sid = php_session_create_id((void**)&data);
}}
This statement would always return NULL to sid, because of php_random_bytes() returning FAILURE.


SOLUTION:

ext/standard/random.c: 

Line 94: #elif HAVE_DECL_ARC4RANDOM_BUF && ((defined(__FreeBSD__) || (defined(__OpenBSD__) && OpenBSD >= 201405) || (defined(__NetBSD__) && __NetBSD_Version__ >= 700000001))




Test script:
---------------
session_start();




Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-03-19 17:07 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2021-03-19 17:07 UTC] cmb@php.net
The effect to session_start() isn't the root cause, though;
re-classifying.

Anyhow, is the failing php_random_bytes() still an issue?  If so,
please provide a pull request[1] for better visibility.

[1] <https://github.com/php/php-src/pulls>
 [2021-03-19 17:07 UTC] cmb@php.net
-Package: Session related +Package: *General Issues
 [2021-03-28 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Apr 21 21:01:24 2021 UTC