Fix spl_autoload_unregister($unused_but_valid_handler)
commit379a930d4944694e4bacbd9f2ddb5ff0575cf929
authorFred Emmott <fredemmott@fb.com>
Mon, 27 Jan 2014 23:19:20 +0000 (27 15:19 -0800)
committerSara Golemon <sgolemon@fb.com>
Tue, 28 Jan 2014 23:37:39 +0000 (28 15:37 -0800)
tree2c7217b4e4406d1a958d760d2e2d58926d65c687
parentf2f8c75444cea358caa920964d9197835379bbee
Fix spl_autoload_unregister($unused_but_valid_handler)

If a valid handler is passed in, but wasn't registered, we'd just remove the last one:

- find_if() would return ::end()
- erase() treats that to mean erase the last one

Behavior in the new test was:
- correctly remove 'b'
- incorrectly remove 'a' when asked to remove 'b' again
- segfault when asked to remove 'b' a third time

Reviewed By: @ptarjan

Differential Revision: D1145531
hphp/runtime/base/builtin-functions.cpp
hphp/test/slow/autoload/unregister_unused_handler.php [new file with mode: 0644]
hphp/test/slow/autoload/unregister_unused_handler.php.expect [new file with mode: 0644]