php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #65261 documentation needs updating
Submitted: 2013-07-14 11:10 UTC Modified: 2013-12-16 21:41 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: knight_adi2000 at yahoo dot com Assigned:
Status: Wont fix Package: Documentation problem
PHP Version: Irrelevant OS: win 7 ultimate 32 bits
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2013-07-14 11:10 UTC] knight_adi2000 at yahoo dot com
Description:
------------
---
From manual page: http://www.php.net/language.oop5.decon
---

An issue that is not present anywhere in the documentation , please have an 
official stand regarding this .

Test script:
---------------
<?php
class testing_name
{
	/*
	public function __construct() {	echo "Constructor function"; }
	*/
	
	public function testing_name()
	{
		echo "Function testing_name";
	}
	
} //End of class
$var = new testing_name();
?>

Expected result:
----------------
When the object testing_name is created nothing else should happen .


Actual result:
--------------
In php 5.4.7 on windows 7 ultimate 32 bits , because the constructor is not 
present and the function name matches the class name , when the object is created 
, the function automaticly is called .
If the constructor is present , than the result is a natural result and everything 
works fine .

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-07-15 08:05 UTC] niel at gmail dot com
I don't really understand your point here. This behaviour is covered in the page 
for constructor/deconstructors:

http://php.net/manual/en/language.oop5.decon.php

"For backwards compatibility, if PHP 5 cannot find a __construct() function for 
a given class, and the class did not inherit one from a parent class, it will 
search for the old-style constructor function, by the name of the class. 
Effectively, it means that the only case that would have compatibility issues is 
if the class had a method named __construct() which was used for different 
semantics."
 [2013-12-16 21:41 UTC] philstu@php.net
-Status: Open +Status: Wont fix
 [2013-12-16 21:41 UTC] philstu@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

This behavior is documented here:

http://php.net/manual/en/language.oop5.decon.php
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed May 22 19:01:31 2024 UTC