Patch for RT#83392

Attached is the patch and a simple test case.