php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68919 the binary cast returns string
Submitted: 2015-01-27 12:34 UTC Modified: 2015-01-27 12:58 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: wallacemaxters at gmail dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.4.37 OS: Windows 7
Private report: No CVE-ID: None
 [2015-01-27 12:34 UTC] wallacemaxters at gmail dot com
Description:
------------
I'm having trouble using the Binary Cast.

When I try to use the Cast to convert a string (or any other amount) in binary, the result is always the initial.

Even used the example of this page:
http://php.net/manual/pt_BR/language.types.type-juggling.php

And nothing worked as it should.

I did the tests both in 5.14.17 PHP as of PHP 5.6. The results were the same.

Test script:
---------------
<?php

$string = "My Simple String";

var_dump((binary) $string; // string(16) "My Simple String"



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-01-27 12:58 UTC] nikic@php.net
-Status: Open +Status: Not a bug
 [2015-01-27 12:58 UTC] nikic@php.net
(binary) is a forward-compatibility token for the now abandoned PHP 6. It behaves the same way as doing a (string) cast in PHP 5.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 17:01:31 2024 UTC