Source code for file /joomla/utilities/compat/php50x.php
Documentation is available at php50x.php
* @version $Id: php50x.php 6138 2007-01-02 03:44:18Z eddiea $
* @package Joomla.Framework
* @subpackage Compatibility
* @copyright Copyright (C) 2005 - 2007 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
* PHP 5.0.x Compatibility functions
if (!defined('FILE_USE_INCLUDE_PATH')) {
define('FILE_USE_INCLUDE_PATH', 1);
* Replace file_put_contents()
* @link http://php.net/function.file_put_contents
* @version $Revision: 47 $
* @internal resource_context is not supported
function file_put_contents($filename, $content, $flags =
null, $resource_context =
null)
// If $content is an array, convert it to a string
// If we don't have a string, throw an error
trigger_error('file_put_contents() The 2nd parameter should be either a string or an array', E_USER_WARNING);
// Get the length of date to write
// Check what mode we are using
// Check if we're using the include path
// Open the file for writing
if (($fh =
@fopen($filename, $mode, $use_inc_path)) ===
false) {
trigger_error('file_put_contents() failed to open stream: Permission denied', E_USER_WARNING);
if (($bytes =
@fwrite($fh, $content)) ===
false) {
$errormsg =
sprintf('file_put_contents() Failed to write %d bytes to %s',
// Check all the data was written
$errormsg =
sprintf('file_put_contents() Only %d of %d bytes written, possibly out of free disk space.',
* Ported PHP5 function to PHP4 for forward compatibility
function clone($object) {