Comments (6)
Check this
replace
public function _read($id){
// Set query
$this->db->query('SELECT data FROM sessions WHERE id = :id');
// Bind the Id
$this->db->bind(':id', $id);
// Attempt execution
// If successful
if($this->db->execute()){
// Save returned row
$row = $this->db->single();
// Return the data
return $row['data'];
}else{
// Return an empty string
return '';
}
}
with this
public function _read($id){
// Set query
$this->db->query('SELECT data FROM sessions WHERE id = :id');
// Bind the Id
$this->db->bind(':id', $id);
// Attempt execution
// If successful
if($this->db->execute()){
// Save returned row
$row = $this->db->single();
// Return the data
if (is_null($row['data'])) {
return '';
}
return $row['data'];
}
}
works with php 7.1
from php-mysql-sessions.
Thanks for the solution. I learned that php 7.1 and above strictly requires the session read to return a string and not even a null value. That's why the error was raised. This code also raised an error when using registration-ID function. Because it follows a different action cycle in 7.1 and above I suspect, like read->close->read->write... I will post my code when i return to that problem soon.
from php-mysql-sessions.
Hi I'm having the same issue with migrating from PHP 7.0 to 7.1
I'm trying to find which file has the above stated code to update the function _read. Sorry I'm new.
from php-mysql-sessions.
I used a different approach. I don't think wintstar's code solves the issue.
from php-mysql-sessions.
from php-mysql-sessions.
I used a different approach. I don't think wintstar's code solves the issue.
Kindly share your approach here? wintstar's code do not works for me.
from php-mysql-sessions.
Related Issues (10)
- unable to regenrate id HOT 1
- PHP Warning: session_start(): open(/var/cpanel/php/sessions/ea-php83 in php v8.3 HOT 1
- PHP7.1 didn't work for me. HOT 2
- Usage among multi pages HOT 1
- $Max duration
- Warning: session_start(): Failed to read session data: user (path: /var/cpanel/php/sessions/ea-php73) HOT 6
- Bots (friendly) executes the session class and creates new db rows every second HOT 1
- error of repositories, sorry
- Warning: session_set_save_handler(): Cannot change save handler when session is active in mysql.sessions.php on line 42
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php-mysql-sessions.