Doc #77034 [Nab]: Casting null to int undefined

From: Date: Thu, 18 Oct 2018 20:43:24 +0000
Subject: Doc #77034 [Nab]: Casting null to int undefined
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-16090@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77034&edit=1 ID: 77034 Updated by: requinix@php.net Reported by: casey dot mcginty at gmail dot com Summary: Casting null to int undefined Status: Not a bug Type: Documentation Problem Package: Variables related PHP Version: 7.2.11 Block user comment: N Private report: N New Comment: But is casting null to integer really supposed to be undefined, or is it just that the doc doesn't mention null? The spec says it should be 0, which is the common sense answer. https://github.com/php/php-langspec/blob/master/spec/08-conversions.md#user-content-converting-to-integer-type Previous Comments: ------------------------------------------------------------------------ [2018-10-18 20:22:22] salathe@php.net See the section "Converting to integer" on the page you linked, particularly under the "From other types" subheading. ------------------------------------------------------------------------ [2018-10-18 17:44:01] requinix@php.net Are you actually asking that question or just implying you'd like the docs to say it? ------------------------------------------------------------------------ [2018-10-18 17:36:16] casey dot mcginty at gmail dot com Description: ------------ --- From manual page: http://www.php.net/language.types.integer --- I do not see any documentation regarding a null cast to an int. What is the official behavior? Test script: --------------- $myInt = (int)null; ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=77034&edit=1

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