Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113436 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 73637 invoked from network); 10 Mar 2021 16:18:19 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 10 Mar 2021 16:18:19 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id DEB711804E2 for ; Wed, 10 Mar 2021 08:10:35 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: ** X-Spam-Status: No, score=2.4 required=5.0 tests=BAYES_00,BODY_8BITS, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_PASS,SPF_SOFTFAIL autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from smtp36.i.mail.ru (smtp36.i.mail.ru [94.100.177.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 10 Mar 2021 08:10:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xakep.ru; s=mailru; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:References:To:Subject:From:Subject:Content-Type:Content-Transfer-Encoding:To:Cc; bh=FqlX8ZibzJF9StwSWFWyMmlhA+CHQvZRSBQWxIMfH0o=; b=GHRDwauRs3D/Sg4nhB1QjylmoSy5oUjnnx+nq6djQt8ZpbHorBD1j2qfrFAqz1wzw9aUsl9yu2AwufYv9aN8fEni/0BD41HmuiuaiJa7Mn/BbpKSv9VF5m2llvaYZkKJ4Uew0M5haug2cnnXBTVxpk5rs+5LaVCGKj0ESIIvmFg=; Received: by smtp36.i.mail.ru with esmtpa (envelope-from ) id 1lK1Ps-0007TA-LS for internals@lists.php.net; Wed, 10 Mar 2021 19:10:33 +0300 To: internals@lists.php.net References: Message-ID: <71867aa8-bb42-f1d6-38a7-3e512a26d873@xakep.ru> Date: Wed, 10 Mar 2021 19:10:32 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: ru Authentication-Results: smtp36.i.mail.ru; auth=pass smtp.auth=nesk@xakep.ru smtp.mailfrom=nesk@xakep.ru X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9D3134714A9BDB69B7D7089AC2F541D13D72A77FF59123A9B00894C459B0CD1B9C4944805220E568FE270FADE2FAD8CDBCE1BD6B7AF5B34C173C1DF025D8865E1 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE77E216A0E97507353EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637DC5B68A43B0CFEA28638F802B75D45FF914D58D5BE9E6BC131B5C99E7648C95C11F5982A89E0728C063AEFF96D838F572563086E53A8895EA471835C12D1D9774AD6D5ED66289B5259CC434672EE6371117882F4460429724CE54428C33FAD30A8DF7F3B2552694AC26CFBAC0749D213D2E47CDBA5A9658378DA827A17800CE7ABB305BD10C6E5099FA2833FD35BB23DF004C90652538430302FCEF25BFAB3454AD6D5ED66289B5278DA827A17800CE704D2B4009EC07134D32BA5DBAC0009BE395957E7521B51C20BC6067A898B09E4090A508E0FED62991661749BA6B97735F8CBA3D4DFAC8137CD04E86FAF290E2D7E9C4E3C761E06A7089D37D7C0E48F6CA18204E546F3947C83C798A30B85E16B57739F23D657EF2BC8A9BA7A39EFB7666BA297DBC24807EA089D37D7C0E48F6C8AA50765F79006377870F476E0DB9443EFF80C71ABB335746BA297DBC24807EA27F269C8F02392CDF35728BA47A84A54ABEDDA51113D120200306258E7E6ABB4E4A6367B16DE6309 X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975C11F5982A89E0728C063AEFF96D838F572563086E53A8895E9C2B6934AE262D3EE7EAB7254005DCEDB737A621A30BC7931E0A4E2319210D9B64D260DF9561598F01A9E91200F654B069F8FEF10F1C2C2993EDB24507CE13387DFF0A840B692CF8 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D349320586B19AD2C729DB182E337D6F0711FA7A0D8833317E4A6B09CAEEF9D839FEFCEB60784D042E71D7E09C32AA3244C7B8596E094B7C30BCEBB67C7A68AC7BFFE8DA44ABE2443F73EB3F6AD6EA9203E X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojbL9S8ysBdXh4Ih/Dc5bmfg+AIw2MfNsV X-Mailru-Sender: E08AC62E989233AF58AF8F9AF109BF1111CC280DC3D0E5E73FEDE1292284895A3120E6DF4C999CC9635ED30B2AA26FE28867BBE3292FE4B3E62A69F72713162B6259666CB91CFF24C6B9D6A13518AA133453F38A29522196 X-Mras: Ok Subject: [PHP-DEV] Tracking Object Property Changes From: nesk@xakep.ru (Kirill Nesmeyanov) Hello, Joseph! I faced exactly the same problems and believe that the Observer API is necessary. To solve a similar problem, I implemented my own API over FFI, however, it does not work very stable (I have little experience in send api), but it may help to solve your problems: https://github.com/SerafimArts/Observer 09.03.2021 5:32, Joseph Montanez пишет: > I am not sure what to title this but the gist is that I have two structs > with a one way dependency: > > // Vector3 type > typedef struct Vector3 { > float x; > float y; > float z; > } Vector3; > > // Ray type (useful for raycast) > typedef struct Ray { > Vector3 position; // Ray position (origin) > Vector3 direction; // Ray direction > } Ray; > > > I've gone ahead and made a test extension here: > https://github.com/joseph-montanez/php-ext-reference-issue . I've made each > struct a PHP object. allowing me to do this: > > $position = new \skeleton\Vector3(1,2,3); > $direction = new \skeleton\Vector3(4,5,6); > > $ray = new \skeleton\Ray($position, $direction); > > echo 'Z: ', $ray->position->z, PHP_EOL; // Outputs: 3 > > $position->z = 9; > > echo 'Z: ', $ray->position->z, PHP_EOL; // Outputs: 9 > > The PHP Ray object is defined as so: > typedef struct _skeleton_ray_object { > Ray ray; > HashTable *prop_handler; > zend_object std; > > skeleton_vector3_object *position; > skeleton_vector3_object *direction; > } skeleton_ray_object; > > When I update either vector3 object, I don't have a way to propagate the > changes back to the parent object(Ray). This means the raw Ray struct is > never updated. Is there a built-in way to handle propagation (listeners) in > a PHP extension or will I need to hand roll this? > > > Thanks, > Joseph Montanez >