ID:               29508
 User updated by:  corey at eyewantmedia dot com
 Reported By:      corey at eyewantmedia dot com
 Status:           Wont fix
 Bug Type:         Zend Engine 2 problem
 Operating System: winXP Pro
 PHP Version:      5.0.0
 New Comment:

Maybe that should be made a bit clearer.

I'm not being cynical, I am trying to help. I'd like to explain how I
came to think it was documentation.

As a new user to php, I naturally visitied php.net in sarch of some
answers.

The link in the first article on the page says to check out zend II
engines new features, and I follow the link. The first link on that
page says 

'Changes in PHP 5/Zend Engine II
By php.net - [March 22, 2004]
A well-organized listing of the changes and their use.'

I follow that and find an outdated article. That article is referenced
by the most recent article on php.net, so there is no reason for me to
think it is outdated.

Perhaps a notice should be posted on the article itself, or the link
should be moved off the front page of php, or some notation should be
made near the link to let people know that it is outdated.


Previous Comments:
------------------------------------------------------------------------

[2004-08-03 18:46:32] [EMAIL PROTECTED]

That is not documentation at all, but a very outdated article.

------------------------------------------------------------------------

[2004-08-03 18:40:35] corey at eyewantmedia dot com

Also, if type hinting with primitive types is not to be implemented,
then the zend php5 documentation is wrong. If you look under the
exceptions section, they have this snippet of code on how to extend the
exception class:


<?php
class Exception {
   function __construct(string $message=NULL, int code=0) {
       if (func_num_args()) {
           $this->message = $message;
       }
       $this->code = $code;
       $this->file = __FILE__; // of throw clause
       $this->line = __LINE__; // of throw clause
       $this->trace = debug_backtrace();
       $this->string = StringFormat($this);
   }
//... more stuff here
}
?>

You can find this code here:

http://www.zend.com/php5/articles/engine2-php5-changes.php#Heading12

That code does not run; it produces the same error as my sample class
code.

------------------------------------------------------------------------

[2004-08-03 18:39:21] [EMAIL PROTECTED]

We will not provide typehints for primitive types as PHP has automatic
typeconversion for them Also we are not adding any checks for primitive
types since that would either slow down the compile step or would
require new keywords.

------------------------------------------------------------------------

[2004-08-03 18:24:54] corey at eyewantmedia dot com

New info on the problem:

if you replace the lines 

$o->SetI(4);

with 

$test = (int)4;
$o->SetI($test);

moves the fatal argument error from the line where $o->SetI() is called
(line 15) to the first line of the function definition (line 8), but it
is still the same error. It strikes me as odd that the $test variable
passes the type hinting int check at the place where the function is
called but not where it is executed.

------------------------------------------------------------------------

[2004-08-03 18:18:22] corey at eyewantmedia dot com

While I am thinking about it, if it is decided that primitive types
cannot be used in type hinting, can php throw an error in my function
definition rather than when I try to call it? I still think primitive
type hinting is good to have, but if it won't happen, a syntax error
would be nicer than a type checking one.

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/29508

-- 
Edit this bug report at http://bugs.php.net/?id=29508&edit=1

Reply via email to