fix php serialization
This commit is contained in:
parent
d93ed6109d
commit
6fe182313e
|
@ -88,8 +88,6 @@ new class() {
|
|||
fclose($handle);
|
||||
echo "done\n";
|
||||
}
|
||||
|
||||
//echo "new TldDesc.php: $newTldDescFile\n";
|
||||
|
||||
echo "generating new 'TldDesc.php' file...";
|
||||
|
||||
|
@ -102,9 +100,9 @@ new class() {
|
|||
}
|
||||
|
||||
$tldDescExport = var_export($tldDesc, true);
|
||||
$tldDescExport = str_replace('array','',$tldDescExport);
|
||||
$tldDescExport = str_replace('(','[',$tldDescExport);
|
||||
$tldDescExport = str_replace(')',']',$tldDescExport);
|
||||
$tldDescExport = substr($tldDescExport,strlen("array ("));
|
||||
$tldDescExport = substr($tldDescExport,0,-1);
|
||||
$tldDescExport = ' ['.$tldDescExport.']';
|
||||
|
||||
if (false === file_put_contents($newTldDescFile, $tldDescExport,\FILE_APPEND)) {
|
||||
static::_echo_error("(FATAL) failed to write to new 'TldDesc.php' file",1);
|
||||
|
|
|
@ -103,9 +103,9 @@ new class() {
|
|||
];
|
||||
|
||||
$tldInfoElem = var_export($tldInfoElem, true);
|
||||
$tldInfoElem = str_replace('array','',$tldInfoElem);
|
||||
$tldInfoElem = str_replace('(','[',$tldInfoElem);
|
||||
$tldInfoElem = str_replace(')',']',$tldInfoElem);
|
||||
$tldInfoElem = substr($tldInfoElem,strlen("array ("));
|
||||
$tldInfoElem = substr($tldInfoElem,0,-1);
|
||||
$tldInfoElem = ' ['.$tldInfoElem.']';
|
||||
|
||||
if ($i!=0) {
|
||||
$tldInfoElem = ",\n$tldInfoElem";
|
||||
|
|
|
@ -97,16 +97,19 @@ new class() {
|
|||
static::_echo_error("(FATAL) failed to write to new 'TldList.php' file",1);
|
||||
}
|
||||
|
||||
$tldEnumExport = var_export($tldEnum, true);
|
||||
$tldEnumExport = str_replace('array','',$tldEnumExport);
|
||||
$tldEnumExport = str_replace('(','[',$tldEnumExport);
|
||||
$tldEnumExport = str_replace(')',']',$tldEnumExport);
|
||||
$tldEnumExport = str_replace('=>','',$tldEnumExport);
|
||||
$tldEnumExport = preg_replace('/[0-9]+/', '', $tldEnumExport);
|
||||
$tldEnumExport = var_export($tldEnum,true);
|
||||
$tldEnumExport = substr($tldEnumExport,strlen("array ("));
|
||||
$tldEnumExport = substr($tldEnumExport,0,-1);
|
||||
$tldEnumLine = [];
|
||||
$i=0;
|
||||
foreach(explode("\n",$tldEnumExport) as $line) {
|
||||
$filteredLine = preg_replace('/[0-9]+ => \'/', "'", $line);
|
||||
$tldEnumLine []= $filteredLine;
|
||||
$i++;
|
||||
}
|
||||
unset($line);
|
||||
|
||||
//$tldEnumExport = json_encode($tldEnum,\JSON_PRETTY_PRINT);
|
||||
|
||||
if (false === file_put_contents($newTldEnumFile, $tldEnumExport,\FILE_APPEND)) {
|
||||
if (false === file_put_contents($newTldEnumFile, " [".implode("\n",$tldEnumLine)."]",\FILE_APPEND)) {
|
||||
static::_echo_error("(FATAL) failed to write to new 'TldList.php' file",1);
|
||||
}
|
||||
|
||||
|
|
|
@ -102,9 +102,9 @@ new class() {
|
|||
}
|
||||
|
||||
$tldTypeExport = var_export($tldType, true);
|
||||
$tldTypeExport = str_replace('array','',$tldTypeExport);
|
||||
$tldTypeExport = str_replace('(','[',$tldTypeExport);
|
||||
$tldTypeExport = str_replace(')',']',$tldTypeExport);
|
||||
$tldTypeExport = substr($tldTypeExport,strlen("array ("));
|
||||
$tldTypeExport = substr($tldTypeExport,0,-1);
|
||||
$tldTypeExport = ' ['.$tldTypeExport.']';
|
||||
|
||||
if (false === file_put_contents($newTldTypeFile, $tldTypeExport,\FILE_APPEND)) {
|
||||
static::_echo_error("(FATAL) failed to write to new 'TldType.php' file",1);
|
||||
|
|
Loading…
Reference in New Issue