Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
--TEST-- SPL: SplHeap, Test spl_heap_object_count_elements (spl_heap.c:490) for returning ..
Decoded Output download
--TEST--
SPL: SplHeap, Test spl_heap_object_count_elements (spl_heap.c:490) for returning count() failure for Heaps
--CREDITS--
Chris Scott [email protected]
#testfest London 2009-05-09
--FILE--
<?php
class MyHeap extends SplHeap
{
public function compare($a,$b): int
{
return ($a < $b);
}
public function count(): int // override count to force failure
{
throw new Exception('Cause count to fail');
return parent::count();
}
}
$heap = new MyHeap();
$heap->insert(1);
try {
count($heap);// refers to MyHeap->count() method
} catch (Exception $e) {
echo "Exception: " . $e->getMessage() . "
";
}
?>
--EXPECT--
Exception: Cause count to fail
Did this file decode correctly?
Original Code
--TEST--
SPL: SplHeap, Test spl_heap_object_count_elements (spl_heap.c:490) for returning count() failure for Heaps
--CREDITS--
Chris Scott [email protected]
#testfest London 2009-05-09
--FILE--
<?php
class MyHeap extends SplHeap
{
public function compare($a,$b): int
{
return ($a < $b);
}
public function count(): int // override count to force failure
{
throw new Exception('Cause count to fail');
return parent::count();
}
}
$heap = new MyHeap();
$heap->insert(1);
try {
count($heap);// refers to MyHeap->count() method
} catch (Exception $e) {
echo "Exception: " . $e->getMessage() . "\n";
}
?>
--EXPECT--
Exception: Cause count to fail
Function Calls
None |
Stats
MD5 | 58f1e53a2f7623f2f18f70b274035e6d |
Eval Count | 0 |
Decode Time | 98 ms |