Author: ralfbecker
New Revision: 55527
URL: http://svn.stylite.de/viewvc/egroupware?rev=55527&view=rev
Log:
for PHP 7.0+ prefer new 2. unserialize parameter [“allowed_classes”=>false] for our php_safe_unserialize over our regular expression solution giving some false positives
Modified:
trunk/phpgwapi/inc/common_functions.inc.php
— trunk/phpgwapi/inc/common_functions.inc.php (original)
+++ trunk/phpgwapi/inc/common_functions.inc.php Sun Mar 27 10:41:04 2016
@@ -1703,15 +1703,22 @@
*
- Should be used for all external content, to guard against exploidts.
-
-
error_log(__METHOD__."('$str') contains objects --> return NULL");
return null; // null, not false, to not trigger behavior of returning string itself to app code
}
return unserialize($str);
@@ -1727,19 +1734,39 @@
“O:20:“Horde_Prefs_Identity”:2:{s:9:”\x00*\x00_prefs";O:11:“Horde_Prefs”:2:{s:8:"\x00*\x00_opts";a:1:{s:12:“sizecallback”;" => false,
“a:2:{i:0;O:12:“Horde_Config”:1:{s:13:”\x00*\x00_oldConfig";s:#{php_injection.length}:"#{php_injection}";}i:1;s:13:“readXMLConfig”;}}" => false,
‘a:6:{i:0;i:0;i:1;d:2;i:2;s:4:“ABCD”;i:3;r:3;i:4;O:8:“my_Class”:2:{s:1:“a”;r:6;s:1:“b”;N;};i:5;C:16:“SplObjectStorage”:14:{x:i:0;m:a:0:{}}’ => false,
-
serialize(new stdClass()) => false,
-
serialize(array(new stdClass(), new SplObjectStorage())) => false,
// string content, safe to unserialize
serialize('O:8:"stdClass"') => true,
serialize('C:16:"SplObjectStorage"') => true,
serialize(array('a' => 'O:8:"stdClass"', 'b' => 'C:16:"SplObjectStorage"')) => true,
-
if (PHP_VERSION >= 7)
-
{
-
if (preg_match_all('/([^ ]+) Object\(/', array2string($r), $matches))
-
{
-
foreach($matches[1] as $class)
-
{
-
if (!preg_match('/^__PHP_Incomplete_Class(#\d+)?$/', $class))
-
{
-
echo "FAILED: $str\n";
-
continue 2;
-
}
-
}
-
}
-
echo "passed: ".array2string($str)." = ".array2string($r)."\n";
-
}
-
else
-
{
-
echo "FAILED: $str\n";
-
}
}
else
{
@@ -1750,6 +1777,7 @@
{
echo “passed: $str\n”;
}
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785351&iu=/4140
eGroupWare-cvs mailing list
eGroupWare-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/egroupware-cvs