php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #34397 __sleep and __wakeup documented badly
Submitted: 2005-09-06 21:36 UTC Modified: 2005-09-20 14:50 UTC
From: stochnagara at hotmail dot com Assigned:
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: stochnagara at hotmail dot com
New email:
PHP Version: OS:

 

 [2005-09-06 21:36 UTC] stochnagara at hotmail dot com
Description:
------------
The magic methods __sleep and __wakeup are badly documented.
They have their descriptions but their prototypes are not shown. Also there is no sample code for their usage.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-09-20 14:50 UTC] vrana@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.

<?php
class Connection {
    protected $link;
    private $server, $username, $password, $db;
    
    public function __construct($server, $username, $password, $db)
    {
        $this->server = $server;
        $this->username = $username;
        $this->password = $password;
        $this->db = $db;
        $this->connect();
    }
    
    private function connect()
    {
        $this->link = mysql_connect($this->server, $this->username, $this->password);
        mysql_select_db($this->db, $this->link);
    }
    
    public function __sleep()
    {
        mysql_close($this->link);
    }
    
    public function __wakeup()
    {
        $this->connect();
    }
}
?>

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 16 15:01:32 2024 UTC