Doc #63832 [NEW]: Doc don't fully cover constr. inheritance

From: Date: Fri, 21 Dec 2012 21:03:37 +0000
Subject: Doc #63832 [NEW]: Doc don't fully cover constr. inheritance
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-9308@lists.php.net to get a copy of this message
From: jschoett at gmail dot com Operating system: Doc problem PHP version: 5.4.10 Package: Documentation problem Bug Type: Documentation Problem Bug description:Doc don't fully cover constr. inheritance Description: ------------ --- From manual page: http://www.php.net/language.oop5.decon --- I can not find a definite statement on this: "The child class inherits the constructor of the base class, iff the child class does not explicitly define an own constructor." The documentation do not cover this with: "Note: Parent constructors are not called implicitly if the child class defines a constructor" In addition, since this is an significant difference to e.g. Java, it should be documented Test script: --------------- Snippet to validate this statement (I know you already know the result): <?php class A { private $x = null; function __construct($x) { $this->x = $x; } } class B extends A { } $b1 = new B(); // Warning: Missing argument 1 for A::__construct() $b2 = new B(1); var_dump($b1); // Notice: Undefined variable: x var_dump($b2); ?> Expected result: ---------------- Same as actual, but I wan't it to be documented :) Actual result: -------------- Warning: Missing argument 1 for A::__construct(), called in path\testoutput.php on line 28 and defined in path\testoutput.php on line 21 Notice: Undefined variable: x in path\testoutput.php on line 22 object(B)#1 (1) { ["x":"A":private]=> NULL } object(B)#2 (1) { ["x":"A":private]=> int(1) } -- Edit bug report at https://bugs.php.net/bug.php?id=63832&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=63832&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=63832&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=63832&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=63832&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=63832&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=63832&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=63832&r=needscript Try newer version: https://bugs.php.net/fix.php?id=63832&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=63832&r=support Expected behavior: https://bugs.php.net/fix.php?id=63832&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=63832&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=63832&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=63832&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63832&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=63832&r=dst IIS Stability: https://bugs.php.net/fix.php?id=63832&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=63832&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=63832&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=63832&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=63832&r=mysqlcfg

« previous php.doc.bugs (#9308) next »