Re: [PHP-DEV] Scary note for gettype() in docs

2010-03-02 Thread Stan Vassilev

On 03/01/2010 11:35 PM, Stan Vassilev wrote:


Hi,

The gettype() documentation warns people that the returned string is 
subject to change.

Why is there a function that's subject to change in the API?


Because life is complicated.
Because gettype(test) returns string in 5.x and unicode in 6.0.

What exactly are you trying to fix? And what exactly are you proposing?


If I have to propose anything, that'd be for 6.0 unicode strings to return 
string and binary strings to return binary, as that is more apt for the 
real-world use cases people will find themselves in (and migrating code will 
be easier).


A PHP user stumbled onto the subject to change note and asked if it's safe 
to use. If differentiating both types of strings in 6.0 is what was 
intended, then it's perfectly safe to use, and I'll probably file an issue 
with docs to be more clear about the actual situation.


Regards,
Stan Vassilev 



--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Scary note for gettype() in docs

2010-03-02 Thread Derick Rethans
On Tue, 2 Mar 2010, Victor Bolshov wrote:

 From the user point of view it might seem that 5.x string and 6.x
 unicode are all strings, whatever you call them. Still, I am sure
 there _is_ a background for the decision to distinguish between
 string and unicode.

Yes, there *has* to be a difference between string and unicode 
because otherwise you can't distinguish between binary goo and strings.

Derick

-- 
http://derickrethans.nl | http://xdebug.org
twitter: @derickr

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Scary note for gettype() in docs

2010-03-02 Thread Richard Quadling
On 2 March 2010 10:25, Derick Rethans der...@php.net wrote:
 On Tue, 2 Mar 2010, Victor Bolshov wrote:

 From the user point of view it might seem that 5.x string and 6.x
 unicode are all strings, whatever you call them. Still, I am sure
 there _is_ a background for the decision to distinguish between
 string and unicode.

 Yes, there *has* to be a difference between string and unicode
 because otherwise you can't distinguish between binary goo and strings.

 Derick

 --
 http://derickrethans.nl | http://xdebug.org
 twitter: @derickr

 --
 PHP Internals - PHP Runtime Development Mailing List
 To unsubscribe, visit: http://www.php.net/unsub.php



So PHP6, this is a string and in PHP6+ uthis is a string and
this would be binary?

If PHP6 is unicode, then unicode strings are now the normal strings.
Binary strings are just binary data now. Maybe string and binary
string rather than unicode and string.

So string is consistent across the PHP versions.


-- 
-
Richard Quadling
Standing on the shoulders of some very clever giants!
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DEV] Scary note for gettype() in docs

2010-03-01 Thread Stan Vassilev

Hi,

The gettype() documentation warns people that the returned string is subject 
to change. Why is there a function that's subject to change in the API?

And just to clarify: I agree is_*() is better if we test for a certain type (as 
the note says). However, the use scenario for gettype() is when we do not test 
for a certain type (as in, we test for any type), which is less optimal when 
executed as 5-6 is_*() calls.

Regards, 
Stan Vassilev 

Re: [PHP-DEV] Scary note for gettype() in docs

2010-03-01 Thread Markus Fischer
On 01.03.2010 21:35, Stan Vassilev wrote:
 The gettype() documentation warns people that the returned string is subject 
 to change. Why is there a function that's subject to change in the API?

Probably because of the unicode stuff, might suddenly return unicode
(still true? don't know) or binary what was string before .. but
this is untested theory right now, but that's the kind of scenario they
mean here.

HTH

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Scary note for gettype() in docs

2010-03-01 Thread Antony Dovgal
On 03/01/2010 11:35 PM, Stan Vassilev wrote:
 
 Hi,
 
 The gettype() documentation warns people that the returned string is subject 
 to change. 
 Why is there a function that's subject to change in the API?

Because life is complicated. 
Because gettype(test) returns string in 5.x and unicode in 6.0.

What exactly are you trying to fix? And what exactly are you proposing?

-- 
Wbr,
Antony Dovgal
---
http://pinba.org - realtime statistics for PHP

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Scary note for gettype() in docs

2010-03-01 Thread Victor Bolshov
From the user point of view it might seem that 5.x string and 6.x
unicode are all strings, whatever you call them. Still, I am sure
there _is_ a background for the decision to distinguish between
string and unicode.

2 марта 2010 г. 1:27 пользователь Antony Dovgal t...@daylessday.org написал:
 On 03/01/2010 11:35 PM, Stan Vassilev wrote:

 Hi,

 The gettype() documentation warns people that the returned string is 
 subject to change.
 Why is there a function that's subject to change in the API?

 Because life is complicated.
 Because gettype(test) returns string in 5.x and unicode in 6.0.

 What exactly are you trying to fix? And what exactly are you proposing?

 --
 Wbr,
 Antony Dovgal
 ---
 http://pinba.org - realtime statistics for PHP

 --
 PHP Internals - PHP Runtime Development Mailing List
 To unsubscribe, visit: http://www.php.net/unsub.php





-- 
С уважением,
Виктор

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php