Page MenuHomePhabricator

Add a linter rule to prevent the __lambda_func function from being redeclared
ClosedPublic

Authored by joshuaspence on May 15 2015, 11:42 PM.
Tags
None
Referenced Files
F19543552: D12870.id31004.diff
Thu, Jan 22, 9:10 PM
F19533492: D12870.diff
Tue, Jan 20, 6:05 PM
F19524189: D12870.id30957.diff
Sat, Jan 17, 10:56 PM
F19472365: D12870.id30957.diff
Wed, Jan 7, 5:14 AM
F19209774: D12870.diff
Dec 17 2025, 12:19 AM
F18631592: D12870.id31004.diff
Sep 16 2025, 3:49 PM
F18623998: D12870.id31003.diff
Sep 15 2025, 6:24 PM
F18598267: D12870.diff
Sep 13 2025, 4:41 AM
Subscribers

Details

Summary

See http://phpsadness.com/sad/39. Declaring a function named __lambda_func prevents the create_function function from working. This is because create_function eval-declares the function __lambda_func, then modifies the symbol table so that the function is instead named "\0lambda_".(++$i), and returns that name.

NOTE: Personally, I don't think that anyone should use create_function. However, despite this, I think it is reasonable that no function is named __lambda_func in case some external library relies on create_function.
Test Plan

Added test case.

Diff Detail

Repository
rARC Arcanist
Branch
master
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 6023
Build 6043: [Placeholder Plan] Wait for 30 Seconds

Event Timeline

joshuaspence retitled this revision from to Add a linter rule to prevent the __lambda_func function from being redeclared.
joshuaspence updated this object.
joshuaspence edited the test plan for this revision. (Show Details)
joshuaspence added a reviewer: epriestley.
epriestley edited edge metadata.
This revision is now accepted and ready to land.May 17 2015, 12:57 PM
This revision was automatically updated to reflect the committed changes.