Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:99751 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 99845 invoked from network); 5 Jul 2017 02:52:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Jul 2017 02:52:06 -0000 Authentication-Results: pb1.pair.com smtp.mail=tysonandre775@hotmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=tysonandre775@hotmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain hotmail.com designates 40.92.14.107 as permitted sender) X-PHP-List-Original-Sender: tysonandre775@hotmail.com X-Host-Fingerprint: 40.92.14.107 mail-oln040092014107.outbound.protection.outlook.com Received: from [40.92.14.107] ([40.92.14.107:12194] helo=NAM05-DM3-obe.outbound.protection.outlook.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7F/E5-15131-1545C595 for ; Tue, 04 Jul 2017 22:52:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=ErtWwEM8m/22cdxVj+h+64L0FsaKomiES3L00W9MHLw=; b=AtmJ8qLgJwaKPdbgLfsf9ZtGhDChVd+Zh8LagoHkZ1g8u7tvx4UWB/2SHySeb0RG3qeDSvqdu2gD1PGgEr983utfy3Fvup54brh0dzGIgJyAK5zdLmOIGXra97Ki3VeSKzLYnSRYEsbvXv1cByCAfm2BYF1RWjVh9RvRb8xr3wUg/kIt3VRNoBdtKJqaUDzzCAUF+zIlMnh9T1D3Dmq99CkG/l8yNNab9khGUXaNoKi6qnN+MLsWuQ//zDD9yKZ0kSCiErNhacgRcaNQoiwAvzKwiXa1Gwz5u87LekgZvmwQaaJnMJvjFlqGqeNEMJjXqdxzIiT4JypdxLKjp+MtAw== Received: from DM3NAM05FT040.eop-nam05.prod.protection.outlook.com (10.152.98.57) by DM3NAM05HT231.eop-nam05.prod.protection.outlook.com (10.152.99.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1220.9; Wed, 5 Jul 2017 00:01:26 +0000 Received: from CO2PR07MB569.namprd07.prod.outlook.com (10.152.98.59) by DM3NAM05FT040.mail.protection.outlook.com (10.152.98.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1220.9 via Frontend Transport; Wed, 5 Jul 2017 00:01:26 +0000 Received: from CO2PR07MB569.namprd07.prod.outlook.com ([10.141.230.15]) by CO2PR07MB569.namprd07.prod.outlook.com ([10.141.230.15]) with mapi id 15.01.1220.018; Wed, 5 Jul 2017 00:01:26 +0000 To: "internals@lists.php.net" Thread-Topic: [PHP-DEV] Exposing object handles to userland Thread-Index: AQHS9R30z1+UtSjDnkKzM9jOpTbxIw== Date: Wed, 5 Jul 2017 00:01:26 +0000 Message-ID: Accept-Language: en-CA, en-US Content-Language: en-CA X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: lists.php.net; dkim=none (message not signed) header.d=none;lists.php.net; dmarc=none action=none header.from=hotmail.com; x-incomingtopheadermarker: OriginalChecksum:ED07E63152979C7C115ABE63F74F54B94E934B18F77CC010C1F56DA4C9A5BDD6;UpperCasedChecksum:FE264012C299D66EBB9DA09846BA653D7AA192469400254674FC70012229C330;SizeAsReceived:7087;Count:43 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [oXPtmh7e13024vakIaBl4tkQUQizYw/F] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM3NAM05HT231;7:G1u21VBlw8VHU4O7qDhvyiuXiEh63OxpppnHqj5f+og823TSMqSs2L56zpJ51yzTq2Gkne70cxMePkRju2xET7+bSHubWXNO24cOghsMM1bvY4mQnkppYI5mDCb+KCcRKPmWAcde9osq9rSJWXt6JNTSAKR1i2nGfRcPrLMJusHNBkkESoNafZfm2EFufm8Z/Ws5YR8/3r27TcZ/8j2ofIf78jNwcJrayq57OhOpHUw5I32YnIX0cFUBu1DWXze1hfYOYby0CP1Pr5TnXROCufrVlPbwFS+neG7wYJFY1NBvg2Q37YgFo5BjcdtS8Oifpqcz/G5L0SCqpHgA7VC2PewqQsroBXgXAQQJza9cK3IaoEAHSlOfJVgl5ApyvscoN6iVOXiosM3UigDu+8E5/hyHw/X+Gn1efmMO0OtiB5C6eUDNjxiEiPab9zfWookZ0JWgn2oaU25pZAGjDP2gSKFHBd59fuYIzLgcnvX/n1KcJ3pdxvPbQxBNonUCY5VmfoypOKH88ahyItaT6tJOxRwLr5ciScFH7xuTIZPY4WiNT/ZmoZMyNFa+RgxGdrnk8GmhwGq/PvsQWhN1WWuR+CUWuJLFjMoLccBsVTVJ13yeR9uB4FP6DOCWyGwxaX2c+FvGmBwBIZHDxffU5FHr1sU+gM0+MNNhK3mJNXbnG/QHTbmaI8Me/HUy3I5J/rsQBPAFkKMDGi3bhkEyoJEqNKsvEn4lUZxgBVbU0pS5x931VYEMWPLfRfy9ByJjC7em/r1CwUn32NUqK0XpKBo7Lg== x-incomingheadercount: 43 x-eopattributedmessage: 0 x-forefront-antispam-report: EFV:NLI;SFV:NSPM;SFS:(7070007)(98901004);DIR:OUT;SFP:1901;SCL:1;SRVR:DM3NAM05HT231;H:CO2PR07MB569.namprd07.prod.outlook.com;FPR:;SPF:None;LANG:; x-ms-office365-filtering-correlation-id: 6d50f192-90a6-4d94-3ad9-08d4c338fb2d x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(300000503095)(300135400095)(201702061074)(5061506573)(5061507331)(1603103135)(2017031320274)(2017031324274)(2017031323274)(2017031322274)(1603101448)(1601125374)(1701031045)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:DM3NAM05HT231; x-ms-traffictypediagnostic: DM3NAM05HT231: x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(444000031);SRVR:DM3NAM05HT231;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:DM3NAM05HT231; x-forefront-prvs: 0359162B6D spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: hotmail.com X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Jul 2017 00:01:26.4775 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM3NAM05HT231 Subject: RE: [PHP-DEV] Exposing object handles to userland From: tysonandre775@hotmail.com (tyson andre) There was a proposal back in 2015 to implement a function spl_object_id(object $o) : int`, which directly returns the object handle (similar to `spl_object_hash`, but as an integer, not a string). I'm interested in finishing implementing spl_object_id for php 7.2=20 I already have working code implementing spl_object_id() at https://github.com/TysonAndre/php-src/pull/1 The implementation XORs the object handle with the=20 exact same random bits that `spl_object_hash` would. Previous emails from 2015 can be seen here: - https://marc.info/?t=3D143835274500003&r=3D1&w=3D2 Previous comment by a PHP maintainer in support of `spl_object_id()` - https://marc.info/?l=3Dphp-internals&m=3D143837339210596&w=3D2 I'm unsure if an RFC is necessary. I have two pending questions. - Can two objects can have the same object id but different object handlers? (e.g. iterators of some built in classes?) I'm not familiar enough with PHP's history to be sure. - Can the the largest object handle be larger than the size of `zend_long` in 32-bit systems? Example places where this would be useful: 1. https://marc.info/?l=3Dphp-internals&m=3D143849841618494&w=3D2 2. I also recently wanted to track a large number of (cloneable) small sets of objects in an application that sometimes used a lot of mem= ory, and the fact that arrays support copy on write helped save memory relative to SplObjectHash if arrays and integer keys were used. See https://github.com/etsy/phan/pull/729#issuecomment-299289378 - Tyson Andre (tandre)=