Hello again,mrgoldy wrote: ↑Wed Jan 15, 2020 11:09 pm I had that problem too, because you use lowercase service definitions everywhere (thanksforposts
) but you declare them with capitals:ThanksForPosts
. Changing the service definitions to lowercase for the notification types solved that issue for me.
Moreover, I did look into it but had a hard time pin pointing the problem. But it's safe to assume this is not really a phpBB bug but rather within the extension. However, I had a hard time locating it as you use a different coding style than I am used to. Perhaps when I get some more time next week I can have another look.
As you have the "Extension validator" badge, I think I can talk about next issue with you to clarify if there's something I'm missing or there's a phpBB 3.3.0 bug.
I've modified <PHPBB_ROOT>/phpbb/notification/type/base.php file in my localhost to do some tests. I've added some debug on 3 functions, just as 1st lines:
Code: Select all
__construct:
echo "<br><br>constructor, object " . spl_object_hash($this) . "<br>";
set_initial_data:
echo "<br><br>set_initial_data, " . $this->get_type() . ", object " . spl_object_hash($this) . "<br>";
var_dump($data);
prepare_for_display:
echo "<br><br>prepare_for_display, " . $this->get_type() . ", object " . spl_object_hash($this) . "<br>";
var_dump($this->data);
I have 8 THANKS notifications and 2 PMs. Loading home this appears as debug:
Code: Select all
constructor, object 000000007cf39c750000000079329a6f
set_initial_data, notification.type.pm, object 000000007cf39c750000000079329a6f
array(9) { ["notification_id"]=> string(3) "666" ["notification_type_id"]=> string(2) "14" ["item_id"]=> string(2) "30" ["item_parent_id"]=> string(1) "0" ["user_id"]=> string(3) "126" ["notification_read"]=> string(1) "0" ["notification_time"]=> string(10) "1579856633" ["notification_data"]=> string(75) "a:2:{s:12:"from_user_id";s:1:"2";s:15:"message_subject";s:10:"re tretert";}" ["notification_type_name"]=> string(20) "notification.type.pm" }
constructor, object 000000007cf39c4b0000000079329a6f
set_initial_data, gfksx.thanksforposts.notification.type.thanks, object 000000007cf39c4b0000000079329a6f
array(9) { ["notification_id"]=> string(3) "665" ["notification_type_id"]=> string(1) "7" ["item_id"]=> string(3) "350" ["item_parent_id"]=> string(3) "167" ["user_id"]=> string(3) "126" ["notification_read"]=> string(1) "0" ["notification_time"]=> string(10) "1579851392" ["notification_data"]=> string(240) "a:5:{s:8:"thankers";a:1:{i:0;a:2:{s:7:"user_id";i:2;s:6:"ntimes";i:1;}}s:7:"post_id";i:350;s:8:"lang_act";s:4:"GIVE";s:12:"post_subject";s:72:"Re: Luz crepuscular con batería de litio y placas solares para su carga";s:9:"poster_id";i:126;}" ["notification_type_name"]=> string(45) "gfksx.thanksforposts.notification.type.thanks" }
constructor, object 000000007cf39c5f0000000079329a6f
set_initial_data, gfksx.thanksforposts.notification.type.thanks_remove, object 000000007cf39c5f0000000079329a6f
array(9) { ["notification_id"]=> string(3) "664" ["notification_type_id"]=> string(1) "8" ["item_id"]=> string(3) "350" ["item_parent_id"]=> string(1) "0" ["user_id"]=> string(3) "126" ["notification_read"]=> string(1) "0" ["notification_time"]=> string(10) "1579851390" ["notification_data"]=> string(242) "a:5:{s:8:"thankers";a:1:{i:0;a:2:{s:7:"user_id";i:2;s:6:"ntimes";i:1;}}s:7:"post_id";i:350;s:8:"lang_act";s:6:"REMOVE";s:12:"post_subject";s:72:"Re: Luz crepuscular con batería de litio y placas solares para su carga";s:9:"poster_id";i:126;}" ["notification_type_name"]=> string(52) "gfksx.thanksforposts.notification.type.thanks_remove" }
set_initial_data, gfksx.thanksforposts.notification.type.thanks, object 000000007cf39c4b0000000079329a6f
array(9) { ["notification_id"]=> string(3) "663" ["notification_type_id"]=> string(1) "7" ["item_id"]=> string(3) "362" ["item_parent_id"]=> string(3) "169" ["user_id"]=> string(3) "126" ["notification_read"]=> string(1) "0" ["notification_time"]=> string(10) "1579851382" ["notification_data"]=> string(204) "a:5:{s:8:"thankers";a:1:{i:0;a:2:{s:7:"user_id";i:2;s:6:"ntimes";i:1;}}s:7:"post_id";i:362;s:8:"lang_act";s:4:"GIVE";s:12:"post_subject";s:36:"Re: Transmitir en espacio analógico";s:9:"poster_id";i:126;}" ["notification_type_name"]=> string(45) "gfksx.thanksforposts.notification.type.thanks" }
set_initial_data, gfksx.thanksforposts.notification.type.thanks_remove, object 000000007cf39c5f0000000079329a6f
array(9) { ["notification_id"]=> string(3) "662" ["notification_type_id"]=> string(1) "8" ["item_id"]=> string(3) "362" ["item_parent_id"]=> string(1) "0" ["user_id"]=> string(3) "126" ["notification_read"]=> string(1) "0" ["notification_time"]=> string(10) "1579851380" ["notification_data"]=> string(206) "a:5:{s:8:"thankers";a:1:{i:0;a:2:{s:7:"user_id";i:2;s:6:"ntimes";i:1;}}s:7:"post_id";i:362;s:8:"lang_act";s:6:"REMOVE";s:12:"post_subject";s:36:"Re: Transmitir en espacio analógico";s:9:"poster_id";i:126;}" ["notification_type_name"]=> string(52) "gfksx.thanksforposts.notification.type.thanks_remove" }
set_initial_data, gfksx.thanksforposts.notification.type.thanks_remove, object 000000007cf39c5f0000000079329a6f
array(9) { ["notification_id"]=> string(3) "661" ["notification_type_id"]=> string(1) "8" ["item_id"]=> string(3) "438" ["item_parent_id"]=> string(1) "0" ["user_id"]=> string(3) "126" ["notification_read"]=> string(1) "0" ["notification_time"]=> string(10) "1579851370" ["notification_data"]=> string(275) "a:5:{s:8:"thankers";a:1:{i:0;a:2:{s:7:"user_id";i:2;s:6:"ntimes";i:1;}}s:7:"post_id";i:438;s:8:"lang_act";s:6:"REMOVE";s:12:"post_subject";s:104:"Re: Tira de LEDs usando cable de cobre esmaltado, una pila y un ladrón de julios (oscilador de bloqueo)";s:9:"poster_id";i:126;}" ["notification_type_name"]=> string(52) "gfksx.thanksforposts.notification.type.thanks_remove" }
set_initial_data, gfksx.thanksforposts.notification.type.thanks_remove, object 000000007cf39c5f0000000079329a6f
array(9) { ["notification_id"]=> string(3) "654" ["notification_type_id"]=> string(1) "8" ["item_id"]=> string(3) "495" ["item_parent_id"]=> string(1) "0" ["user_id"]=> string(3) "126" ["notification_read"]=> string(1) "0" ["notification_time"]=> string(10) "1579851364" ["notification_data"]=> string(285) "a:5:{s:8:"thankers";a:1:{i:0;a:2:{s:7:"user_id";i:2;s:6:"ntimes";i:1;}}s:7:"post_id";i:495;s:8:"lang_act";s:6:"REMOVE";s:12:"post_subject";s:114:"Re: uTimerLib - Librería Arduino para eventos temporizados en todos los microcontroladores soportados por Arduino";s:9:"poster_id";i:126;}" ["notification_type_name"]=> string(52) "gfksx.thanksforposts.notification.type.thanks_remove" }
set_initial_data, gfksx.thanksforposts.notification.type.thanks_remove, object 000000007cf39c5f0000000079329a6f
array(9) { ["notification_id"]=> string(3) "660" ["notification_type_id"]=> string(1) "8" ["item_id"]=> string(3) "642" ["item_parent_id"]=> string(1) "0" ["user_id"]=> string(3) "126" ["notification_read"]=> string(1) "0" ["notification_time"]=> string(10) "1579851358" ["notification_data"]=> string(256) "a:5:{s:8:"thankers";a:1:{i:0;a:2:{s:7:"user_id";i:2;s:6:"ntimes";i:1;}}s:7:"post_id";i:642;s:8:"lang_act";s:6:"REMOVE";s:12:"post_subject";s:86:"Re: Microcontroladores basados en ESP32: Configuración Arduino IDE y características";s:9:"poster_id";i:126;}" ["notification_type_name"]=> string(52) "gfksx.thanksforposts.notification.type.thanks_remove" }
constructor, object 000000007cf39faf0000000079329a6f
set_initial_data, notification.type.pm, object 000000007cf39faf0000000079329a6f
array(9) { ["notification_id"]=> string(3) "659" ["notification_type_id"]=> string(2) "14" ["item_id"]=> string(2) "29" ["item_parent_id"]=> string(1) "0" ["user_id"]=> string(3) "126" ["notification_read"]=> string(1) "0" ["notification_time"]=> string(10) "1578924701" ["notification_data"]=> string(76) "a:2:{s:12:"from_user_id";s:1:"2";s:15:"message_subject";s:11:"Advertencia";}" ["notification_type_name"]=> string(20) "notification.type.pm" }
set_initial_data, gfksx.thanksforposts.notification.type.thanks, object 000000007cf39c4b0000000079329a6f
array(9) { ["notification_id"]=> string(3) "655" ["notification_type_id"]=> string(1) "7" ["item_id"]=> string(3) "495" ["item_parent_id"]=> string(3) "191" ["user_id"]=> string(3) "126" ["notification_read"]=> string(1) "0" ["notification_time"]=> string(10) "1578660277" ["notification_data"]=> string(283) "a:5:{s:8:"thankers";a:1:{i:0;a:2:{s:7:"user_id";i:2;s:6:"ntimes";i:1;}}s:7:"post_id";i:495;s:8:"lang_act";s:4:"GIVE";s:12:"post_subject";s:114:"Re: uTimerLib - Librería Arduino para eventos temporizados en todos los microcontroladores soportados por Arduino";s:9:"poster_id";i:126;}" ["notification_type_name"]=> string(45) "gfksx.thanksforposts.notification.type.thanks" }
constructor, object 000000007cf39fbd0000000079329a6f
set_initial_data, notification.type.pm, object 000000007cf39fbd0000000079329a6f
array(0) { }
set_initial_data, gfksx.thanksforposts.notification.type.thanks, object 000000007cf39c4b0000000079329a6f
array(0) { }
set_initial_data, gfksx.thanksforposts.notification.type.thanks_remove, object 000000007cf39c5f0000000079329a6f
array(0) { }
prepare_for_display, notification.type.pm, object 000000007cf39c750000000079329a6f
array(9) { ["notification_id"]=> string(3) "666" ["notification_type_id"]=> string(2) "14" ["item_id"]=> string(2) "30" ["item_parent_id"]=> string(1) "0" ["user_id"]=> string(3) "126" ["notification_read"]=> string(1) "0" ["notification_time"]=> string(10) "1579856633" ["notification_data"]=> array(2) { ["from_user_id"]=> string(1) "2" ["message_subject"]=> string(10) "re tretert" } ["notification_type_name"]=> string(20) "notification.type.pm" }
prepare_for_display, gfksx.thanksforposts.notification.type.thanks, object 000000007cf39c4b0000000079329a6f
array(1) { ["notification_data"]=> array(0) { } }
prepare_for_display, gfksx.thanksforposts.notification.type.thanks_remove, object 000000007cf39c5f0000000079329a6f
array(1) { ["notification_data"]=> array(0) { } }
prepare_for_display, gfksx.thanksforposts.notification.type.thanks, object 000000007cf39c4b0000000079329a6f
array(1) { ["notification_data"]=> array(0) { } }
prepare_for_display, gfksx.thanksforposts.notification.type.thanks_remove, object 000000007cf39c5f0000000079329a6f
array(1) { ["notification_data"]=> array(0) { } }
prepare_for_display, gfksx.thanksforposts.notification.type.thanks_remove, object 000000007cf39c5f0000000079329a6f
array(1) { ["notification_data"]=> array(0) { } }
prepare_for_display, gfksx.thanksforposts.notification.type.thanks_remove, object 000000007cf39c5f0000000079329a6f
array(1) { ["notification_data"]=> array(0) { } }
prepare_for_display, gfksx.thanksforposts.notification.type.thanks_remove, object 000000007cf39c5f0000000079329a6f
array(1) { ["notification_data"]=> array(0) { } }
prepare_for_display, notification.type.pm, object 000000007cf39faf0000000079329a6f
array(9) { ["notification_id"]=> string(3) "659" ["notification_type_id"]=> string(2) "14" ["item_id"]=> string(2) "29" ["item_parent_id"]=> string(1) "0" ["user_id"]=> string(3) "126" ["notification_read"]=> string(1) "0" ["notification_time"]=> string(10) "1578924701" ["notification_data"]=> array(2) { ["from_user_id"]=> string(1) "2" ["message_subject"]=> string(11) "Advertencia" } ["notification_type_name"]=> string(20) "notification.type.pm" }
prepare_for_display, gfksx.thanksforposts.notification.type.thanks, object 000000007cf39c4b0000000079329a6f
array(1) { ["notification_data"]=> array(0) { } }
1) Object ID is always the same for any notification object of any of thanks or thanks_remove types (one unique ID by each type, 2 in total). But on PMs each notification object has its own Object ID.
2) Related to above point, contructor is called once by each PM while is called only on the first thanks or thanks_remove object. That may be te reason why it reports always same ID.
3) There's a step that I don't know what is used to, but also shows not calling constructor. Just between set_initial_data and prepare_for_display calls:
Code: Select all
constructor, object 000000004043091f0000000003bba3e7
set_initial_data, notification.type.pm, object 000000004043091f0000000003bba3e7
array(0) { }
set_initial_data, gfksx.thanksforposts.notification.type.thanks, object 0000000040430ae90000000003bba3e7
array(0) { }
set_initial_data, gfksx.thanksforposts.notification.type.thanks_remove, object 0000000040430afd0000000003bba3e7
array(0) { }
4) Finally, set_initial_data calls get empty data. Probably because it's always using same object and the above point call sets it to empty, then it's the last set state.
I have no idea why it's showing different behavior, I'm not using any static or singleton.
Thanks for your help.