PHP - Breaking Variable Content
as an object, I have a problem with the contents of a variable. Inside this variable is inserted a base64
file (extracted from xml) and PHP base64 to save the file to the file system. Everything is fine as long as there are small files (about 10MB) ... however base64
with a large file base64
it seems to be "broken" after 9999993 characters. I say because if I go to the debug display, the value of the variable I see the whole line base64
.
The problem is not saving the file, because the file was created and saved correctly, but the contents of the variable. Are there any restrictions for php.ini? Or are there ways to fix the problem? I have also tried splitting the string into chunks or in an array, but the problem remains.
I am using the code I am using to extract data from XML:
$reader = new XMLReader();
if (!$reader->open($GLOBALS['conf']['filepath'] . '/' . $xmlfile)) {
print "Error to open XML: $xmlfile\n";
} else {
while ($reader->read()) {
$name = $reader->name;
$type = $reader->nodeType;
if (($type == XMLReader::ELEMENT) && in_array($name, $allowedNodes)) {
$xml = $reader->readOuterXml();
$doc = new DOMDocument('1.0', 'UTF-8');
$xml = simplexml_import_dom($doc->importNode($reader->expand(), true));
//Other code
}
}
}
Note: a variable $allowedNodes
is a variable stored in a config file, so you don't see its value.
thanks for answers
source to share