Last modified: 2013-12-02 19:05:50 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T59292, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 57292 - Segfault when extending LuaSandbox on PHP 5.4 SAPI
Segfault when extending LuaSandbox on PHP 5.4 SAPI
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
Scribunto (Other open bugs)
unspecified
All All
: Unprioritized normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-11-20 09:58 UTC by Pascal Fellerich
Modified: 2013-12-02 19:05 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Pascal Fellerich 2013-11-20 09:58:38 UTC
LuaSandbox 1.6 (latest version), compiled on Debian 7, PHP 5.4.4-14+deb7u5, segfaults with the code below:

<?php
class XL extends LuaSandbox {
	// Declaring a property will result in a segfault....
	public $property;
}

$X = new XL();  // trigger the segfault
// setting a propery later does work when you remove the declaration from the class
$X->foo = 'bar';

?>

(above code works fine on deb6, PHP 5.3.3-7+squeeze17)
Comment 1 Brad Jorsch 2013-11-21 02:11:08 UTC
When I try it (PHP 5.5.5-1 in Debian unstable), both $property and the assignment to ->foo are required to segfault. Neither one alone does it.

It seems that the cause is a change in PHP 5.4 (likely c5237d82b) that changed the handling of properties so a call to object_properties_init() is required if you use a custom create_object handler. If that's documented anywhere official, I haven't been able to find it. I did find mention of the requirement (but not the change) in an online book[1] and passing mention of a related change in a blog's comments.[2]

 [1]: http://www.phpinternalsbook.com/classes_objects/custom_object_storage.html
 [2]: http://www.kchodorow.com/blog/2011/08/11/php-extensions-made-eldrich-classes/
Comment 2 Gerrit Notification Bot 2013-11-21 02:11:21 UTC
Change 96687 had a related patch set uploaded by Anomie:
Call object_properties_init in create_object handlers for PHP 5.4

https://gerrit.wikimedia.org/r/96687
Comment 3 Pascal Fellerich 2013-11-21 09:28:23 UTC
Tested the patch against PHP 5.4.4-14+deb7u5, test passes now.
Thank you!
Comment 4 Gerrit Notification Bot 2013-12-02 03:36:33 UTC
Change 96687 merged by jenkins-bot:
Call object_properties_init in create_object handlers for PHP 5.4

https://gerrit.wikimedia.org/r/96687
Comment 5 Brad Jorsch 2013-12-02 19:05:50 UTC
Change is now merged. I don't know when it will be deployed to WMF wikis, as luasandbox changes don't follow the normal deployment schedule.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links