What potential issue arises when using realpath with an array or object instance as a parameter in PHP?

When using realpath with an array or object instance as a parameter in PHP, the function expects a string representing a file path, not an array or object. To solve this, you can extract the file path from the array or object before passing it to realpath.

// Example code to extract the file path from an array before using realpath
$fileArray = ['path' => '/path/to/file.txt'];
$filePath = $fileArray['path'];
$realPath = realpath($filePath);

// Example code to extract the file path from an object before using realpath
class File {
    public $path = '/path/to/file.txt';
}

$fileObject = new File();
$filePath = $fileObject->path;
$realPath = realpath($filePath);