|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-05-10 18:10 UTC] jani@php.net
[2009-07-11 19:15 UTC] mark at everytruckjob dot com
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 22:00:01 2025 UTC |
Description: ------------ Child class calling parent::function calls parent's php4 style constructor of same name instead of parent's public method named the same as the class. Reproduce code: --------------- <?php class search { public function __construct() { echo "<br>".__METHOD__; } protected function search() { echo "<br>".__METHOD__; } } class search2 extends search { public function __construct() { echo "<br>".__METHOD__; parent::__construct(); } public function search() { echo "<br>".__METHOD__; parent::search(); } } $search2 = new search2(); $search2->search(); ?> Expected result: ---------------- search2::__construct search::__construct search2::search search::__search Actual result: -------------- search2::__construct search::__construct search2::search search::__construct