|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2015-07-11 07:14 UTC] landers dot robert at gmail dot com
Description: ------------ After banging my head for a bit, I've discovered that my magic __set wasn't getting called. Magic function not being called, see: https://github.com/WickedMonkeySoftware/appti2ude/commit/80e36c00a440dbe0e1a31ad75c14aee275aeba0a#diff-af625482fd8d321b53c4003a64bc2c7cR173 Test script: --------------- I've already highlighted the exact function in that link. To reproduce: git clone git@github.com:WickedMonkeySoftware/appti2ude.git appti2ude cd appti2ude composer install (doesn't do anything) ./develop.sh visit webpage/ip develop.sh requires docker, you can also just point a vhost at the cloned directory and hit index.php. Expected result: ---------------- You should see output along the lines of "Set $var" in the output. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 14 05:00:01 2025 UTC |
Here's a derived example. Looks like __set doesn't like arrays... <?php class baseClass { var $vars = []; function __get($var) { echo "got $var<br>"; var_dump($this->vars[$var]); } function __set($var, $value) { echo "set $var = $value<br>"; $this->vars[$var] = $value; echo "<pre>"; var_dump($this->vars[$var]); echo "</pre><br>"; } } $base = new baseClass(); $base->base_class = []; $base->base_class['test'] = "hi"; // this doesn't work! ?> But $var should be set to "something", it doesn't look like it is set to anything useful.