« first day (3327 days earlier)      last day (1624 days later) » 

12:05 AM
Well I don't know what the appropriate terminology to use anymore, .. I've gotten a little lost in all the terms. But say, for example, we have 1 of 6 different formats that all use different naming conventions (and I don't mean just snake case vs camel, .. think firstName vs full_name -- the data is "the same" but it's more than a field name translation)
And let's say that it's XML
What it appears most deserialization libraries want you to do is move from the serialized format (XML, JSON, ...) directoy to an object
I don't think that would be wise in this case, though, .. It would mean we would have to effectively define a DTO for dozens of formats when I don't see any real benefit of doing so.

That is, ... is there some benefit I'm missing to just going

XML -> Informally Structured Array -> (Translation, whatever that may mean) -> Domain Model -> (Validation)
Otherwise, as I said, it seems most things want you to do XML straight to a Domain Model, but with the assumption that the XML can be easily translated into the domain model, in which my case they cannot
 
ThW
XML is easy, here is Xpath and XSLT
 
Right haha, I even considered XSLT
Sorry let me try to explain this again, I'm terribly at explaining things.
terribly bad*.
 
ThW
It is a lot easier to implement and maintain dozens of specific simple deserializers then a single one that tries to do all.
 
12:24 AM
We have, actual count, ... about 37 different "specifications" here. When I say specifications, I mean, they are all describing a collection of the same resource/domain model object. This is several database entities, but one "thing" as far as our (new) domain model is concerned. Maybe "Schema" is the correct term.

Slightly less as I know some of these are actually parsing the same "schema" but just have different rules on top so are implemented completely separately. I also know that at least 3-4 that are all using a particular third party vendor-specific "schema" and some are XML a
Again, all of these are describing the same object in our system that has about 25 fields and is relatively simple
Right now this system is an absolute MESS. Partly because this system was written when php5.4 was the latest and greatest and hasn't been updated much since then except the addition of new formats and further hacking away at any sort of architecture it may have used to have
A fair amount of them can be described simply by saying "X format to PHP Array" ... (X=CSV,JSON,XML) ... and then just some extremely rudimentary transformations: renaming fields and maybe a trim() or substr()
..and then throwing them into the domain object and letting doctrine handle the rest
 
ThW
@A.B.Carroll So implement the loaders for different formats as iterators, nest them in mapping (callback) iterators.
 
How would you handle the trivial transformations?
I agree -- that's basically what I'd strated to do
Actually, .. I wrote them as "agents" and the agents would just run and then send a redis queue a massive list of data.... which then is being iterated by a separate process (this made the ones where they send us a bunch of disjointed HTTP requests easier)
But once I get here I don't know what to do... I even thought about writing some massive metalanguage using something like symfony expressionlang or just twig itself
But that doesn't seem very smart
There is also JMEPath? I think it's called.. JSONPath... etc ... i thought about just forcing everything into JSON and then using one of those ... (or XPath)
But fact is I have a horde of formats here, .. a very very tiny amount of them (3-5) do need very complex transformations which undoubtedly will be best handled by PHP / a custom transformer type class that can iterate each item in the collection ...
 
ThW
I usually convert JSON to DOM :-)
 
But the majority are very simple, ... I hate to have 30+ classes doing endless to=>from transformations and a few trims and such
XML?
I mean, that would work too honestly. I am pretty agnostic. I just want to makes ure using something like XPath, JMESPath, JSONPath, .. etc .. for my purposes doesn't sound too crazy
 
 
1 hour later…
2:03 AM
gn8
 
 
2 hours later…
Wes
3:42 AM
le morning
 
 
4 hours later…
7:27 AM
morns
 
cmb
7:41 AM
\o
 
8:00 AM
horologium a timepiece, as a clock or sundial, or a building supporting or containing a timepiece.
 
8:22 AM
morning, bitches
 
8:46 AM
hoebag
 
9:22 AM
o/
 
9:36 AM
 
@DaveRandom The newest PHP con?
 
I can't wait for "Morning Sausage Pizza"
It sounds about as jaded as I feel
It's supposed to be beautiful and beautiful, damn it
 
10:25 AM
Calling __autoload() with incorrect EG(fake_scope) value – #78868
 
 
1 hour later…
ThW
11:38 AM
moin
 
12:01 PM
Hey fellas, just a quick question. Is phptherightway.com any good for beginners? I used ti be frint end dev. Now starting out with backend after a couple of years. cheers
 
cmb
12:14 PM
IMO that's a good starting point.
 
12:58 PM
morning
 
1:23 PM
Morning!
 
evening
at least, it feels like evening
 
2:20 PM
e'nin
 
@StatikStasis The second word is "off". You may select the first yourself.
 
2:37 PM
How could I define my own object handlers? Define create_object callback to intercept object creation, call original handler or zend_objects_new. Make a copy of std_object_handlers and adjust it?
 
cmb
Object handlers are defined once for the class, not for each object.
 
2:55 PM
Then I don't understand why I can see only zend_object->handlers and no entries in the zend_class_entry itself. And custom classes define handlers for objects in custom create_object handler...
I would like to refactor this by moving pointer to the handlers into the zend_class_entry itself. Also would like to move serialize/unserialize, get_iterator, get_static_method, iterator_funcs_ptr and create_object handlers from zend_class_entry to this central object_handler pointer.
And all those zend function __magicFunc pointers in the zend_class_entry should be moved to the HashTable function_table because initialization logic and method inheritance for this separate fields is added everywhere instead of having this in one single hash table.
 
I need to check if time between two times, what is the good way? I have tried like but it is not working:
$midNight = '00:00:00 am';
$morning = '06:00:00 am';
$midNight = DateTime::createFromFormat('H:i a', $midNight);
$morning = DateTime::createFromFormat('H:i a', $morning);

foreach ($dbArray as $arrayItem) {
    //set timezone
    if (!empty($arrayItem['user_timezone'])) {
        date_default_timezone_set($arrayItem['user_timezone']);
    }
    //returns like 16:12:28
    $logTime = substr($arrayItem['date_added'], 11);
    $logTime = DateTime::createFromFormat('H:i a', $logTime);

    if ($logTime > $midNight && $logTime < $morning)
I Changed
 $logTime = DateTime::createFromFormat('H:i:s', $logTime);
 
3:16 PM
@luffy cant you just pass timezone to createFromFormatas the third param? (Looks good to me)
 
@Ghostff yeah, that is even better, thanks. Is this an correct way to check? after searching this is the best I came up with.
 
@luffy Yes.
 
@Ghostff thanks
 
cmb
@lisachenko, oh, you're right, each object can have individual handlers.
If you like to have your own handlers, you can try to change the handlers after object creation.
Your suggestions might be doable for PHP 8, but need to be discussed. This likely causes major BC break for extensions.
 
3:32 PM
@cmb it's a good time to deprecated this in 7.x and drop in 8.0. Also lowercased names everywhere...
 
cmb
Probably to late for 7.x, since 7.4.0 is coming this week, and I don't think we deprecate in revisions.
 
@cmb No it's impossible, because handlers are declared as const zend_object_handlers *handlers
I want to craft a class Matrix with overloaded do_operation handler for instances of this class to show how to create custom operation handlers with z-engine and FFI like matrix addition, multiplication, etc..
 
cmb
you can memcpy() the original handlers to somewhere else, modify there, and then assign the new place
 
@cmb I'm trying to do so and this always result in segfault...
 
cmb
that might have another reason
 
3:41 PM
@JoeWatkins Okay, so using zend_get_zval_ptr I still get 1 instead of FUNCTION in that sample I posted. By "zend_get_zval_ptr api" is there more than one function or..?
maybe you mean the BP_VAR_R variants or something?
Or maybe my test file got goofed up at some point -- hate it when I spend hours on the wrong thing >.<
 
I was about to @ you the syntax, lol
 
4:04 PM
@cmb segfault appears during object initialization...
#0  0x000000000097a956 in ZEND_NEW_SPEC_CONST_UNUSED_HANDLER () at /home/alisachenko/src/php-src/Zend/zend_vm_execute.h:9225
#1  0x00000000009cf770 in execute_ex (ex=0x7ffff2a14020) at /home/alisachenko/src/php-src/Zend/zend_vm_execute.h:54333
#2  0x00000000009d2c91 in zend_execute (op_array=0x7ffff2a7a300, return_value=0x0) at /home/alisachenko/src/php-src/Zend/zend_vm_execute.h:57663
#3  0x00000000008fc82f in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /home/alisachenko/src/php-src/Zend/zend.c:1663
At this line constructor = Z_OBJ_HT_P(result)->get_constructor(Z_OBJ_P(result));
 
Hey guys! Anybody experienced with CodeIgniter? I'm having an error that's making me pull my hairs
I'm getting An uncaught Exception was encountered
Type: ArgumentCountError

Message: Too few arguments to function
 
@GabrielDube what function are you calling? how many arguments does it accept and how many are you passing?
 
cmb
@lisachenko, I think you have to factor in the offset to the zo or std element of the object struct. Most objects have that at the end of the struct as of PHP 7, but the zval points to the beginning of the struct. See e.g. php-lxr.adamharvey.name/source/xref/PHP-7.3/ext/sqlite3/…
I don't think there's a general way to detect that offset with FFI.
 
@Ghostff This is my function:
public function index($id, $page = 0) {

  $user_profile = $this->em->getRepository('Entities\User')->findOneById($id);
  if(!$user_profile) show_404();

  $brain = new Entities\Brain();
  $this->data['brain_status_options'] = array(
    $brain::PUBLIC_STATUS => lang('Public'),
    $brain::HIDDEN_STATUS => lang('Hidden'),
  );

  if($this->ion_auth->is_admin()) {
    $brain_status = null;
  }
  else {
    $brain_status = $brain::PUBLIC_STATUS;
  }

  $brain_collection = $this->em->getRepository('Entities\Brain')->getListPerPage($brain::BRAIN_PER_PAGE, $page, $brain_status);
@Ghostff My $id is expecting 1 argument and 0 was passed
 
@cmb this segfault because result->value->obj is null. _object_and_properties_init returns FAILURE for me with my custom handler, digging into this right now..
 
4:25 PM
@GabrielDube that's a controller method? then codeigniter is not passing your URL segment. or maybe YOUR URL does not match.
 
@Ghostff Yes that's a controller method. I'm trying to pull the user ID so I can use it later on to filter my query not necessarily via URL.
 
4:41 PM
@GabrielDube I don't use codeigniter, but if not from the URL, how else will the $id be passed to the method? codeigniter.com/user_guide/general/…
 
@cmb Do you know how to trigger zend_object->handlers->do_operation() handler? For which PHP expressions this stuff is used for?
 
@Ghostff Yes you're 100% right. I was approaching it differently
@Ghostff I think to accomplish what I want, I need something like:

if($this->session->user_id == $brain->getUser()) {
I want to use the user id of my session to get the user id of the entity brain so I can pull matches that only contain my user ID
 
cmb
@lisachenko, I think it's used for most operators; see zend_operators.h and .c
 
When I set the cast_object handler, it is invoked perfectly, but for the do_operation handler, I can not trigger my custom callback in runtime...
Should it work for expressions like $object + 2 or $object / 2 ?
 
@Ghostff When I do this:
if($this->session->user_id == $brain->getUser()->getId()) {
I get the following error
Call to a member function getId() on null
 
5:06 PM
@GabrielDube like i said, i don't use codeigniter, what is $brain = new Entities\Brain(); and what its relationship with the user? Call to a member function getId() means $brain->getUser() is returning null. I suggest you move the question to stackoverflow questions.
 
@Ghostff Will do! Thank you
 
5:21 PM
@DaveRandom Show... I do try.
 
5:32 PM
How do you email internals? Or do you just send it somewhere else?
 
5:53 PM
@StatikStasis you could have gone with "dance"
@Machavity internals@lists.php.net
 
@DaveRandom I guess i'm just missing something. I did so and got this bounce-back
> Sorry, only subscribers may post.
 
@Machavity use the form on the page I linked above ;-)
:-P
Use the forms Luke
Oh screw you autocorrect
Asshole computers
 
@DaveRandom We should burn them all. Making the Internet hard to use
 
They just do not seem to get how weak, lazy comedy works
 
@DaveRandom I should have read closer. I seem to be in now. Thanks
 
cmb
6:10 PM
@lisachenko, yes, $object+2 should trigger the handler (cf. ext/gmp)
@Machavity, I'm not subscribed to the list, but can post. Maybe something has changed since then.
 
Well, my suggestion is in now
 
@Machavity it is, tbf, not super clear
Although I think slightly on purpose to filter out drive by asshole
 
I can understand it. These days, anything is better than nothing in most cases
 
@JoeWatkins Ahahaha, I was fetching data on the wrong execute_data frame >.<
 
6:50 PM
how would i go about updating php to 7.3 i am currently on a mac machine with php 7.1 available running php --version gets me the version
but the add-apt command doesn't seem to be available
 
it depends on how PHP was installed on it... was it pre-installed? are you using something like MAMP? manually installed?
 
mac is so confusing, thats why i rather update the current version directly
currently using xampp
but it is running separately as a mounted drive
 
you'll likely have to update xampp then
 
 
2 hours later…
9:02 PM
ZEND_VM_HANDLER(129, ZEND_DO_ICALL, ANY, ANY, SPEC(RETVAL))
What does the SPEC(RETVAL) do? Haven't seen that before.
I assume it's a specialization, but usually it's like CACHE or UNUSED or something.
 
 
1 hour later…
cmb
10:13 PM
@LeviMorrison, it's about whether the return value is used or not.
 
 
2 hours later…
user11601411
11:57 PM
yo any1 got a tutorial on how to host a php web server locally online (just for friends)
 

« first day (3327 days earlier)      last day (1624 days later) »