Date: 02/21/03
- Next message: say_ten at multiplay dot co dot uk: "[PHP-DOC] #22198 [Com]: date() returning incorrect date"
- Previous message: Victor Boivie: "[PHP-DOC] Syntax coloring PHP examples"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
ID: 20531
Updated by: cynic <email protected>
Reported By: tim dot lokot at printsoft dot com
Status: Open
-Bug Type: Class/Object related
+Bug Type: Documentation problem
Operating System: Win NT 4 Server
PHP Version: 4.2.3
New Comment:
this is a docuprob, as the aggregate page has an example that's illegal
in PHP.
Previous Comments:
------------------------------------------------------------------------
[2002-11-21 16:17:26] tim dot lokot at printsoft dot com
Fair enough, the docs at the url you supplied then contradict the docs
at this url:
http://www.php.net/manual/en/ref.objaggregation.php
You will find that the example I supplied came direct from your online
manual.
I know it says its experimental, but I thought we were supposed to
report these types of inconsistencies and errors so that the
experimental extensions can move to stable versions.
------------------------------------------------------------------------
[2002-11-21 00:39:39] derick <email protected>
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
Read the note under the caution block:
http://www.php.net/manual/en/language.oop.php#keyword.class
------------------------------------------------------------------------
[2002-11-20 21:50:04] tim dot lokot at printsoft dot com
The following example doesn't work, but is listed in the documentation
as being valid:
<?php
class DateTime {
function DateTime() {
// empty constructor
}
function now() {
return date("Y-m-d H:i:s");
}
}
class Report {
var $_dt = new DateTime();
// more properties ...
function Report() {
// initialization code ...
}
function generateReport() {
$dateTime = $_dt->now();
// more code ...
}
// more methods ...
}
$rep = new Report();
?>
This returns the error:
Parse error: parse error, unexpected T_NEW in test.php on line 14
I have tried this with other classes and basically it seems that you
cannot default a class property to an instatiated class unless through
the constructor. This is contrary to the documentation.
------------------------------------------------------------------------
-- Edit this bug report at http://bugs.php.net/?id=20531&edit=1-- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
- Next message: say_ten at multiplay dot co dot uk: "[PHP-DOC] #22198 [Com]: date() returning incorrect date"
- Previous message: Victor Boivie: "[PHP-DOC] Syntax coloring PHP examples"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

