|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46204 Anonymous function segfaults when used in spl_autoload_register
Submitted: 2008-09-30 17:48 UTC Modified: 2009-05-25 11:54 UTC
From: north at sublink dot ca Assigned:
Status: Not a bug Package: Reproducible crash
PHP Version: 5.3.0alpha4-dev OS: linux 2.6
Private report: No CVE-ID: None
 [2008-09-30 17:48 UTC] north at sublink dot ca
Using an lambda function as the argument to spl_autoload_register causes a segfault.

When storing the lambda function in a variable though, it works fine:

$l = function($name){};
new O();

Using a default install.

Reproduce code:
new O();

Expected result:
Fatal error: Class 'O' not found

Actual result:
Segmentation fault.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-10-01 23:25 UTC]
Please try using this CVS snapshot:
For Windows (zip):

For Windows (installer):

I can't reproduce it.
 [2008-10-02 00:02 UTC] north at sublink dot ca
I've tried using the latest snapshot of 5.3 (php5.3-200810012230)

PHP 5.3.0alpha3-dev (cli) (built: Oct  1 2008 16:52:06) 
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2008 Zend Technologies

This still causes a segfault:

php -r 'spl_autoload_register(function($n){});new T();'

I`m running Ubuntu 8.04.1 inside of VirtualBox 2.0.2

Let me know if there is any other information that would be helpful.
 [2008-10-02 00:09 UTC] north at sublink dot ca
Tested on php5.3-win32-200809251104, and it worked as expected. No segfault.

Anything else I should try?
 [2008-10-09 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2008-10-18 17:58 UTC]
Ok, thanks.
 [2009-01-14 22:06 UTC] north at sublink dot ca
I've tried the 2009-01-14 snapshot on linux again, and the code is still causing a segmentation fault.

Just to be clear: it segfaults in linux, but not in windows.

Here is the code again to reproduce the bug:

# php -r 'spl_autoload_register(function($n){});new T();'
Segmentation fault

And the php version:

# php -v
PHP 5.3.0alpha4-dev (cli) (built: Jan 14 2009 01:06:21)

I'm not sure this should be marked as Bogus.
 [2009-05-25 11:54 UTC] north at sublink dot ca
Tried again with PHP5.3RC1, and it's fixed!
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Nov 27 09:03:13 2021 UTC