Giter VIP home page Giter VIP logo

Comments (6)

wintstar avatar wintstar commented on May 20, 2024 13

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.

tennom avatar tennom commented on May 20, 2024 5

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.

jtangu avatar jtangu commented on May 20, 2024

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.

tennom avatar tennom commented on May 20, 2024

I used a different approach. I don't think wintstar's code solves the issue.

from php-mysql-sessions.

jtangu avatar jtangu commented on May 20, 2024

from php-mysql-sessions.

arslannawaz avatar arslannawaz commented on May 20, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.