note 79098 modified in function.base64-decode by danbrown
| From: | danbrown@php.net | Date: | Fri, 14 Nov 2008 21:05:45 +0000 |
| Subject: | note 79098 modified in function.base64-decode by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-146568@lists.php.net to get a copy of this message | ||
Here is a drop-in replacement for base64_decode(), based on a faster version of morgangalpin's
code:
<?php
// workaround for bug in php 4.3.11 through 4.4.7, 5.1.2 through 5.2.4 and perhaps others
(http://bugs.php.net/bug.php?id=37244)
function base64_decode_fix( $data, $strict = false )
{
if( $strict )
if( preg_match( '![^a-zA-Z0-9/+=]!', $data ) )
return( false );
return( base64_decode( $data ) );
}
?>
--was--
Here is a drop-in replacement for base64_decode(), based on a faster version of morgangalpin's
code:
// workaround for bug in php 4.3.11 through 4.4.7, 5.1.2 through 5.2.4 and perhaps others
(http://bugs.php.net/bug.php?id=37244)
function base64_decode_fix( $data, $strict = false )
{
if( $strict )
if( preg_match( '![^a-zA-Z0-9/+=]!', $data ) )
return( false );
return( base64_decode( $data ) );
}
http://php.net/manual/en/function.base64-decode.php