php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #47170 cast, gettype mishmash
Submitted: 2009-01-20 15:52 UTC Modified: 2009-01-21 11:18 UTC
From: lunter at interia dot pl Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 6CVS-2009-01-20 (snap) OS: all
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: lunter at interia dot pl
New email:
PHP Version: OS:

 

 [2009-01-20 15:52 UTC] lunter at interia dot pl
Description:
------------
mishmash with casting and gettype


Reproduce code:
---------------
<?
 $v=(string)'';
 print('1. variable casted as string has type: '.gettype($v).'<br>');

 $v=(unicode)'';
 print('2. variable casted as unicode has type: '.gettype($v).'<br>');

 $v=(binary)'';
 print('3. variable casted as binary has type: '.gettype($v).'<br>');
?>

Expected result:
----------------
I suggest:

1. variable casted as string has type: string (OLD PHP 5 behaviour, in PHP 6 for binary operation)
2. variable casted as unicode has type: unicode

or

1. variable casted as string has type: string (for unicode)
2. variable casted as binary has type: binary (OLD PHP 5 behaviour, in PHP 6 for binary operation)

Actual result:
--------------
1. variable casted as string has type: unicode
2. variable casted as unicode has type: unicode
3. variable casted as binary has type: string

---mishmash---
binary -> string -> unicode


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-01-21 11:18 UTC] johannes@php.net
This was discussed a lot on the developers list and decided to eep this way.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 15 08:01:31 2025 UTC