Re: Source type.c says settype($var, "double") is deprecated

From: Date: Sun, 06 Jan 2008 20:04:47 +0000
Subject: Re: Source type.c says settype($var, "double") is deprecated
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-34538@lists.php.net to get a copy of this message
On Jan 6, 2008 8:37 PM, Markus Fischer <markus@fischer.name> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hi, > > accidentally I came across settype() in ext/standard/type.c which says > > ~ } else if (!strcasecmp(new_type, "float")) { > ~ convert_to_double(*var); > ~ } else if (!strcasecmp(new_type, "double")) { /* deprecated */ > ~ convert_to_double(*var); > > This is the context of calling > > ~ settype($val, "double"); > > I don't understand the comment, because in gettype() there is > > ~ case IS_DOUBLE: > ~ RETVAL_ASCII_STRING("double", 1); > ~ break; > > There's no possibility that gettype() returns "float", so maybe this > comment is just in the wrong line? No, the comment is correct. "for historical [read: BC] reasons "double" is returned in case of a float, and not simply "float"" See http://docs.php.net/settype && http://docs.php.net/gettype -Hannes

« previous php.internals (#34538) next »