1 // BEGIN INCLUDED FILES
2 /* The difference between zend_symtable_X and zend_hash_X is that
3 * the _symtable version will check if the key is a string of an
4 * integer, and if so, use the int version instead. We can use the
5 * zend_hash_X versions safely for symbol tables, since
6 * variables cant be integer strings, but we cant safely use
7 * zend_hash_X versions for hashtable lookups. Well-named, they are.
10 /* An important note of zval*s and zval**s. Frequently, zval** are
11 * fetched from arrays and symbol tables. The zval** will point into
12 * the array, and so updating it will update the relevant array
13 * entry. It is normally not the same to dereference it to a local
14 * variable, and pass a reference to that.
19 // Some common functions
23 * The runtime needs its own initialization and finalization. phc is
24 * responsible for generating calls to these functions.
38 ht_debug (HashTable
* ht
)
46 for (zend_hash_internal_pointer_reset (ht
);
47 zend_hash_has_more_elements (ht
) == SUCCESS
;
48 zend_hash_move_forward (ht
))
57 type
= zend_hash_get_current_key_ex (ht
, &key
, &keylen
, &idx
, 0, NULL
);
58 zend_hash_get_current_data (ht
, (void **) &ppzval
);
62 if (type
== HASH_KEY_IS_STRING
)
71 printf (": addr = %08lX, refcount = %d, is_ref = %d ",
72 (long unsigned int) (*ppzval
), (*ppzval
)->refcount
,
74 switch (Z_TYPE_P (zvp
))
80 printf ("(%ldL)", Z_LVAL_P (zvp
));
83 printf ("(%lff)", Z_DVAL_P (zvp
));
86 printf (Z_BVAL_P (zvp
) ? "(true)" : "(false)");
89 printf ("(array(%d))", Z_ARRVAL_P (zvp
)->nNumOfElements
);
95 printf ("(\"%s\")", Z_STRVAL_P (zvp
));
98 printf ("(Resource)");
101 printf ("(Invalid: %d)", Z_TYPE_P (zvp
));
107 printf ("END HASH\n");
110 // Call ht_debug on the named var in the given symbol table
112 ht_var_debug (HashTable
* st
, char *name
)
115 if (zend_symtable_find (st
, name
, strlen (name
) + 1,
116 (void **) &p_zvp
) != SUCCESS
)
118 printf ("VAR NOT IN SYMBOL TABLE: '%s'\n", name
);
122 if (Z_TYPE_P (*p_zvp
) != IS_ARRAY
)
124 printf ("NOT HASH\n");
128 ht_debug ((*p_zvp
)->value
.ht
);
131 static zval
* counters
;
133 static void init_counters ()
135 ALLOC_INIT_ZVAL (counters
);
136 array_init (counters
);
139 // Dump and cleanup memory
140 static void finalize_counters ()
142 HashTable
* ht
= Z_ARRVAL_P (counters
);
143 for (zend_hash_internal_pointer_reset (ht
);
144 zend_hash_has_more_elements (ht
) == SUCCESS
;
145 zend_hash_move_forward (ht
))
150 zend_hash_get_current_key_ex (ht
, &key
, NULL
, NULL
, 0, NULL
);
151 zend_hash_get_current_data (ht
, (void **) &p_zvp
);
153 fprintf (stderr
, "COUNTER:%s:%ld\n", key
, Z_LVAL_P (*p_zvp
));
156 zval_ptr_dtor (&counters
);
159 static void increment_counter (char* name
, int length
, ulong hashval
)
162 int success
= zend_hash_quick_find (Z_ARRVAL_P (counters
),
168 if (success
== SUCCESS
)
176 ALLOC_INIT_ZVAL (new_val
);
177 ZVAL_LONG (new_val
, 1);
179 zend_hash_quick_add (Z_ARRVAL_P (counters
),
191 /* Make a copy of *P_ZVP, storing it in *P_ZVP. */
193 zvp_clone_ex (zval
* zvp
)
195 // TODO: use INIT_PZVAL_COPY
197 MAKE_STD_ZVAL (clone
);
198 clone
->value
= zvp
->value
;
199 clone
->type
= zvp
->type
;
200 zval_copy_ctor (clone
);
206 in_copy_on_write (zval
* zvp
)
208 return (zvp
->refcount
> 1 && !zvp
->is_ref
);
212 in_change_on_write (zval
* zvp
)
214 return (zvp
->refcount
> 1 && zvp
->is_ref
);
217 /* If *P_ZVP is in a copy-on-write set, separate it by overwriting
218 * *P_ZVP with a clone of itself, and lowering the refcount on the
221 sep_copy_on_write (zval
** p_zvp
)
223 if (!in_copy_on_write (*p_zvp
))
228 *p_zvp
= zvp_clone_ex (*p_zvp
);
230 zval_ptr_dtor (&old
);
233 /* If *P_ZVP is in a copy-on-write set, separate it by overwriting
234 * *P_ZVP with a clone of itself, and lowering the refcount on the
237 sep_change_on_write (zval
** p_zvp
)
239 assert (in_change_on_write (*p_zvp
));
243 *p_zvp
= zvp_clone_ex (*p_zvp
);
245 zval_ptr_dtor (&old
);
248 /* Assign RHS into LHS, by reference. After this, LHS will point to the same
251 copy_into_ref (zval
** lhs
, zval
** rhs
)
260 // Overwrite one zval with another
262 overwrite_lhs (zval
* lhs
, zval
* rhs
)
264 // First, call the destructor to remove any data structures
265 // associated with lhs that will now be overwritten
268 lhs
->value
= rhs
->value
;
269 lhs
->type
= rhs
->type
;
270 zval_copy_ctor (lhs
);
273 // Overwrite one zval with another
275 overwrite_lhs_no_copy (zval
* lhs
, zval
* rhs
)
277 // First, call the destructor to remove any data structures
278 // associated with lhs that will now be overwritten
281 lhs
->value
= rhs
->value
;
282 lhs
->type
= rhs
->type
;
285 /* Write P_RHS into the symbol table as a variable named VAR_NAME. */
286 // NOTE: We do not alter p_rhs's refcount, unless p_lhs joins its
287 // Copy-on-write set.
288 // TODO: this is crying out to be inlined.
290 write_var (zval
** p_lhs
, zval
* rhs
)
292 if (!(*p_lhs
)->is_ref
)
294 zval_ptr_dtor (p_lhs
);
295 // Take a copy of RHS for LHS.
298 *p_lhs
= zvp_clone_ex (rhs
);
308 overwrite_lhs (*p_lhs
, rhs
);
312 // TODO: this functino does too much, and much might be redundant
314 get_st_entry (HashTable
* st
, char *name
, int length
, ulong hashval TSRMLS_DC
)
317 if (zend_hash_quick_find
318 (st
, name
, length
, hashval
, (void **) &p_zvp
) == SUCCESS
)
320 assert (p_zvp
!= NULL
);
324 // If we dont find it, put EG (uninitialized_zval_ptr) into the
325 // hashtable, and return a pointer to its container.
326 EG (uninitialized_zval_ptr
)->refcount
++;
327 int result
= zend_hash_quick_add (st
, name
, length
, hashval
,
328 &EG (uninitialized_zval_ptr
),
329 sizeof (zval
*), (void **) &p_zvp
);
330 assert (result
== SUCCESS
);
331 assert (p_zvp
!= NULL
);
336 /* Read the variable named VAR_NAME from the local symbol table and
337 * return it. If the variable doent exist, a new one is created and
340 read_var (HashTable
* st
, char *name
, int length
, ulong hashval TSRMLS_DC
)
343 if (zend_hash_quick_find
344 (st
, name
, length
, hashval
, (void **) &p_zvp
) == SUCCESS
)
347 return EG (uninitialized_zval_ptr
);
351 get_integer_index (zval
* ind TSRMLS_DC
)
354 switch (Z_TYPE_P (ind
))
357 return (long) Z_DVAL_P (ind
);
361 return Z_LVAL_P (ind
);
367 php_error_docref (NULL TSRMLS_CC
, E_WARNING
, "Illegal offset type");
372 read_string_index (zval
* var
, zval
* ind TSRMLS_DC
)
374 // This must always allocate memory, since we cant return the
376 assert (Z_TYPE_P (var
) == IS_STRING
);
377 long index
= get_integer_index (ind TSRMLS_CC
);
380 ALLOC_INIT_ZVAL (result
);
382 if (index
>= Z_STRLEN_P (var
) || index
< 0)
384 // this is 1 byte long, must be copied
385 ZVAL_STRINGL (result
, "", 0, 1);
389 char *string
= Z_STRVAL_P (var
);
390 ZVAL_STRINGL (result
, &string
[index
], 1, 1);
396 /* Given a string (p_lhs), write into it for $x[i] = $y; */
398 write_string_index (zval
** p_lhs
, zval
* ind
, zval
* rhs TSRMLS_DC
)
400 assert (Z_TYPE_P (*p_lhs
) == IS_STRING
);
402 long index
= get_integer_index (ind TSRMLS_CC
);
404 // Get the appropriate character
406 if (Z_TYPE_P (rhs
) != IS_STRING
)
408 // TODO: remove allocate
409 zval
*copy
= zvp_clone_ex (rhs
);
410 convert_to_string (copy
);
411 new_char
= Z_STRVAL_P (copy
)[0];
412 zval_ptr_dtor (©
);
416 new_char
= Z_STRVAL_P (rhs
)[0];
422 php_error_docref (NULL TSRMLS_CC
, E_WARNING
,
423 "Illegal string offset: %ld", index
);
427 // We overwrite if it's change-on-write
428 sep_copy_on_write (p_lhs
);
430 if (index
> Z_STRLEN_PP (p_lhs
))
433 int len
= Z_STRLEN_PP (p_lhs
);
434 int new_length
= index
+ 1; // space for the new character
435 Z_STRVAL_PP (p_lhs
) = erealloc (Z_STRVAL_PP (p_lhs
), new_length
+ 1);
438 memset (&Z_STRVAL_PP (p_lhs
)[len
], ' ', index
- len
);
441 Z_STRLEN_PP (p_lhs
) = new_length
;
443 // add a null terminator
444 Z_STRVAL_PP (p_lhs
)[new_length
] = '\0';
447 // write in the first character of the new value
448 Z_STRVAL_PP (p_lhs
)[index
] = new_char
;
451 // index < 0: E_WARNING illegal string offset
454 // Extract the hashtable from a hash-valued zval
456 extract_ht_ex (zval
* arr TSRMLS_DC
)
458 // TODO: this likely should be inlined somewhere.
459 assert (!in_copy_on_write (arr
));
460 if (Z_TYPE_P (arr
) == IS_NULL
)
464 else if (Z_TYPE_P (arr
) != IS_ARRAY
)
466 php_error_docref (NULL TSRMLS_CC
, E_WARNING
,
467 "Cannot use a scalar value as an array");
470 return Z_ARRVAL_P (arr
);
474 /* P_VAR points into a symbol table, at a variable which we wish to index as a hashtable. */
476 extract_ht (zval
** p_var TSRMLS_DC
)
478 sep_copy_on_write (p_var
);
480 return extract_ht_ex (*p_var TSRMLS_CC
);
483 /* Using IND as a key to HT, call the appropriate zend_index_X
484 * function with data as a parameter, and return its result. This
485 * updates the zval** pointed to by DATA. */
487 ht_find (HashTable
* ht
, zval
* ind
, zval
*** data
)
490 if (Z_TYPE_P (ind
) == IS_LONG
|| Z_TYPE_P (ind
) == IS_BOOL
)
492 result
= zend_hash_index_find (ht
, Z_LVAL_P (ind
), (void **) data
);
494 else if (Z_TYPE_P (ind
) == IS_DOUBLE
)
496 result
= zend_hash_index_find (ht
, (long) Z_DVAL_P (ind
),
499 else if (Z_TYPE_P (ind
) == IS_NULL
)
501 result
= zend_hash_find (ht
, "", sizeof (""), (void **)data
);
503 else if (Z_TYPE_P (ind
) == IS_STRING
)
505 result
= zend_symtable_find (ht
, Z_STRVAL_P (ind
),
506 Z_STRLEN_P (ind
) + 1, (void **) data
);
510 // TODO: I believe this might need a warning.
513 // use a string index for other types
515 MAKE_STD_ZVAL (string_index
);
516 string_index
->value
= ind
->value
;
517 string_index
->type
= ind
->type
;
518 zval_copy_ctor (string_index
);
519 convert_to_string (string_index
);
521 result
= zend_symtable_find (ht
, Z_STRVAL_P (string_index
),
522 Z_STRLEN_P (string_index
) + 1,
524 zval_ptr_dtor (&string_index
);
531 check_array_index_type (zval
* ind TSRMLS_DC
)
533 if (Z_TYPE_P (ind
) == IS_OBJECT
|| Z_TYPE_P (ind
) == IS_ARRAY
)
535 php_error_docref (NULL TSRMLS_CC
, E_WARNING
, "Illegal offset type");
542 // Update a hashtable using a zval* index
544 ht_update (HashTable
* ht
, zval
* ind
, zval
* val
, zval
*** dest
)
547 if (Z_TYPE_P (ind
) == IS_LONG
|| Z_TYPE_P (ind
) == IS_BOOL
)
549 result
= zend_hash_index_update (ht
, Z_LVAL_P (ind
), &val
,
550 sizeof (zval
*), (void **) dest
);
552 else if (Z_TYPE_P (ind
) == IS_DOUBLE
)
554 result
= zend_hash_index_update (ht
, (long) Z_DVAL_P (ind
),
555 &val
, sizeof (zval
*), (void **) dest
);
557 else if (Z_TYPE_P (ind
) == IS_NULL
)
559 result
= zend_hash_update (ht
, "", sizeof (""), &val
,
560 sizeof (zval
*), (void **) dest
);
562 else if (Z_TYPE_P (ind
) == IS_STRING
)
564 result
= zend_symtable_update (ht
, Z_STRVAL_P (ind
),
565 Z_STRLEN_P (ind
) + 1,
566 &val
, sizeof (zval
*), (void **) dest
);
572 MAKE_STD_ZVAL (string_index
);
573 string_index
->value
= ind
->value
;
574 string_index
->type
= ind
->type
;
575 zval_copy_ctor (string_index
);
576 convert_to_string (string_index
);
577 result
= zend_symtable_update (ht
, Z_STRVAL_P (string_index
),
578 Z_STRLEN_P (string_index
) + 1,
579 &val
, sizeof (zval
*), (void **) dest
);
581 zval_ptr_dtor (&string_index
);
583 assert (result
== SUCCESS
);
586 // Delete from a hashtable using a zval* index
588 ht_delete (HashTable
* ht
, zval
* ind
)
590 // This may fail if the index doesnt exist, which is fine.
591 if (Z_TYPE_P (ind
) == IS_LONG
|| Z_TYPE_P (ind
) == IS_BOOL
)
593 zend_hash_index_del (ht
, Z_LVAL_P (ind
));
595 else if (Z_TYPE_P (ind
) == IS_DOUBLE
)
597 zend_hash_index_del (ht
, (long) Z_DVAL_P (ind
));
599 else if (Z_TYPE_P (ind
) == IS_NULL
)
601 zend_hash_del (ht
, "", sizeof (""));
603 else if (Z_TYPE_P (ind
) == IS_STRING
)
605 zend_hash_del (ht
, Z_STRVAL_P (ind
), Z_STRLEN_P (ind
) + 1);
611 MAKE_STD_ZVAL (string_index
);
612 string_index
->value
= ind
->value
;
613 string_index
->type
= ind
->type
;
614 zval_copy_ctor (string_index
);
615 convert_to_string (string_index
);
616 zend_hash_del (ht
, Z_STRVAL_P (string_index
),
617 Z_STRLEN_P (string_index
) + 1);
619 zval_ptr_dtor (&string_index
);
623 // Check if a key exists in a hashtable
625 ht_exists (HashTable
* ht
, zval
* ind
)
627 if (Z_TYPE_P (ind
) == IS_LONG
|| Z_TYPE_P (ind
) == IS_BOOL
)
629 return zend_hash_index_exists (ht
, Z_LVAL_P (ind
));
631 else if (Z_TYPE_P (ind
) == IS_DOUBLE
)
633 return zend_hash_index_exists (ht
, (long) Z_DVAL_P (ind
));
635 else if (Z_TYPE_P (ind
) == IS_NULL
)
637 return zend_hash_exists (ht
, "", sizeof (""));
639 else if (Z_TYPE_P (ind
) == IS_STRING
)
641 return zend_hash_exists (ht
, Z_STRVAL_P (ind
), Z_STRLEN_P (ind
) + 1);
648 MAKE_STD_ZVAL (string_index
);
649 string_index
->value
= ind
->value
;
650 string_index
->type
= ind
->type
;
651 zval_copy_ctor (string_index
);
652 convert_to_string (string_index
);
653 result
= zend_hash_exists (ht
, Z_STRVAL_P (string_index
),
654 Z_STRLEN_P (string_index
) + 1);
655 zval_ptr_dtor (&string_index
);
662 get_ht_entry (zval
** p_var
, zval
* ind TSRMLS_DC
)
664 if (Z_TYPE_P (*p_var
) == IS_STRING
)
666 if (Z_STRLEN_PP (p_var
) > 0)
668 php_error_docref (NULL TSRMLS_CC
, E_ERROR
,
669 "Cannot create references to/from string offsets nor overloaded objects");
673 if (Z_TYPE_P (*p_var
) != IS_ARRAY
)
675 zval_ptr_dtor (p_var
);
676 ALLOC_INIT_ZVAL (*p_var
);
680 HashTable
*ht
= extract_ht (p_var TSRMLS_CC
);
683 if (ht_find (ht
, ind
, &data
) == SUCCESS
)
685 assert (data
!= NULL
);
689 // If we dont find it, put EG (uninitialized_zval_ptr) into the
690 // hashtable, and return a pointer to its container.
691 EG (uninitialized_zval_ptr
)->refcount
++;
692 ht_update (ht
, ind
, EG (uninitialized_zval_ptr
), &data
);
694 assert (data
!= NULL
);
700 // Like extract_ht_ex, but for objects
702 extract_field_ex (zval
* obj TSRMLS_DC
)
704 // TODO: this likely should be inlined somewhere.
705 assert (!in_copy_on_write (obj
));
706 if (Z_TYPE_P (obj
) == IS_NULL
)
709 // TODO: implement initialization
711 else if (Z_TYPE_P (obj
) != IS_OBJECT
)
713 // TODO: test if this is the right error message
714 php_error_docref (NULL TSRMLS_CC
, E_WARNING
,
715 "Cannot use a scalar value as an object");
716 // TODO: implement initialization
719 return Z_OBJPROP_P (obj
);
722 // Like extract_ht, but for objects
724 extract_field (zval
** p_var TSRMLS_DC
)
726 sep_copy_on_write (p_var
);
728 return extract_field_ex (*p_var TSRMLS_CC
);
731 // Like get_ht_entry, but for objects
733 get_field (zval
** p_var
, char *ind TSRMLS_DC
)
735 if (Z_TYPE_P (*p_var
) != IS_OBJECT
)
737 // TODO: implement initialization
741 HashTable
*ht
= extract_field (p_var TSRMLS_CC
);
744 if (zend_symtable_find (ht
, ind
, strlen (ind
) + 1, (void **) &data
) ==
747 assert (data
!= NULL
);
751 // If we dont find it, put EG (uninitialized_zval_ptr) into the
752 // hashtable, and return a pointer to its container.
753 EG (uninitialized_zval_ptr
)->refcount
++;
754 zend_symtable_update (ht
, ind
, strlen (ind
) + 1,
755 &EG (uninitialized_zval_ptr
), sizeof (zval
*),
758 assert (data
!= NULL
);
764 read_array (zval
** result
, zval
* array
, zval
* ind TSRMLS_DC
)
766 // Memory can be allocated in read_string_index
767 if (array
== EG (uninitialized_zval_ptr
))
773 // Since we know its an array, and we dont write to it, we dont need
775 HashTable
*ht
= Z_ARRVAL_P (array
);
779 if (ht_find (ht
, ind
, &p_result
) == SUCCESS
)
785 *result
= EG (uninitialized_zval_ptr
);
788 /* If its not an array, convert it into an array. */
790 check_array_type (zval
** p_var TSRMLS_DC
)
792 if ((Z_TYPE_P (*p_var
) == IS_BOOL
&& !Z_BVAL_PP (p_var
))
793 || Z_TYPE_P (*p_var
) == IS_NULL
794 || (Z_TYPE_P (*p_var
) == IS_STRING
&& Z_STRLEN_PP (p_var
) == 0))
796 // Non ref use new values
797 if (!PZVAL_IS_REF (*p_var
))
799 zval_ptr_dtor (p_var
);
800 ALLOC_INIT_ZVAL (*p_var
);
803 // Refs are just replaced
808 else if (Z_TYPE_PP (p_var
) != IS_STRING
&& Z_TYPE_PP (p_var
) != IS_ARRAY
)
810 // TODO: why are these different types than pushing
811 php_error_docref (NULL TSRMLS_CC
, E_WARNING
,
812 "Cannot use a scalar value as an array");
816 /* If its not an array, convert it into an object. */
818 check_object_type (zval
** p_var TSRMLS_DC
)
823 /* Push EG (uninitialized_zval_ptr) and return a pointer into the ht
826 * Converted to array automatically:
831 * Warning, no conversion:
836 * Error, no conversion:
837 * strings other than ""
839 // TODO: objects, resources, etc
841 push_and_index_ht (zval
** p_var TSRMLS_DC
)
843 // Check for errors conditions
845 if (Z_TYPE_P (*p_var
) == IS_STRING
&& Z_STRLEN_PP (p_var
) > 0)
847 php_error_docref (NULL TSRMLS_CC
, E_ERROR
,
848 "[] operator not supported for strings");
849 assert (0); // unreachable
852 if (Z_TYPE_P (*p_var
) == IS_BOOL
&& Z_BVAL_PP (p_var
)
853 || Z_TYPE_P (*p_var
) == IS_LONG
|| Z_TYPE_P (*p_var
) == IS_DOUBLE
)
855 php_error_docref (NULL TSRMLS_CC
, E_WARNING
,
856 "Cannot use a scalar value as an array");
860 if (Z_TYPE_P (*p_var
) != IS_ARRAY
)
862 zval_ptr_dtor (p_var
);
863 ALLOC_INIT_ZVAL (*p_var
);
867 // if its not an array, make it an array
868 HashTable
*ht
= extract_ht (p_var TSRMLS_CC
);
871 EG (uninitialized_zval_ptr
)->refcount
++;
872 int result
= zend_hash_next_index_insert (ht
, &EG (uninitialized_zval_ptr
),
873 sizeof (zval
*), (void **) &data
);
874 assert (result
== SUCCESS
);
886 isset_var (HashTable
* st
, char *name
, int length
)
888 return zend_hash_exists (st
, name
, length
);
892 isset_array (zval
** p_var
, zval
* ind
)
894 if (Z_TYPE_P (*p_var
) == IS_STRING
)
896 ind
= zvp_clone_ex (ind
);
897 convert_to_long (ind
);
898 int result
= (Z_LVAL_P (ind
) >= 0
899 && Z_LVAL_P (ind
) < Z_STRLEN_PP (p_var
));
900 assert (ind
->refcount
== 1);
901 zval_ptr_dtor (&ind
);
905 // NO error required; return false
906 if (Z_TYPE_P (*p_var
) != IS_ARRAY
)
909 // if its not an array, make it an array
910 HashTable
*ht
= Z_ARRVAL_P (*p_var
);
913 if (ht_find (ht
, ind
, &data
) == SUCCESS
)
915 return !ZVAL_IS_NULL (*data
);
923 fetch_var_arg_by_ref (zval
** p_arg
)
925 // We are passing by reference
926 sep_copy_on_write (p_arg
);
928 // We don't need to restore ->is_ref afterwards,
929 // because the called function will reduce the
930 // refcount of arg on return, and will reset is_ref to
931 // 0 when refcount drops to 1. If the refcount does
932 // not drop to 1 when the function returns, but we did
933 // set is_ref to 1 here, that means that is_ref must
934 // already have been 1 to start with (since if it had
935 // not, that means that the variable would have been
936 // in a copy-on-write set, and would have been
938 (*p_arg
)->is_ref
= 1;
943 /* Dont pass-by-ref */
945 fetch_var_arg (zval
* arg
, int *is_arg_new
)
949 // We dont separate since we don't own one of ARG's references.
950 arg
= zvp_clone_ex (arg
);
953 // It seems we get incorrect refcounts without this.
954 // TODO This decreases the refcount to zero, which seems wrong,
955 // but gives the right answer. We should look at how zend does
963 // TODO dont overwrite line numbers if we're compiling an extension
965 phc_setup_error (int init
, char *filename
, int line_number
,
966 zend_function
* function TSRMLS_DC
)
968 static int old_in_compilation
;
969 static int old_in_execution
;
970 static char *old_filename
;
971 static int old_lineno
;
972 static zend_function
*old_function
;
975 if (filename
== NULL
)
976 filename
= "[phc_compiled_file]";
978 old_in_compilation
= CG (in_compilation
);
979 old_in_execution
= EG (in_execution
);
980 old_filename
= CG (compiled_filename
);
981 old_lineno
= CG (zend_lineno
);
982 old_function
= EG (function_state_ptr
)->function
;
984 CG (in_compilation
) = 1;
985 EG (in_execution
) = 1;
986 CG (compiled_filename
) = filename
;
987 CG (zend_lineno
) = line_number
;
989 EG (function_state_ptr
)->function
= function
;
993 CG (in_compilation
) = old_in_compilation
;
994 EG (in_execution
) = old_in_execution
;
995 CG (compiled_filename
) = old_filename
;
996 CG (zend_lineno
) = old_lineno
;
997 EG (function_state_ptr
)->function
= old_function
;
1002 initialize_function_call (zend_fcall_info
* fci
, zend_fcall_info_cache
* fcic
,
1003 char *function_name
, char *filename
,
1004 int line_number TSRMLS_DC
)
1006 if (fcic
->initialized
)
1011 ZVAL_STRING (&fn
, function_name
, 0);
1012 int result
= zend_fcall_info_init (&fn
, fci
, fcic TSRMLS_CC
);
1013 if (result
!= SUCCESS
)
1015 phc_setup_error (1, filename
, line_number
, NULL TSRMLS_CC
);
1016 php_error_docref (NULL TSRMLS_CC
, E_ERROR
,
1017 "Call to undefined function %s()", function_name
);
1022 * Initialize zend_fcall_info for a method lookup
1024 * Implementation partly based on zend_call_method in Zend/zend_interfaces.c
1025 * Main difference is that we use Z_OBJ_HTT_PP(obj)->get_method to retrieve
1026 * the function handler for the method instead of looking it up directly;
1027 * this means that we correctly deal with __call.
1031 initialize_method_call (zend_fcall_info
* fci
, zend_fcall_info_cache
* fcic
,
1032 zval
** obj
, char *function_name
,
1033 char *filename
, int line_number TSRMLS_DC
)
1035 if (fcic
->initialized
)
1038 zend_class_entry
*obj_ce
;
1039 obj_ce
= Z_OBJCE_PP (obj
);
1042 * we do not initialize fci.
1043 * function_table -- not initialized by zend_call_method
1044 * function_name -- zend_call_method initializes this to a pointer to
1045 * a zval 'z_fname', but does not initialize z_fname
1046 * in case of a method invocation
1047 * retval_ptr_ptr -- should be initialized by caller
1048 * param_count -- should be initialized by caller
1049 * params -- should be initialized by caller
1051 fci
->size
= sizeof (*fci
);
1052 fci
->object_pp
= obj
;
1053 fci
->no_separation
= 1;
1054 fci
->symbol_table
= NULL
;
1056 fcic
->initialized
= 1;
1057 fcic
->calling_scope
= obj_ce
;
1058 fcic
->object_pp
= obj
;
1059 fcic
->function_handler
1060 = Z_OBJ_HT_PP (obj
)->get_method (obj
,
1062 strlen (function_name
) TSRMLS_CC
);
1064 if (fcic
->function_handler
== NULL
)
1066 phc_setup_error (1, filename
, line_number
, NULL TSRMLS_CC
);
1067 php_error_docref (NULL TSRMLS_CC
, E_ERROR
,
1068 "Call to undefined method %s::%s",
1069 obj_ce
->name
, function_name
);
1074 * Like initialize_method_call, but return 0 if no constructor is defined
1075 * rather than giving an error.
1079 initialize_constructor_call (zend_fcall_info
* fci
,
1080 zend_fcall_info_cache
* fcic
, zval
** obj
,
1081 char *filename
, int line_number TSRMLS_DC
)
1083 if (fcic
->initialized
)
1086 zend_class_entry
*obj_ce
;
1087 obj_ce
= Z_OBJCE_PP (obj
);
1090 * we do not initialize fci.
1091 * function_table -- not initialized by zend_call_method
1092 * function_name -- zend_call_method initializes this to a pointer to
1093 * a zval 'z_fname', but does not initialize z_fname
1094 * in case of a method invocation
1095 * retval_ptr_ptr -- should be initialized by caller
1096 * param_count -- should be initialized by caller
1097 * params -- should be initialized by caller
1099 fci
->size
= sizeof (*fci
);
1100 fci
->object_pp
= obj
;
1101 fci
->no_separation
= 1;
1102 fci
->symbol_table
= NULL
;
1104 fcic
->initialized
= 1;
1105 fcic
->calling_scope
= obj_ce
;
1106 fcic
->object_pp
= obj
;
1107 fcic
->function_handler
1108 = Z_OBJ_HT_PP (obj
)->get_constructor (*obj TSRMLS_CC
);
1110 return (fcic
->function_handler
!= NULL
);
1115 * Creates a copy of *in using persistent memory, optionally destroying *in
1117 * Does not work for objects/resources and will loop on self-recursive arrays.
1121 persistent_clone (zval
* in
, int destroy_in TSRMLS_DC
)
1123 zval
*out
= pemalloc (sizeof (zval
), 1);
1126 switch (Z_TYPE_P (in
))
1132 /* nothing more to be done */
1135 Z_STRVAL_P (out
) = pemalloc (Z_STRLEN_P (in
) + 1, 1);
1136 memcpy (Z_STRVAL_P (out
), Z_STRVAL_P (in
), Z_STRLEN_P (in
) + 1);
1140 HashTable
*old_arr
= Z_ARRVAL_P (in
);
1141 HashTable
*new_arr
= pemalloc (sizeof (HashTable
), 1);
1142 zend_hash_init (new_arr
, old_arr
->nNumOfElements
, NULL
, ZVAL_PTR_DTOR
,
1143 /* persistent */ 1);
1145 for (zend_hash_internal_pointer_reset (old_arr
);
1146 zend_hash_has_more_elements (old_arr
) == SUCCESS
;
1147 zend_hash_move_forward (old_arr
))
1153 zval
**old_elem
, *new_elem
;
1156 zend_hash_get_current_key_ex (old_arr
, &key
, &keylen
, &idx
, 0,
1158 assert (zend_hash_get_current_data
1159 (old_arr
, (void **) &old_elem
) == SUCCESS
);
1161 new_elem
= persistent_clone (*old_elem
, destroy_in TSRMLS_CC
);
1163 if (type
== HASH_KEY_IS_STRING
)
1164 zend_hash_add (new_arr
, key
, keylen
, &new_elem
, sizeof (zval
*),
1167 zend_hash_index_update (new_arr
, idx
, &new_elem
,
1168 sizeof (zval
*), NULL
);
1172 Z_ARRVAL_P (out
) = new_arr
;
1176 /* other types are not supported */
1180 zval_ptr_dtor (&in
);
1185 * Wrapper around zend_declare_property which
1187 * - Asserts that the ZEND_INTERNAL_CLASS flag is cleared
1188 * (otherwise we cannot add complex (i.e., array) properties)
1189 * - Creates a persistent clone of the property to be added before
1190 * calling zend_declare_property, since the memory for this property
1191 * should only be deallocated when the module is shut down
1192 * (and not when the request finishes)
1193 * - Cleans up after zend_declare_property by re-allocating the name of
1194 * the property using persistent memory, for much the same reason
1198 phc_declare_property (zend_class_entry
* ce
, char *name
, int name_length
,
1199 zval
* property
, int access_type TSRMLS_DC
)
1201 assert (!(ce
->type
& ZEND_INTERNAL_CLASS
));
1202 assert (zend_declare_property
1203 (ce
, name
, name_length
, persistent_clone (property
, 1 TSRMLS_CC
),
1204 access_type TSRMLS_CC
) == SUCCESS
);
1206 zend_property_info
*property_info
;
1207 assert (zend_hash_find
1208 (&ce
->properties_info
, name
, name_length
+ 1,
1209 (void **) &property_info
) == SUCCESS
);
1210 efree (property_info
->name
);
1211 property_info
->name
= name
;
1220 cast_var (zval
** p_zvp
, int type
)
1222 assert (type
>= 0 && type
<= 6);
1223 if ((*p_zvp
)->type
== type
)
1226 sep_copy_on_write (p_zvp
);
1232 convert_to_null (zvp
);
1235 convert_to_boolean (zvp
);
1238 convert_to_long (zvp
);
1241 convert_to_double (zvp
);
1244 convert_to_string (zvp
);
1247 convert_to_array (zvp
);
1250 convert_to_object (zvp
);
1253 assert (0); // TODO unimplemented
1258 /* Copies a constant into ZVP. Note that LENGTH does not include the NULL-terminating byte. */
1260 get_constant (char *name
, int length
, zval
** p_zvp TSRMLS_DC
)
1262 MAKE_STD_ZVAL (*p_zvp
);
1263 // zend_get_constant returns 1 for success, not SUCCESS
1264 int result
= zend_get_constant (name
, length
, *p_zvp TSRMLS_CC
);
1266 ZVAL_STRINGL (*p_zvp
, name
, length
, 1);
1269 /* The function call mechanism deals specially with EG(uninitialize_zval_ptr)
1270 * (or sometime EG(uninitialize_zval)), so we need to use this too. This
1271 * particular zval can also be set, but there is an implicit guarantee
1272 * of the information below.
1274 * If assertions are off, this should be inlined to nothing.
1277 phc_check_invariants (TSRMLS_D
)
1279 assert (EG (uninitialized_zval_ptr
) == &EG (uninitialized_zval
));
1280 assert (EG (uninitialized_zval
).refcount
>= 1);
1281 assert (EG (uninitialized_zval
).value
.lval
== 0);
1282 assert (EG (uninitialized_zval
).type
== IS_NULL
);
1283 assert (EG (uninitialized_zval
).is_ref
== 0);
1288 check_unset_index_type (zval
* ind TSRMLS_DC
)
1290 if (Z_TYPE_P (ind
) == IS_OBJECT
|| Z_TYPE_P (ind
) == IS_ARRAY
)
1292 php_error_docref (NULL TSRMLS_CC
, E_WARNING
,
1293 "Illegal offset type in unset");
1307 unset_var (HashTable
* st
, char *name
, int length
)
1309 zend_hash_del (st
, name
, length
);
1313 unset_array (zval
** p_var
, zval
* ind TSRMLS_DC
)
1315 // NO error required
1316 if (Z_TYPE_PP (p_var
) != IS_ARRAY
)
1318 if (Z_TYPE_PP (p_var
) == IS_STRING
)
1320 php_error_docref (NULL TSRMLS_CC
, E_ERROR
,
1321 "Cannot unset string offsets");
1323 else if (Z_TYPE_PP (p_var
) != IS_NULL
)
1325 php_error_docref (NULL TSRMLS_CC
, E_WARNING
,
1326 "Cannot unset offsets in a non-array variable");
1332 // if its not an array, make it an array
1333 HashTable
*ht
= Z_ARRVAL_P (*p_var
);
1335 ht_delete (ht
, ind
);
1339 * Lookup variable whose name is var_var in st. We do not call
1340 * ht_find because ht_find uses zend_symtable_find to search for strings
1341 * rather than zend_hash_find. The difference is that zend_symtable_find
1342 * will convert strings to integers where possible: arrays are always
1343 * integer-indexed if at all possible. Variable names however should
1344 * _always_ be treated as strings.
1349 * If the parameter is a string, returns the parameter, with the refcount
1350 * incremented. If its not a string, returns a new zval, with a refcount of
1351 * 1. Either way, zval_dtor_ptr must be run by the caller on the return
1355 get_string_val (zval
* zvp
)
1357 if (Z_TYPE_P (zvp
) == IS_STRING
)
1364 zval
* clone
= zvp_clone_ex (zvp
);
1365 convert_to_string (clone
);
1371 get_var_var (HashTable
* st
, zval
* index TSRMLS_DC
)
1373 zval
* str_index
= get_string_val (index
);
1374 char* name
= Z_STRVAL_P (str_index
);
1375 int length
= Z_STRLEN_P (str_index
) + 1;
1376 unsigned long hash
= zend_get_hash_value (name
, length
);
1378 zval
** result
= get_st_entry (st
, name
, length
, hash TSRMLS_CC
);
1379 zval_ptr_dtor (&str_index
);
1384 * Read the variable described by var_var from symbol table st
1385 * See comments for get_var_var
1388 read_var_var (HashTable
* st
, zval
* index TSRMLS_DC
)
1390 zval
* str_index
= get_string_val (index
);
1391 char* name
= Z_STRVAL_P (str_index
);
1392 int length
= Z_STRLEN_P (str_index
) + 1;
1393 unsigned long hash
= zend_get_hash_value (name
, length
);
1395 zval
* result
= read_var (st
, name
, length
, hash TSRMLS_CC
);
1396 zval_ptr_dtor (&str_index
);
1401 phc_builtin_eval (zval
* arg
, zval
** p_result
, char *filename TSRMLS_DC
)
1403 // If the user wrote "return ..", we need to store the
1404 // return value; however, in that case, zend_eval_string
1405 // will slap an extra "return" onto the front of the string,
1406 // so we must remove the "return" from the string the user
1407 // wrote. If the user did not write "return", he is not
1408 // interested in the return value, and we must pass NULL
1409 // instead or rhs to avoid zend_eval_string adding "return".
1411 // convert to a string
1412 // TODO avoid allocation
1413 zval
*copy
= zvp_clone_ex (arg
);
1414 convert_to_string (copy
);
1416 if (*p_result
&& !strncmp (Z_STRVAL_P (copy
), "return ", 7))
1418 zend_eval_string (Z_STRVAL_P (copy
) + 7, *p_result
,
1419 "eval'd code" TSRMLS_CC
);
1423 zend_eval_string (Z_STRVAL_P (copy
), NULL
, "eval'd code" TSRMLS_CC
);
1427 assert (copy
->refcount
== 1);
1428 zval_ptr_dtor (©
);
1432 phc_builtin_exit (zval
* arg
, zval
** p_result
, char *filename TSRMLS_DC
)
1434 if (Z_TYPE_P (arg
) == IS_LONG
)
1435 EG (exit_status
) = Z_LVAL_P (arg
);
1437 zend_print_variable (arg
);
1443 phc_builtin_die (zval
* arg
, zval
** p_result
, char *filename TSRMLS_DC
)
1445 phc_builtin_exit (arg
, p_result
, filename TSRMLS_CC
);
1449 phc_builtin_echo (zval
* arg
, zval
** p_result TSRMLS_DC
)
1451 assert (*p_result
== NULL
);
1452 zend_print_variable (arg
);
1456 phc_builtin_print (zval
* arg
, zval
** p_result
, char *filename TSRMLS_DC
)
1458 zval
*echo_arg
= NULL
;
1459 phc_builtin_echo (arg
, &echo_arg TSRMLS_CC
);
1462 ZVAL_LONG (*p_result
, 1);
1465 // TODO is there a memory leak here is result has a value?
1466 // TOOD isnt this just the same as isset
1468 phc_builtin_empty (zval
* arg
, zval
** p_result
, char *filename TSRMLS_DC
)
1471 ZVAL_BOOL (*p_result
, !zend_is_true (arg
));
1474 // For require, include, require_once and include_once.
1477 // return 1 for success
1478 // Warning, and return false for failure
1480 // return 1 for success
1483 // Return true if already included
1484 // Return 1 for success
1485 // Warning and return false for failure
1487 // Return true if already included
1488 // return 1 for success
1492 include_backend (zval
* arg
, zval
** p_result
, char *filename
, int type
, int is_once
, char* error
, char* error_function TSRMLS_DC
)
1494 // In the event that the Zend engine cannot find the file, after checking the
1495 // include path, it tries the current directory. It does this only if the
1496 // interpreter is executing, and it checks the interpreters opcodes for a
1497 // filename (see streams/plain_wrapper.c:1352)
1499 // An alternative is to add the directory to include_path, but its
1500 // semantically incorrect (get_included_path() would give the wrong answer),
1501 // and error prone (if people overwrite include_path).
1502 // TODO: though we could add it for this function only
1504 assert (EG (active_op_array
) == NULL
);
1505 assert (filename
!= NULL
);
1507 zval
*arg_file
= arg
;
1508 // Check we have a string
1509 if (Z_TYPE_P (arg_file
) != IS_STRING
)
1511 arg_file
= zvp_clone_ex (arg_file
);
1512 convert_to_string (arg_file
);
1515 zend_file_handle handle
;
1516 zend_op_array
* new_op_array
;
1519 // Check the _ONCE varieties (based on zend_vm_def.h)
1522 if (IS_ABSOLUTE_PATH (Z_STRVAL_P (arg_file
), Z_STRLEN_P (arg_file
)))
1524 // Get the proper path name for require
1527 state
.cwd_length
= 0;
1528 state
.cwd
= malloc(1);
1530 int success
= !virtual_file_ex(&state
, Z_STRVAL_P(arg_file
), NULL
, 1)
1531 && zend_hash_exists(&EG(included_files
), state
.cwd
,
1532 state
.cwd_length
+1);
1543 // Pretend the interpreter is running
1544 EG (in_execution
) = 1;
1546 int success
= zend_stream_open (Z_STRVAL_P (arg_file
), &handle TSRMLS_CC
);
1549 EG (in_execution
) = 0;
1550 EG (active_op_array
) = NULL
;
1552 if (success
!= SUCCESS
)
1558 // Check it hadnt been included already
1559 int once_success
= zend_hash_add_empty_element(&EG(included_files
),
1561 strlen (handle
.opened_path
)+1);
1563 if (once_success
!= SUCCESS
)
1565 ZVAL_BOOL (*p_result
, 1);
1570 if (!handle
.opened_path
)
1571 handle
.opened_path
= estrndup (Z_STRVAL_P(arg_file
), Z_STRLEN_P (arg_file
));
1574 success
= zend_execute_scripts (type TSRMLS_CC
, p_result
, 1, &handle
);
1575 assert (success
== SUCCESS
);
1576 zend_stream_close (&handle
);
1580 ZVAL_LONG (*p_result
, 1);
1588 php_error_docref (error_function
1590 (type
== ZEND_INCLUDE
) ? E_WARNING
: E_ERROR
,
1592 php_strip_url_passwd (Z_STRVAL_P (arg_file
)),
1593 STR_PRINT (PG (include_path
)));
1598 ZVAL_BOOL (*p_result
, 0);
1602 if (handle
.opened_path
)
1603 efree (handle
.opened_path
);
1604 zend_destroy_file_handle (&handle TSRMLS_CC
);
1607 if (arg
!= arg_file
)
1608 zval_ptr_dtor (&arg_file
);
1612 phc_builtin_include (zval
* arg
, zval
** p_result
, char *filename TSRMLS_DC
)
1614 include_backend ( arg
,
1619 "Failed opening '%s' for inclusion (include_path='%s')",
1625 phc_builtin_require (zval
* arg
, zval
** p_result
, char *filename TSRMLS_DC
)
1627 include_backend ( arg
,
1632 "Failed opening required '%s' (include_path='%s')",
1638 phc_builtin_include_once (zval
* arg
, zval
** p_result
, char *filename TSRMLS_DC
)
1640 include_backend ( arg
,
1645 "Failed opening '%s' for inclusion (include_path='%s')",
1646 "function.include_once"
1651 phc_builtin_require_once (zval
* arg
, zval
** p_result
, char *filename TSRMLS_DC
)
1653 include_backend ( arg
,
1658 "Failed opening required '%s' (include_path='%s')",
1659 "function.require_once"
1663 // END INCLUDED FILES
1665 static zend_fcall_info array_keys_fci
;
1666 static zend_fcall_info_cache array_keys_fcic
= {0,NULL
,NULL
,NULL
};
1667 static zend_fcall_info is_null_fci
;
1668 static zend_fcall_info_cache is_null_fcic
= {0,NULL
,NULL
,NULL
};
1669 static zend_fcall_info version_compare_fci
;
1670 static zend_fcall_info_cache version_compare_fcic
= {0,NULL
,NULL
,NULL
};
1671 static zend_fcall_info wfsetvar_fci
;
1672 static zend_fcall_info_cache wfsetvar_fcic
= {0,NULL
,NULL
,NULL
};
1673 // class ParserOutput
1675 // var $mText = NULL;
1676 // var $mLanguageLinks = NULL;
1677 // var $mCategories = NULL;
1678 // var $mContainsOldMagic = NULL;
1679 // var $mTitleText = NULL;
1680 // var $mCacheTime = '';
1681 // var $mVersion = Parser::VERSION;
1682 // var $mLinks = array();
1683 // var $mTemplates = array();
1684 // var $mTemplateIds = array();
1685 // var $mImages = array();
1686 // var $mExternalLinks = array();
1687 // var $mNewSection = False;
1688 // var $mNoGallery = False;
1689 // var $mHeadItems = array();
1690 // var $mOutputHooks = array();
1691 // var $mWarnings = array();
1692 // var $mSections = array();
1693 // var $mProperties = array();
1694 // private $mIndexPolicy = '';
1695 // private $displayTitle = False;
1696 // function parseroutput($text = '', $languageLinks = array(), $categoryLinks = array(), $containsOldMagic = False, $titletext = '')
1698 // $this->mText = $text;
1699 // $this->mLanguageLinks = $languageLinks;
1700 // $this->mCategories = $categoryLinks;
1701 // $this->mContainsOldMagic = $containsOldMagic;
1702 // $this->mTitleText = $titletext;
1704 // function gettext()
1706 // $TSt9 = $this->mText;
1709 // function &getlanguagelinks()
1711 // $TSt10 =& $this->mLanguageLinks;
1714 // function getcategorylinks()
1716 // $TLE100 = param_is_ref (NULL, "array_keys", 0);
1718 // if (TLE100) goto L128 else goto L129;
1720 // $TMIt99 =& $this->mCategories;
1723 // $TMIt99 = $this->mCategories;
1726 // $TLE11 = array_keys($TMIt99);
1729 // function &getcategories()
1731 // $TSt12 =& $this->mCategories;
1734 // function getcachetime()
1736 // $TSt13 = $this->mCacheTime;
1739 // function gettitletext()
1741 // $TSt14 = $this->mTitleText;
1744 // function getsections()
1746 // $TSt15 = $this->mSections;
1749 // function &getlinks()
1751 // $TSt16 =& $this->mLinks;
1754 // function &gettemplates()
1756 // $TSt17 =& $this->mTemplates;
1759 // function &getimages()
1761 // $TSt18 =& $this->mImages;
1764 // function &getexternallinks()
1766 // $TSt19 =& $this->mExternalLinks;
1769 // function getnogallery()
1771 // $TSt20 = $this->mNoGallery;
1774 // function getsubtitle()
1776 // $TSt21 = $this->mSubtitle;
1779 // function getoutputhooks()
1781 // $TSt22 = $this->mOutputHooks;
1782 // $TLE23 = (array) $TSt22;
1785 // function getwarnings()
1787 // $TLE102 = param_is_ref (NULL, "array_keys", 0);
1789 // if (TLE102) goto L131 else goto L132;
1791 // $TMIt101 =& $this->mWarnings;
1794 // $TMIt101 = $this->mWarnings;
1797 // $TLE24 = array_keys($TMIt101);
1800 // function getindexpolicy()
1802 // $TSt25 = $this->mIndexPolicy;
1805 // function containsoldmagic()
1807 // $TSt26 = $this->mContainsOldMagic;
1810 // function settext($text)
1812 // $TLE104 = param_is_ref (NULL, "wfsetvar", 0);
1814 // if (TLE104) goto L134 else goto L135;
1816 // $TMIt103 =& $this->mText;
1819 // $TMIt103 = $this->mText;
1822 // $TLE27 = wfsetvar($TMIt103, $text);
1825 // function setlanguagelinks($ll)
1827 // $TLE106 = param_is_ref (NULL, "wfsetvar", 0);
1829 // if (TLE106) goto L137 else goto L138;
1831 // $TMIt105 =& $this->mLanguageLinks;
1834 // $TMIt105 = $this->mLanguageLinks;
1837 // $TLE28 = wfsetvar($TMIt105, $ll);
1840 // function setcategorylinks($cl)
1842 // $TLE108 = param_is_ref (NULL, "wfsetvar", 0);
1844 // if (TLE108) goto L140 else goto L141;
1846 // $TMIt107 =& $this->mCategories;
1849 // $TMIt107 = $this->mCategories;
1852 // $TLE29 = wfsetvar($TMIt107, $cl);
1855 // function setcontainsoldmagic($com)
1857 // $TLE110 = param_is_ref (NULL, "wfsetvar", 0);
1859 // if (TLE110) goto L143 else goto L144;
1861 // $TMIt109 =& $this->mContainsOldMagic;
1864 // $TMIt109 = $this->mContainsOldMagic;
1867 // $TLE30 = wfsetvar($TMIt109, $com);
1870 // function setcachetime($t)
1872 // $TLE112 = param_is_ref (NULL, "wfsetvar", 0);
1874 // if (TLE112) goto L146 else goto L147;
1876 // $TMIt111 =& $this->mCacheTime;
1879 // $TMIt111 = $this->mCacheTime;
1882 // $TLE31 = wfsetvar($TMIt111, $t);
1885 // function settitletext($t)
1887 // $TLE114 = param_is_ref (NULL, "wfsetvar", 0);
1889 // if (TLE114) goto L149 else goto L150;
1891 // $TMIt113 =& $this->mTitleText;
1894 // $TMIt113 = $this->mTitleText;
1897 // $TLE32 = wfsetvar($TMIt113, $t);
1900 // function setsections($toc)
1902 // $TLE116 = param_is_ref (NULL, "wfsetvar", 0);
1904 // if (TLE116) goto L152 else goto L153;
1906 // $TMIt115 =& $this->mSections;
1909 // $TMIt115 = $this->mSections;
1912 // $TLE33 = wfsetvar($TMIt115, $toc);
1915 // function setindexpolicy($policy)
1917 // $TLE118 = param_is_ref (NULL, "wfsetvar", 0);
1919 // if (TLE118) goto L155 else goto L156;
1921 // $TMIt117 =& $this->mIndexPolicy;
1924 // $TMIt117 = $this->mIndexPolicy;
1927 // $TLE34 = wfsetvar($TMIt117, $policy);
1930 // function addcategory($c, $sort)
1932 // $TSt35 =& $this->mCategories;
1933 // $TSt35[$c] = $sort;
1935 // function addlanguagelink($t)
1937 // $TSt36 =& $this->mLanguageLinks;
1940 // function addexternallink($url)
1942 // $TSt37 =& $this->mExternalLinks;
1944 // $TSt37[$url] = $TLE38;
1946 // function addwarning($s)
1948 // $TSt39 =& $this->mWarnings;
1950 // $TSt39[$s] = $TLE40;
1952 // function addoutputhook($hook, $data = False)
1954 // $TSt41 =& $this->mOutputHooks;
1956 // $TSa42 = (array) $TSa42;
1957 // $TSa42[] = $hook;
1958 // $TSa42[] = $data;
1959 // $TSt41[] = $TSa42;
1961 // function setnewsection($value)
1963 // $TLE43 = (bool) $value;
1964 // $this->mNewSection = $TLE43;
1966 // function getnewsection()
1968 // $TSt44 = $this->mNewSection;
1969 // $TLE45 = (bool) $TSt44;
1972 // function addlink($title, $id = NULL)
1974 // $ns = $title->getnamespace();
1975 // $dbk = $title->getdbkey();
1976 // $TLE46 = NS_MEDIA;
1977 // $TLE47 = ($ns == $TLE46);
1978 // if (TLE47) goto L164 else goto L165;
1983 // $TLE48 = NS_SPECIAL;
1984 // $TLE49 = ($ns == $TLE48);
1985 // if (TLE49) goto L161 else goto L162;
1992 // $TLE52 = ($dbk === $TLE51);
1993 // if (TLE52) goto L158 else goto L159;
2005 // $TMIt119 = $this->mLinks;
2006 // $TLE54 = isset($TMIt119[$ns]);
2007 // $TLE55 = !$TLE54;
2008 // if (TLE55) goto L167 else goto L168;
2010 // $TSt56 =& $this->mLinks;
2012 // $TSa57 = (array) $TSa57;
2013 // $TSt56[$ns] = $TSa57;
2018 // $TLE58 = is_null($id);
2019 // if (TLE58) goto L170 else goto L171;
2021 // $id = $title->getarticleid();
2026 // $TSt59 =& $this->mLinks;
2027 // $TSi60 =& $TSt59[$ns];
2028 // $TSi60[$dbk] = $id;
2030 // function addimage($name)
2032 // $TSt61 =& $this->mImages;
2034 // $TSt61[$name] = $TLE62;
2036 // function addtemplate($title, $page_id, $rev_id)
2038 // $ns = $title->getnamespace();
2039 // $dbk = $title->getdbkey();
2040 // $TMIt120 = $this->mTemplates;
2041 // $TLE63 = isset($TMIt120[$ns]);
2042 // $TLE64 = !$TLE63;
2043 // if (TLE64) goto L173 else goto L174;
2045 // $TSt65 =& $this->mTemplates;
2047 // $TSa66 = (array) $TSa66;
2048 // $TSt65[$ns] = $TSa66;
2053 // $TSt67 =& $this->mTemplates;
2054 // $TSi68 =& $TSt67[$ns];
2055 // $TSi68[$dbk] = $page_id;
2056 // $TMIt121 = $this->mTemplateIds;
2057 // $TLE69 = isset($TMIt121[$ns]);
2058 // $TLE70 = !$TLE69;
2059 // if (TLE70) goto L176 else goto L177;
2061 // $TSt71 =& $this->mTemplateIds;
2063 // $TSa72 = (array) $TSa72;
2064 // $TSt71[$ns] = $TSa72;
2069 // $TSt73 =& $this->mTemplateIds;
2070 // $TSi74 =& $TSt73[$ns];
2071 // $TSi74[$dbk] = $rev_id;
2073 // function expired($touched)
2075 // global $wgCacheEpoch;
2076 // $TLE75 = $this->getcachetime();
2078 // $TLE0 = ($TLE75 == $TLE76);
2079 // if (TLE0) goto L179 else goto L180;
2084 // $TLE77 = $this->getcachetime();
2085 // $TEF1 = ($TLE77 < $touched);
2088 // $TLE2 = (bool) $TEF1;
2089 // if (TLE2) goto L182 else goto L183;
2094 // $TLE78 = $this->getcachetime();
2095 // $TEF3 = ($TLE78 <= $wgCacheEpoch);
2098 // $TLE4 = (bool) $TEF3;
2099 // if (TLE4) goto L185 else goto L186;
2104 // $TMIt122 = $this->mVersion;
2105 // $TLE79 = isset($TMIt122);
2109 // $TLE6 = (bool) $TEF5;
2110 // if (TLE6) goto L191 else goto L192;
2115 // $TLE80 = Parser::VERSION;
2117 // $TLE124 = param_is_ref (NULL, "version_compare", 0);
2119 // if (TLE124) goto L188 else goto L189;
2121 // $TMIt123 =& $this->mVersion;
2124 // $TMIt123 = $this->mVersion;
2127 // $TEF7 = version_compare($TMIt123, $TLE80, $TLE81);
2130 // $TLE82 = (bool) $TEF7;
2133 // function addheaditem($section, $tag = False)
2136 // $TLE84 = ($tag !== $TLE83);
2137 // if (TLE84) goto L194 else goto L195;
2139 // $TSt85 =& $this->mHeadItems;
2140 // $TSt85[$tag] = $section;
2143 // $TSt86 =& $this->mHeadItems;
2144 // $TSt86[] = $section;
2148 // public function setdisplaytitle($text)
2150 // $this->displayTitle = $text;
2152 // public function getdisplaytitle()
2154 // $TSt87 = $this->displayTitle;
2157 // public function setflag($flag)
2159 // $TSt88 =& $this->mFlags;
2161 // $TSt88[$flag] = $TLE89;
2163 // public function getflag($flag)
2165 // $TMIt125 = $this->mFlags;
2166 // $TLE90 = isset($TMIt125[$flag]);
2169 // public function setproperty($name, $value)
2171 // $TSt91 =& $this->mProperties;
2172 // $TSt91[$name] = $value;
2174 // public function getproperty($name)
2176 // $TMIt126 = $this->mProperties;
2177 // $TLE92 = isset($TMIt126[$name]);
2178 // if (TLE92) goto L197 else goto L198;
2180 // $TSt93 = $this->mProperties;
2181 // $TSi94 = $TSt93[$name];
2190 // public function getproperties()
2192 // $TMIt127 = $this->mProperties;
2193 // $TLE95 = isset($TMIt127);
2194 // $TLE96 = !$TLE95;
2195 // if (TLE96) goto L200 else goto L201;
2198 // $TSa97 = (array) $TSa97;
2199 // $this->mProperties = $TSa97;
2204 // $TSt98 = $this->mProperties;
2208 // function parseroutput($text = '', $languageLinks = array(), $categoryLinks = array(), $containsOldMagic = False, $titletext = '')
2210 // $this->mText = $text;
2211 // $this->mLanguageLinks = $languageLinks;
2212 // $this->mCategories = $categoryLinks;
2213 // $this->mContainsOldMagic = $containsOldMagic;
2214 // $this->mTitleText = $titletext;
2216 PHP_METHOD(ParserOutput
, parseroutput
)
2218 zval
* local_categoryLinks
= NULL
;
2219 zval
* local_containsOldMagic
= NULL
;
2220 zval
* local_languageLinks
= NULL
;
2221 zval
* local_text
= NULL
;
2222 zval
* local_this
= getThis();
2223 zval
* local_titletext
= NULL
;
2224 // Add all parameters as local variables
2226 int num_args
= ZEND_NUM_ARGS ();
2228 zend_get_parameters_array(0, num_args
, params
);
2232 zval
* default_value
;
2234 zval
* local___static_value__
= NULL
;
2235 // $__static_value__ = '';
2237 if (local___static_value__
== NULL
)
2239 local___static_value__
= EG (uninitialized_zval_ptr
);
2240 local___static_value__
->refcount
++;
2242 zval
** p_lhs
= &local___static_value__
;
2245 if ((*p_lhs
)->is_ref
)
2247 // Always overwrite the current value
2253 ALLOC_INIT_ZVAL (value
);
2254 zval_ptr_dtor (p_lhs
);
2258 ZVAL_STRINGL(value
, "", 0, 1);
2260 phc_check_invariants (TSRMLS_C
);
2262 default_value
= local___static_value__
;
2263 assert(!default_value
->is_ref
);
2264 default_value
->refcount
++;
2265 if (local___static_value__
!= NULL
)
2267 zval_ptr_dtor (&local___static_value__
);
2270 default_value
->refcount
--;
2271 params
[0] = default_value
;
2273 params
[0]->refcount
++;
2274 if (local_text
!= NULL
)
2276 zval_ptr_dtor (&local_text
);
2278 local_text
= params
[0];
2282 zval
* default_value
;
2284 zval
* local_TSa203
= NULL
;
2285 zval
* local___static_value__
= NULL
;
2288 if (local_TSa203
!= NULL
)
2290 zval_ptr_dtor (&local_TSa203
);
2291 local_TSa203
= NULL
;
2293 phc_check_invariants (TSRMLS_C
);
2295 // $TSa203 = (array) $TSa203;
2297 if (local_TSa203
== NULL
)
2299 local_TSa203
= EG (uninitialized_zval_ptr
);
2300 local_TSa203
->refcount
++;
2302 zval
** p_lhs
= &local_TSa203
;
2305 if (local_TSa203
== NULL
)
2306 rhs
= EG (uninitialized_zval_ptr
);
2312 if ((*p_lhs
)->is_ref
)
2313 overwrite_lhs (*p_lhs
, rhs
);
2316 zval_ptr_dtor (p_lhs
);
2319 // Take a copy of RHS for LHS
2320 *p_lhs
= zvp_clone_ex (rhs
);
2333 assert (IS_ARRAY
>= 0 && IS_ARRAY
<= 6);
2334 if ((*p_lhs
)->type
!= IS_ARRAY
)
2336 sep_copy_on_write (p_lhs
);
2337 convert_to_array (*p_lhs
);
2340 phc_check_invariants (TSRMLS_C
);
2342 // $__static_value__ = $TSa203;
2344 if (local___static_value__
== NULL
)
2346 local___static_value__
= EG (uninitialized_zval_ptr
);
2347 local___static_value__
->refcount
++;
2349 zval
** p_lhs
= &local___static_value__
;
2352 if (local_TSa203
== NULL
)
2353 rhs
= EG (uninitialized_zval_ptr
);
2359 if ((*p_lhs
)->is_ref
)
2360 overwrite_lhs (*p_lhs
, rhs
);
2363 zval_ptr_dtor (p_lhs
);
2366 // Take a copy of RHS for LHS
2367 *p_lhs
= zvp_clone_ex (rhs
);
2379 phc_check_invariants (TSRMLS_C
);
2381 default_value
= local___static_value__
;
2382 assert(!default_value
->is_ref
);
2383 default_value
->refcount
++;
2384 if (local_TSa203
!= NULL
)
2386 zval_ptr_dtor (&local_TSa203
);
2388 if (local___static_value__
!= NULL
)
2390 zval_ptr_dtor (&local___static_value__
);
2393 default_value
->refcount
--;
2394 params
[1] = default_value
;
2396 params
[1]->refcount
++;
2397 if (local_languageLinks
!= NULL
)
2399 zval_ptr_dtor (&local_languageLinks
);
2401 local_languageLinks
= params
[1];
2405 zval
* default_value
;
2407 zval
* local_TSa204
= NULL
;
2408 zval
* local___static_value__
= NULL
;
2411 if (local_TSa204
!= NULL
)
2413 zval_ptr_dtor (&local_TSa204
);
2414 local_TSa204
= NULL
;
2416 phc_check_invariants (TSRMLS_C
);
2418 // $TSa204 = (array) $TSa204;
2420 if (local_TSa204
== NULL
)
2422 local_TSa204
= EG (uninitialized_zval_ptr
);
2423 local_TSa204
->refcount
++;
2425 zval
** p_lhs
= &local_TSa204
;
2428 if (local_TSa204
== NULL
)
2429 rhs
= EG (uninitialized_zval_ptr
);
2435 if ((*p_lhs
)->is_ref
)
2436 overwrite_lhs (*p_lhs
, rhs
);
2439 zval_ptr_dtor (p_lhs
);
2442 // Take a copy of RHS for LHS
2443 *p_lhs
= zvp_clone_ex (rhs
);
2456 assert (IS_ARRAY
>= 0 && IS_ARRAY
<= 6);
2457 if ((*p_lhs
)->type
!= IS_ARRAY
)
2459 sep_copy_on_write (p_lhs
);
2460 convert_to_array (*p_lhs
);
2463 phc_check_invariants (TSRMLS_C
);
2465 // $__static_value__ = $TSa204;
2467 if (local___static_value__
== NULL
)
2469 local___static_value__
= EG (uninitialized_zval_ptr
);
2470 local___static_value__
->refcount
++;
2472 zval
** p_lhs
= &local___static_value__
;
2475 if (local_TSa204
== NULL
)
2476 rhs
= EG (uninitialized_zval_ptr
);
2482 if ((*p_lhs
)->is_ref
)
2483 overwrite_lhs (*p_lhs
, rhs
);
2486 zval_ptr_dtor (p_lhs
);
2489 // Take a copy of RHS for LHS
2490 *p_lhs
= zvp_clone_ex (rhs
);
2502 phc_check_invariants (TSRMLS_C
);
2504 default_value
= local___static_value__
;
2505 assert(!default_value
->is_ref
);
2506 default_value
->refcount
++;
2507 if (local_TSa204
!= NULL
)
2509 zval_ptr_dtor (&local_TSa204
);
2511 if (local___static_value__
!= NULL
)
2513 zval_ptr_dtor (&local___static_value__
);
2516 default_value
->refcount
--;
2517 params
[2] = default_value
;
2519 params
[2]->refcount
++;
2520 if (local_categoryLinks
!= NULL
)
2522 zval_ptr_dtor (&local_categoryLinks
);
2524 local_categoryLinks
= params
[2];
2528 zval
* default_value
;
2530 zval
* local___static_value__
= NULL
;
2531 // $__static_value__ = False;
2533 if (local___static_value__
== NULL
)
2535 local___static_value__
= EG (uninitialized_zval_ptr
);
2536 local___static_value__
->refcount
++;
2538 zval
** p_lhs
= &local___static_value__
;
2541 if ((*p_lhs
)->is_ref
)
2543 // Always overwrite the current value
2549 ALLOC_INIT_ZVAL (value
);
2550 zval_ptr_dtor (p_lhs
);
2554 ZVAL_BOOL (value
, 0);
2556 phc_check_invariants (TSRMLS_C
);
2558 default_value
= local___static_value__
;
2559 assert(!default_value
->is_ref
);
2560 default_value
->refcount
++;
2561 if (local___static_value__
!= NULL
)
2563 zval_ptr_dtor (&local___static_value__
);
2566 default_value
->refcount
--;
2567 params
[3] = default_value
;
2569 params
[3]->refcount
++;
2570 if (local_containsOldMagic
!= NULL
)
2572 zval_ptr_dtor (&local_containsOldMagic
);
2574 local_containsOldMagic
= params
[3];
2578 zval
* default_value
;
2580 zval
* local___static_value__
= NULL
;
2581 // $__static_value__ = '';
2583 if (local___static_value__
== NULL
)
2585 local___static_value__
= EG (uninitialized_zval_ptr
);
2586 local___static_value__
->refcount
++;
2588 zval
** p_lhs
= &local___static_value__
;
2591 if ((*p_lhs
)->is_ref
)
2593 // Always overwrite the current value
2599 ALLOC_INIT_ZVAL (value
);
2600 zval_ptr_dtor (p_lhs
);
2604 ZVAL_STRINGL(value
, "", 0, 1);
2606 phc_check_invariants (TSRMLS_C
);
2608 default_value
= local___static_value__
;
2609 assert(!default_value
->is_ref
);
2610 default_value
->refcount
++;
2611 if (local___static_value__
!= NULL
)
2613 zval_ptr_dtor (&local___static_value__
);
2616 default_value
->refcount
--;
2617 params
[4] = default_value
;
2619 params
[4]->refcount
++;
2620 if (local_titletext
!= NULL
)
2622 zval_ptr_dtor (&local_titletext
);
2624 local_titletext
= params
[4];
2627 // $this->mText = $text;
2629 if (local_this
== NULL
)
2631 local_this
= EG (uninitialized_zval_ptr
);
2632 local_this
->refcount
++;
2634 zval
** p_obj
= &local_this
;
2637 if (local_text
== NULL
)
2638 rhs
= EG (uninitialized_zval_ptr
);
2643 INIT_ZVAL (field_name
);
2644 ZVAL_STRING (&field_name
, "mText", 0);
2646 Z_OBJ_HT_PP(p_obj
)->write_property(*p_obj
, &field_name
, rhs TSRMLS_CC
);
2647 phc_check_invariants (TSRMLS_C
);
2649 // $this->mLanguageLinks = $languageLinks;
2651 if (local_this
== NULL
)
2653 local_this
= EG (uninitialized_zval_ptr
);
2654 local_this
->refcount
++;
2656 zval
** p_obj
= &local_this
;
2659 if (local_languageLinks
== NULL
)
2660 rhs
= EG (uninitialized_zval_ptr
);
2662 rhs
= local_languageLinks
;
2665 INIT_ZVAL (field_name
);
2666 ZVAL_STRING (&field_name
, "mLanguageLinks", 0);
2668 Z_OBJ_HT_PP(p_obj
)->write_property(*p_obj
, &field_name
, rhs TSRMLS_CC
);
2669 phc_check_invariants (TSRMLS_C
);
2671 // $this->mCategories = $categoryLinks;
2673 if (local_this
== NULL
)
2675 local_this
= EG (uninitialized_zval_ptr
);
2676 local_this
->refcount
++;
2678 zval
** p_obj
= &local_this
;
2681 if (local_categoryLinks
== NULL
)
2682 rhs
= EG (uninitialized_zval_ptr
);
2684 rhs
= local_categoryLinks
;
2687 INIT_ZVAL (field_name
);
2688 ZVAL_STRING (&field_name
, "mCategories", 0);
2690 Z_OBJ_HT_PP(p_obj
)->write_property(*p_obj
, &field_name
, rhs TSRMLS_CC
);
2691 phc_check_invariants (TSRMLS_C
);
2693 // $this->mContainsOldMagic = $containsOldMagic;
2695 if (local_this
== NULL
)
2697 local_this
= EG (uninitialized_zval_ptr
);
2698 local_this
->refcount
++;
2700 zval
** p_obj
= &local_this
;
2703 if (local_containsOldMagic
== NULL
)
2704 rhs
= EG (uninitialized_zval_ptr
);
2706 rhs
= local_containsOldMagic
;
2709 INIT_ZVAL (field_name
);
2710 ZVAL_STRING (&field_name
, "mContainsOldMagic", 0);
2712 Z_OBJ_HT_PP(p_obj
)->write_property(*p_obj
, &field_name
, rhs TSRMLS_CC
);
2713 phc_check_invariants (TSRMLS_C
);
2715 // $this->mTitleText = $titletext;
2717 if (local_this
== NULL
)
2719 local_this
= EG (uninitialized_zval_ptr
);
2720 local_this
->refcount
++;
2722 zval
** p_obj
= &local_this
;
2725 if (local_titletext
== NULL
)
2726 rhs
= EG (uninitialized_zval_ptr
);
2728 rhs
= local_titletext
;
2731 INIT_ZVAL (field_name
);
2732 ZVAL_STRING (&field_name
, "mTitleText", 0);
2734 Z_OBJ_HT_PP(p_obj
)->write_property(*p_obj
, &field_name
, rhs TSRMLS_CC
);
2735 phc_check_invariants (TSRMLS_C
);
2738 end_of_function
:__attribute__((unused
));
2739 if (local_categoryLinks
!= NULL
)
2741 zval_ptr_dtor (&local_categoryLinks
);
2743 if (local_containsOldMagic
!= NULL
)
2745 zval_ptr_dtor (&local_containsOldMagic
);
2747 if (local_languageLinks
!= NULL
)
2749 zval_ptr_dtor (&local_languageLinks
);
2751 if (local_text
!= NULL
)
2753 zval_ptr_dtor (&local_text
);
2755 if (local_titletext
!= NULL
)
2757 zval_ptr_dtor (&local_titletext
);
2760 // function gettext()
2762 // $TSt9 = $this->mText;
2765 PHP_METHOD(ParserOutput
, gettext
)
2767 zval
* local_TSt9
= NULL
;
2768 zval
* local_this
= getThis();
2770 // $TSt9 = $this->mText;
2772 if (local_this
== NULL
)
2774 local_this
= EG (uninitialized_zval_ptr
);
2775 local_this
->refcount
++;
2777 zval
** p_obj
= &local_this
;
2780 INIT_ZVAL (field_name
);
2781 ZVAL_STRING (&field_name
, "mText", 0);
2783 // I *think* this is correct, but documentation of the Zend API is scarce :)
2784 zval
* field
= Z_OBJ_HT_PP(p_obj
)->read_property(*p_obj
, &field_name
, BP_VAR_R TSRMLS_CC
);
2785 if (local_TSt9
== NULL
)
2787 local_TSt9
= EG (uninitialized_zval_ptr
);
2788 local_TSt9
->refcount
++;
2790 zval
** p_lhs
= &local_TSt9
;
2792 write_var (p_lhs
, field
);
2793 phc_check_invariants (TSRMLS_C
);
2798 if (local_TSt9
== NULL
)
2799 rhs
= EG (uninitialized_zval_ptr
);
2803 // Run-time return by reference has different semantics to compile-time.
2804 // If the function has CTRBR and RTRBR, the the assignment will be
2805 // reference. If one or the other is return-by-copy, the result will be
2806 // by copy. Its a question of whether its separated at return-time (which
2807 // we do here) or at the call-site.
2808 return_value
->value
= rhs
->value
;
2809 return_value
->type
= rhs
->type
;
2810 zval_copy_ctor (return_value
);
2811 goto end_of_function
;
2812 phc_check_invariants (TSRMLS_C
);
2815 end_of_function
:__attribute__((unused
));
2816 if (local_TSt9
!= NULL
)
2818 zval_ptr_dtor (&local_TSt9
);
2821 // function &getlanguagelinks()
2823 // $TSt10 =& $this->mLanguageLinks;
2826 PHP_METHOD(ParserOutput
, getlanguagelinks
)
2828 zval
* local_TSt10
= NULL
;
2829 zval
* local_this
= getThis();
2831 // $TSt10 =& $this->mLanguageLinks;
2833 if (local_this
== NULL
)
2835 local_this
= EG (uninitialized_zval_ptr
);
2836 local_this
->refcount
++;
2838 zval
** p_obj
= &local_this
;
2841 INIT_ZVAL (field_name
);
2842 ZVAL_STRING (&field_name
, "mLanguageLinks", 0);
2844 zval
** field
= Z_OBJ_HT_PP(p_obj
)->get_property_ptr_ptr(*p_obj
, &field_name TSRMLS_CC
);
2845 sep_copy_on_write (field
);
2846 if (local_TSt10
== NULL
)
2848 local_TSt10
= EG (uninitialized_zval_ptr
);
2849 local_TSt10
->refcount
++;
2851 zval
** p_lhs
= &local_TSt10
;
2853 copy_into_ref (p_lhs
, field
);
2854 phc_check_invariants (TSRMLS_C
);
2858 if (local_TSt10
== NULL
)
2860 local_TSt10
= EG (uninitialized_zval_ptr
);
2861 local_TSt10
->refcount
++;
2863 zval
** p_rhs
= &local_TSt10
;
2865 sep_copy_on_write (p_rhs
);
2866 zval_ptr_dtor (return_value_ptr
);
2867 (*p_rhs
)->is_ref
= 1;
2868 (*p_rhs
)->refcount
++;
2869 *return_value_ptr
= *p_rhs
;
2870 goto end_of_function
;
2871 phc_check_invariants (TSRMLS_C
);
2874 end_of_function
:__attribute__((unused
));
2875 if (local_TSt10
!= NULL
)
2877 zval_ptr_dtor (&local_TSt10
);
2879 if (*return_value_ptr
)
2880 saved_refcount
= (*return_value_ptr
)->refcount
;
2882 // function getcategorylinks()
2884 // $TLE100 = param_is_ref (NULL, "array_keys", 0);
2886 // if (TLE100) goto L128 else goto L129;
2888 // $TMIt99 =& $this->mCategories;
2891 // $TMIt99 = $this->mCategories;
2894 // $TLE11 = array_keys($TMIt99);
2897 PHP_METHOD(ParserOutput
, getcategorylinks
)
2899 zval
* local_TLE100
= NULL
;
2900 zval
* local_TLE11
= NULL
;
2901 zval
* local_TMIt99
= NULL
;
2902 zval
* local_this
= getThis();
2904 // $TLE100 = param_is_ref (NULL, "array_keys", 0);
2907 initialize_function_call (&array_keys_fci
, &array_keys_fcic
, "array_keys", "<unknown>", 0 TSRMLS_CC
);
2908 zend_function
* signature
= array_keys_fcic
.function_handler
;
2909 zend_arg_info
* arg_info
= signature
->common
.arg_info
;
2911 while (arg_info
&& count
< 0)
2917 if (local_TLE100
== NULL
)
2919 local_TLE100
= EG (uninitialized_zval_ptr
);
2920 local_TLE100
->refcount
++;
2922 zval
** p_lhs
= &local_TLE100
;
2925 ALLOC_INIT_ZVAL (rhs
);
2926 if (arg_info
&& count
== 0)
2928 ZVAL_BOOL (rhs
, arg_info
->pass_by_reference
);
2932 ZVAL_BOOL (rhs
, signature
->common
.pass_rest_by_reference
);
2934 write_var (p_lhs
, rhs
);
2935 zval_ptr_dtor (&rhs
);
2936 phc_check_invariants (TSRMLS_C
);
2938 // if (TLE100) goto L128 else goto L129;
2941 if (local_TLE100
== NULL
)
2942 p_cond
= EG (uninitialized_zval_ptr
);
2944 p_cond
= local_TLE100
;
2946 zend_bool bcond
= zend_is_true (p_cond
);
2951 phc_check_invariants (TSRMLS_C
);
2955 // $TMIt99 =& $this->mCategories;
2957 if (local_this
== NULL
)
2959 local_this
= EG (uninitialized_zval_ptr
);
2960 local_this
->refcount
++;
2962 zval
** p_obj
= &local_this
;
2965 INIT_ZVAL (field_name
);
2966 ZVAL_STRING (&field_name
, "mCategories", 0);
2968 zval
** field
= Z_OBJ_HT_PP(p_obj
)->get_property_ptr_ptr(*p_obj
, &field_name TSRMLS_CC
);
2969 sep_copy_on_write (field
);
2970 if (local_TMIt99
== NULL
)
2972 local_TMIt99
= EG (uninitialized_zval_ptr
);
2973 local_TMIt99
->refcount
++;
2975 zval
** p_lhs
= &local_TMIt99
;
2977 copy_into_ref (p_lhs
, field
);
2978 phc_check_invariants (TSRMLS_C
);
2983 phc_check_invariants (TSRMLS_C
);
2987 // $TMIt99 = $this->mCategories;
2989 if (local_this
== NULL
)
2991 local_this
= EG (uninitialized_zval_ptr
);
2992 local_this
->refcount
++;
2994 zval
** p_obj
= &local_this
;
2997 INIT_ZVAL (field_name
);
2998 ZVAL_STRING (&field_name
, "mCategories", 0);
3000 // I *think* this is correct, but documentation of the Zend API is scarce :)
3001 zval
* field
= Z_OBJ_HT_PP(p_obj
)->read_property(*p_obj
, &field_name
, BP_VAR_R TSRMLS_CC
);
3002 if (local_TMIt99
== NULL
)
3004 local_TMIt99
= EG (uninitialized_zval_ptr
);
3005 local_TMIt99
->refcount
++;
3007 zval
** p_lhs
= &local_TMIt99
;
3009 write_var (p_lhs
, field
);
3010 phc_check_invariants (TSRMLS_C
);
3015 phc_check_invariants (TSRMLS_C
);
3019 // $TLE11 = array_keys($TMIt99);
3021 initialize_function_call (&array_keys_fci
, &array_keys_fcic
, "array_keys", "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 46 TSRMLS_CC
);
3022 zend_function
* signature
= array_keys_fcic
.function_handler
;
3023 zend_arg_info
* arg_info
= signature
->common
.arg_info
; // optional
3027 // TODO: find names to replace index
3030 by_ref
[abr_index
] = arg_info
->pass_by_reference
;
3034 by_ref
[abr_index
] = signature
->common
.pass_rest_by_reference
;
3039 // Setup array of arguments
3040 // TODO: i think arrays of size 0 is an error
3043 zval
** args_ind
[1];
3046 destruct
[af_index
] = 0;
3047 if (by_ref
[af_index
])
3049 if (local_TMIt99
== NULL
)
3051 local_TMIt99
= EG (uninitialized_zval_ptr
);
3052 local_TMIt99
->refcount
++;
3054 zval
** p_arg
= &local_TMIt99
;
3056 args_ind
[af_index
] = fetch_var_arg_by_ref (p_arg
);
3057 assert (!in_copy_on_write (*args_ind
[af_index
]));
3058 args
[af_index
] = *args_ind
[af_index
];
3063 if (local_TMIt99
== NULL
)
3064 arg
= EG (uninitialized_zval_ptr
);
3068 args
[af_index
] = fetch_var_arg (arg
, &destruct
[af_index
]);
3069 args_ind
[af_index
] = &args
[af_index
];
3074 phc_setup_error (1, "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 46, NULL TSRMLS_CC
);
3076 // save existing parameters, in case of recursion
3077 int param_count_save
= array_keys_fci
.param_count
;
3078 zval
*** params_save
= array_keys_fci
.params
;
3079 zval
** retval_save
= array_keys_fci
.retval_ptr_ptr
;
3084 array_keys_fci
.params
= args_ind
;
3085 array_keys_fci
.param_count
= 1;
3086 array_keys_fci
.retval_ptr_ptr
= &rhs
;
3088 // call the function
3089 int success
= zend_call_function (&array_keys_fci
, &array_keys_fcic TSRMLS_CC
);
3090 assert(success
== SUCCESS
);
3093 array_keys_fci
.params
= params_save
;
3094 array_keys_fci
.param_count
= param_count_save
;
3095 array_keys_fci
.retval_ptr_ptr
= retval_save
;
3098 phc_setup_error (0, NULL
, 0, NULL TSRMLS_CC
);
3101 for (i
= 0; i
< 1; i
++)
3105 assert (destruct
[i
]);
3106 zval_ptr_dtor (args_ind
[i
]);
3111 // When the Zend engine returns by reference, it allocates a zval into
3112 // retval_ptr_ptr. To return by reference, the callee writes into the
3113 // retval_ptr_ptr, freeing the allocated value as it does. (Note, it may
3114 // not actually return anything). So the zval returned - whether we return
3115 // it, or it is the allocated zval - has a refcount of 1.
3117 // The caller is responsible for cleaning that up (note, this is unaffected
3118 // by whether it is added to some COW set).
3120 // For reasons unknown, the Zend API resets the refcount and is_ref fields
3121 // of the return value after the function returns (unless the callee is
3122 // interpreted). If the function is supposed to return by reference, this
3123 // loses the refcount. This only happens when non-interpreted code is
3124 // called. We work around it, when compiled code is called, by saving the
3125 // refcount into SAVED_REFCOUNT, in the return statement. The downside is
3126 // that we may create an error if our code is called by a callback, and
3127 // returns by reference, and the callback returns by reference. At least
3128 // this is an obscure case.
3129 if(signature
->common
.return_reference
&& signature
->type
!= ZEND_USER_FUNCTION
)
3131 assert (rhs
!= EG(uninitialized_zval_ptr
));
3133 if (saved_refcount
!= 0)
3135 rhs
->refcount
= saved_refcount
;
3139 saved_refcount
= 0; // for 'obscure cases'
3141 if (local_TLE11
== NULL
)
3143 local_TLE11
= EG (uninitialized_zval_ptr
);
3144 local_TLE11
->refcount
++;
3146 zval
** p_lhs
= &local_TLE11
;
3148 write_var (p_lhs
, rhs
);
3151 zval_ptr_dtor (&rhs
);
3152 if(signature
->common
.return_reference
&& signature
->type
!= ZEND_USER_FUNCTION
)
3153 zval_ptr_dtor (&rhs
);
3155 phc_check_invariants (TSRMLS_C
);
3160 if (local_TLE11
== NULL
)
3161 rhs
= EG (uninitialized_zval_ptr
);
3165 // Run-time return by reference has different semantics to compile-time.
3166 // If the function has CTRBR and RTRBR, the the assignment will be
3167 // reference. If one or the other is return-by-copy, the result will be
3168 // by copy. Its a question of whether its separated at return-time (which
3169 // we do here) or at the call-site.
3170 return_value
->value
= rhs
->value
;
3171 return_value
->type
= rhs
->type
;
3172 zval_copy_ctor (return_value
);
3173 goto end_of_function
;
3174 phc_check_invariants (TSRMLS_C
);
3177 end_of_function
:__attribute__((unused
));
3178 if (local_TLE100
!= NULL
)
3180 zval_ptr_dtor (&local_TLE100
);
3182 if (local_TLE11
!= NULL
)
3184 zval_ptr_dtor (&local_TLE11
);
3186 if (local_TMIt99
!= NULL
)
3188 zval_ptr_dtor (&local_TMIt99
);
3191 // function &getcategories()
3193 // $TSt12 =& $this->mCategories;
3196 PHP_METHOD(ParserOutput
, getcategories
)
3198 zval
* local_TSt12
= NULL
;
3199 zval
* local_this
= getThis();
3201 // $TSt12 =& $this->mCategories;
3203 if (local_this
== NULL
)
3205 local_this
= EG (uninitialized_zval_ptr
);
3206 local_this
->refcount
++;
3208 zval
** p_obj
= &local_this
;
3211 INIT_ZVAL (field_name
);
3212 ZVAL_STRING (&field_name
, "mCategories", 0);
3214 zval
** field
= Z_OBJ_HT_PP(p_obj
)->get_property_ptr_ptr(*p_obj
, &field_name TSRMLS_CC
);
3215 sep_copy_on_write (field
);
3216 if (local_TSt12
== NULL
)
3218 local_TSt12
= EG (uninitialized_zval_ptr
);
3219 local_TSt12
->refcount
++;
3221 zval
** p_lhs
= &local_TSt12
;
3223 copy_into_ref (p_lhs
, field
);
3224 phc_check_invariants (TSRMLS_C
);
3228 if (local_TSt12
== NULL
)
3230 local_TSt12
= EG (uninitialized_zval_ptr
);
3231 local_TSt12
->refcount
++;
3233 zval
** p_rhs
= &local_TSt12
;
3235 sep_copy_on_write (p_rhs
);
3236 zval_ptr_dtor (return_value_ptr
);
3237 (*p_rhs
)->is_ref
= 1;
3238 (*p_rhs
)->refcount
++;
3239 *return_value_ptr
= *p_rhs
;
3240 goto end_of_function
;
3241 phc_check_invariants (TSRMLS_C
);
3244 end_of_function
:__attribute__((unused
));
3245 if (local_TSt12
!= NULL
)
3247 zval_ptr_dtor (&local_TSt12
);
3249 if (*return_value_ptr
)
3250 saved_refcount
= (*return_value_ptr
)->refcount
;
3252 // function getcachetime()
3254 // $TSt13 = $this->mCacheTime;
3257 PHP_METHOD(ParserOutput
, getcachetime
)
3259 zval
* local_TSt13
= NULL
;
3260 zval
* local_this
= getThis();
3262 // $TSt13 = $this->mCacheTime;
3264 if (local_this
== NULL
)
3266 local_this
= EG (uninitialized_zval_ptr
);
3267 local_this
->refcount
++;
3269 zval
** p_obj
= &local_this
;
3272 INIT_ZVAL (field_name
);
3273 ZVAL_STRING (&field_name
, "mCacheTime", 0);
3275 // I *think* this is correct, but documentation of the Zend API is scarce :)
3276 zval
* field
= Z_OBJ_HT_PP(p_obj
)->read_property(*p_obj
, &field_name
, BP_VAR_R TSRMLS_CC
);
3277 if (local_TSt13
== NULL
)
3279 local_TSt13
= EG (uninitialized_zval_ptr
);
3280 local_TSt13
->refcount
++;
3282 zval
** p_lhs
= &local_TSt13
;
3284 write_var (p_lhs
, field
);
3285 phc_check_invariants (TSRMLS_C
);
3290 if (local_TSt13
== NULL
)
3291 rhs
= EG (uninitialized_zval_ptr
);
3295 // Run-time return by reference has different semantics to compile-time.
3296 // If the function has CTRBR and RTRBR, the the assignment will be
3297 // reference. If one or the other is return-by-copy, the result will be
3298 // by copy. Its a question of whether its separated at return-time (which
3299 // we do here) or at the call-site.
3300 return_value
->value
= rhs
->value
;
3301 return_value
->type
= rhs
->type
;
3302 zval_copy_ctor (return_value
);
3303 goto end_of_function
;
3304 phc_check_invariants (TSRMLS_C
);
3307 end_of_function
:__attribute__((unused
));
3308 if (local_TSt13
!= NULL
)
3310 zval_ptr_dtor (&local_TSt13
);
3313 // function gettitletext()
3315 // $TSt14 = $this->mTitleText;
3318 PHP_METHOD(ParserOutput
, gettitletext
)
3320 zval
* local_TSt14
= NULL
;
3321 zval
* local_this
= getThis();
3323 // $TSt14 = $this->mTitleText;
3325 if (local_this
== NULL
)
3327 local_this
= EG (uninitialized_zval_ptr
);
3328 local_this
->refcount
++;
3330 zval
** p_obj
= &local_this
;
3333 INIT_ZVAL (field_name
);
3334 ZVAL_STRING (&field_name
, "mTitleText", 0);
3336 // I *think* this is correct, but documentation of the Zend API is scarce :)
3337 zval
* field
= Z_OBJ_HT_PP(p_obj
)->read_property(*p_obj
, &field_name
, BP_VAR_R TSRMLS_CC
);
3338 if (local_TSt14
== NULL
)
3340 local_TSt14
= EG (uninitialized_zval_ptr
);
3341 local_TSt14
->refcount
++;
3343 zval
** p_lhs
= &local_TSt14
;
3345 write_var (p_lhs
, field
);
3346 phc_check_invariants (TSRMLS_C
);
3351 if (local_TSt14
== NULL
)
3352 rhs
= EG (uninitialized_zval_ptr
);
3356 // Run-time return by reference has different semantics to compile-time.
3357 // If the function has CTRBR and RTRBR, the the assignment will be
3358 // reference. If one or the other is return-by-copy, the result will be
3359 // by copy. Its a question of whether its separated at return-time (which
3360 // we do here) or at the call-site.
3361 return_value
->value
= rhs
->value
;
3362 return_value
->type
= rhs
->type
;
3363 zval_copy_ctor (return_value
);
3364 goto end_of_function
;
3365 phc_check_invariants (TSRMLS_C
);
3368 end_of_function
:__attribute__((unused
));
3369 if (local_TSt14
!= NULL
)
3371 zval_ptr_dtor (&local_TSt14
);
3374 // function getsections()
3376 // $TSt15 = $this->mSections;
3379 PHP_METHOD(ParserOutput
, getsections
)
3381 zval
* local_TSt15
= NULL
;
3382 zval
* local_this
= getThis();
3384 // $TSt15 = $this->mSections;
3386 if (local_this
== NULL
)
3388 local_this
= EG (uninitialized_zval_ptr
);
3389 local_this
->refcount
++;
3391 zval
** p_obj
= &local_this
;
3394 INIT_ZVAL (field_name
);
3395 ZVAL_STRING (&field_name
, "mSections", 0);
3397 // I *think* this is correct, but documentation of the Zend API is scarce :)
3398 zval
* field
= Z_OBJ_HT_PP(p_obj
)->read_property(*p_obj
, &field_name
, BP_VAR_R TSRMLS_CC
);
3399 if (local_TSt15
== NULL
)
3401 local_TSt15
= EG (uninitialized_zval_ptr
);
3402 local_TSt15
->refcount
++;
3404 zval
** p_lhs
= &local_TSt15
;
3406 write_var (p_lhs
, field
);
3407 phc_check_invariants (TSRMLS_C
);
3412 if (local_TSt15
== NULL
)
3413 rhs
= EG (uninitialized_zval_ptr
);
3417 // Run-time return by reference has different semantics to compile-time.
3418 // If the function has CTRBR and RTRBR, the the assignment will be
3419 // reference. If one or the other is return-by-copy, the result will be
3420 // by copy. Its a question of whether its separated at return-time (which
3421 // we do here) or at the call-site.
3422 return_value
->value
= rhs
->value
;
3423 return_value
->type
= rhs
->type
;
3424 zval_copy_ctor (return_value
);
3425 goto end_of_function
;
3426 phc_check_invariants (TSRMLS_C
);
3429 end_of_function
:__attribute__((unused
));
3430 if (local_TSt15
!= NULL
)
3432 zval_ptr_dtor (&local_TSt15
);
3435 // function &getlinks()
3437 // $TSt16 =& $this->mLinks;
3440 PHP_METHOD(ParserOutput
, getlinks
)
3442 zval
* local_TSt16
= NULL
;
3443 zval
* local_this
= getThis();
3445 // $TSt16 =& $this->mLinks;
3447 if (local_this
== NULL
)
3449 local_this
= EG (uninitialized_zval_ptr
);
3450 local_this
->refcount
++;
3452 zval
** p_obj
= &local_this
;
3455 INIT_ZVAL (field_name
);
3456 ZVAL_STRING (&field_name
, "mLinks", 0);
3458 zval
** field
= Z_OBJ_HT_PP(p_obj
)->get_property_ptr_ptr(*p_obj
, &field_name TSRMLS_CC
);
3459 sep_copy_on_write (field
);
3460 if (local_TSt16
== NULL
)
3462 local_TSt16
= EG (uninitialized_zval_ptr
);
3463 local_TSt16
->refcount
++;
3465 zval
** p_lhs
= &local_TSt16
;
3467 copy_into_ref (p_lhs
, field
);
3468 phc_check_invariants (TSRMLS_C
);
3472 if (local_TSt16
== NULL
)
3474 local_TSt16
= EG (uninitialized_zval_ptr
);
3475 local_TSt16
->refcount
++;
3477 zval
** p_rhs
= &local_TSt16
;
3479 sep_copy_on_write (p_rhs
);
3480 zval_ptr_dtor (return_value_ptr
);
3481 (*p_rhs
)->is_ref
= 1;
3482 (*p_rhs
)->refcount
++;
3483 *return_value_ptr
= *p_rhs
;
3484 goto end_of_function
;
3485 phc_check_invariants (TSRMLS_C
);
3488 end_of_function
:__attribute__((unused
));
3489 if (local_TSt16
!= NULL
)
3491 zval_ptr_dtor (&local_TSt16
);
3493 if (*return_value_ptr
)
3494 saved_refcount
= (*return_value_ptr
)->refcount
;
3496 // function &gettemplates()
3498 // $TSt17 =& $this->mTemplates;
3501 PHP_METHOD(ParserOutput
, gettemplates
)
3503 zval
* local_TSt17
= NULL
;
3504 zval
* local_this
= getThis();
3506 // $TSt17 =& $this->mTemplates;
3508 if (local_this
== NULL
)
3510 local_this
= EG (uninitialized_zval_ptr
);
3511 local_this
->refcount
++;
3513 zval
** p_obj
= &local_this
;
3516 INIT_ZVAL (field_name
);
3517 ZVAL_STRING (&field_name
, "mTemplates", 0);
3519 zval
** field
= Z_OBJ_HT_PP(p_obj
)->get_property_ptr_ptr(*p_obj
, &field_name TSRMLS_CC
);
3520 sep_copy_on_write (field
);
3521 if (local_TSt17
== NULL
)
3523 local_TSt17
= EG (uninitialized_zval_ptr
);
3524 local_TSt17
->refcount
++;
3526 zval
** p_lhs
= &local_TSt17
;
3528 copy_into_ref (p_lhs
, field
);
3529 phc_check_invariants (TSRMLS_C
);
3533 if (local_TSt17
== NULL
)
3535 local_TSt17
= EG (uninitialized_zval_ptr
);
3536 local_TSt17
->refcount
++;
3538 zval
** p_rhs
= &local_TSt17
;
3540 sep_copy_on_write (p_rhs
);
3541 zval_ptr_dtor (return_value_ptr
);
3542 (*p_rhs
)->is_ref
= 1;
3543 (*p_rhs
)->refcount
++;
3544 *return_value_ptr
= *p_rhs
;
3545 goto end_of_function
;
3546 phc_check_invariants (TSRMLS_C
);
3549 end_of_function
:__attribute__((unused
));
3550 if (local_TSt17
!= NULL
)
3552 zval_ptr_dtor (&local_TSt17
);
3554 if (*return_value_ptr
)
3555 saved_refcount
= (*return_value_ptr
)->refcount
;
3557 // function &getimages()
3559 // $TSt18 =& $this->mImages;
3562 PHP_METHOD(ParserOutput
, getimages
)
3564 zval
* local_TSt18
= NULL
;
3565 zval
* local_this
= getThis();
3567 // $TSt18 =& $this->mImages;
3569 if (local_this
== NULL
)
3571 local_this
= EG (uninitialized_zval_ptr
);
3572 local_this
->refcount
++;
3574 zval
** p_obj
= &local_this
;
3577 INIT_ZVAL (field_name
);
3578 ZVAL_STRING (&field_name
, "mImages", 0);
3580 zval
** field
= Z_OBJ_HT_PP(p_obj
)->get_property_ptr_ptr(*p_obj
, &field_name TSRMLS_CC
);
3581 sep_copy_on_write (field
);
3582 if (local_TSt18
== NULL
)
3584 local_TSt18
= EG (uninitialized_zval_ptr
);
3585 local_TSt18
->refcount
++;
3587 zval
** p_lhs
= &local_TSt18
;
3589 copy_into_ref (p_lhs
, field
);
3590 phc_check_invariants (TSRMLS_C
);
3594 if (local_TSt18
== NULL
)
3596 local_TSt18
= EG (uninitialized_zval_ptr
);
3597 local_TSt18
->refcount
++;
3599 zval
** p_rhs
= &local_TSt18
;
3601 sep_copy_on_write (p_rhs
);
3602 zval_ptr_dtor (return_value_ptr
);
3603 (*p_rhs
)->is_ref
= 1;
3604 (*p_rhs
)->refcount
++;
3605 *return_value_ptr
= *p_rhs
;
3606 goto end_of_function
;
3607 phc_check_invariants (TSRMLS_C
);
3610 end_of_function
:__attribute__((unused
));
3611 if (local_TSt18
!= NULL
)
3613 zval_ptr_dtor (&local_TSt18
);
3615 if (*return_value_ptr
)
3616 saved_refcount
= (*return_value_ptr
)->refcount
;
3618 // function &getexternallinks()
3620 // $TSt19 =& $this->mExternalLinks;
3623 PHP_METHOD(ParserOutput
, getexternallinks
)
3625 zval
* local_TSt19
= NULL
;
3626 zval
* local_this
= getThis();
3628 // $TSt19 =& $this->mExternalLinks;
3630 if (local_this
== NULL
)
3632 local_this
= EG (uninitialized_zval_ptr
);
3633 local_this
->refcount
++;
3635 zval
** p_obj
= &local_this
;
3638 INIT_ZVAL (field_name
);
3639 ZVAL_STRING (&field_name
, "mExternalLinks", 0);
3641 zval
** field
= Z_OBJ_HT_PP(p_obj
)->get_property_ptr_ptr(*p_obj
, &field_name TSRMLS_CC
);
3642 sep_copy_on_write (field
);
3643 if (local_TSt19
== NULL
)
3645 local_TSt19
= EG (uninitialized_zval_ptr
);
3646 local_TSt19
->refcount
++;
3648 zval
** p_lhs
= &local_TSt19
;
3650 copy_into_ref (p_lhs
, field
);
3651 phc_check_invariants (TSRMLS_C
);
3655 if (local_TSt19
== NULL
)
3657 local_TSt19
= EG (uninitialized_zval_ptr
);
3658 local_TSt19
->refcount
++;
3660 zval
** p_rhs
= &local_TSt19
;
3662 sep_copy_on_write (p_rhs
);
3663 zval_ptr_dtor (return_value_ptr
);
3664 (*p_rhs
)->is_ref
= 1;
3665 (*p_rhs
)->refcount
++;
3666 *return_value_ptr
= *p_rhs
;
3667 goto end_of_function
;
3668 phc_check_invariants (TSRMLS_C
);
3671 end_of_function
:__attribute__((unused
));
3672 if (local_TSt19
!= NULL
)
3674 zval_ptr_dtor (&local_TSt19
);
3676 if (*return_value_ptr
)
3677 saved_refcount
= (*return_value_ptr
)->refcount
;
3679 // function getnogallery()
3681 // $TSt20 = $this->mNoGallery;
3684 PHP_METHOD(ParserOutput
, getnogallery
)
3686 zval
* local_TSt20
= NULL
;
3687 zval
* local_this
= getThis();
3689 // $TSt20 = $this->mNoGallery;
3691 if (local_this
== NULL
)
3693 local_this
= EG (uninitialized_zval_ptr
);
3694 local_this
->refcount
++;
3696 zval
** p_obj
= &local_this
;
3699 INIT_ZVAL (field_name
);
3700 ZVAL_STRING (&field_name
, "mNoGallery", 0);
3702 // I *think* this is correct, but documentation of the Zend API is scarce :)
3703 zval
* field
= Z_OBJ_HT_PP(p_obj
)->read_property(*p_obj
, &field_name
, BP_VAR_R TSRMLS_CC
);
3704 if (local_TSt20
== NULL
)
3706 local_TSt20
= EG (uninitialized_zval_ptr
);
3707 local_TSt20
->refcount
++;
3709 zval
** p_lhs
= &local_TSt20
;
3711 write_var (p_lhs
, field
);
3712 phc_check_invariants (TSRMLS_C
);
3717 if (local_TSt20
== NULL
)
3718 rhs
= EG (uninitialized_zval_ptr
);
3722 // Run-time return by reference has different semantics to compile-time.
3723 // If the function has CTRBR and RTRBR, the the assignment will be
3724 // reference. If one or the other is return-by-copy, the result will be
3725 // by copy. Its a question of whether its separated at return-time (which
3726 // we do here) or at the call-site.
3727 return_value
->value
= rhs
->value
;
3728 return_value
->type
= rhs
->type
;
3729 zval_copy_ctor (return_value
);
3730 goto end_of_function
;
3731 phc_check_invariants (TSRMLS_C
);
3734 end_of_function
:__attribute__((unused
));
3735 if (local_TSt20
!= NULL
)
3737 zval_ptr_dtor (&local_TSt20
);
3740 // function getsubtitle()
3742 // $TSt21 = $this->mSubtitle;
3745 PHP_METHOD(ParserOutput
, getsubtitle
)
3747 zval
* local_TSt21
= NULL
;
3748 zval
* local_this
= getThis();
3750 // $TSt21 = $this->mSubtitle;
3752 if (local_this
== NULL
)
3754 local_this
= EG (uninitialized_zval_ptr
);
3755 local_this
->refcount
++;
3757 zval
** p_obj
= &local_this
;
3760 INIT_ZVAL (field_name
);
3761 ZVAL_STRING (&field_name
, "mSubtitle", 0);
3763 // I *think* this is correct, but documentation of the Zend API is scarce :)
3764 zval
* field
= Z_OBJ_HT_PP(p_obj
)->read_property(*p_obj
, &field_name
, BP_VAR_R TSRMLS_CC
);
3765 if (local_TSt21
== NULL
)
3767 local_TSt21
= EG (uninitialized_zval_ptr
);
3768 local_TSt21
->refcount
++;
3770 zval
** p_lhs
= &local_TSt21
;
3772 write_var (p_lhs
, field
);
3773 phc_check_invariants (TSRMLS_C
);
3778 if (local_TSt21
== NULL
)
3779 rhs
= EG (uninitialized_zval_ptr
);
3783 // Run-time return by reference has different semantics to compile-time.
3784 // If the function has CTRBR and RTRBR, the the assignment will be
3785 // reference. If one or the other is return-by-copy, the result will be
3786 // by copy. Its a question of whether its separated at return-time (which
3787 // we do here) or at the call-site.
3788 return_value
->value
= rhs
->value
;
3789 return_value
->type
= rhs
->type
;
3790 zval_copy_ctor (return_value
);
3791 goto end_of_function
;
3792 phc_check_invariants (TSRMLS_C
);
3795 end_of_function
:__attribute__((unused
));
3796 if (local_TSt21
!= NULL
)
3798 zval_ptr_dtor (&local_TSt21
);
3801 // function getoutputhooks()
3803 // $TSt22 = $this->mOutputHooks;
3804 // $TLE23 = (array) $TSt22;
3807 PHP_METHOD(ParserOutput
, getoutputhooks
)
3809 zval
* local_TLE23
= NULL
;
3810 zval
* local_TSt22
= NULL
;
3811 zval
* local_this
= getThis();
3813 // $TSt22 = $this->mOutputHooks;
3815 if (local_this
== NULL
)
3817 local_this
= EG (uninitialized_zval_ptr
);
3818 local_this
->refcount
++;
3820 zval
** p_obj
= &local_this
;
3823 INIT_ZVAL (field_name
);
3824 ZVAL_STRING (&field_name
, "mOutputHooks", 0);
3826 // I *think* this is correct, but documentation of the Zend API is scarce :)
3827 zval
* field
= Z_OBJ_HT_PP(p_obj
)->read_property(*p_obj
, &field_name
, BP_VAR_R TSRMLS_CC
);
3828 if (local_TSt22
== NULL
)
3830 local_TSt22
= EG (uninitialized_zval_ptr
);
3831 local_TSt22
->refcount
++;
3833 zval
** p_lhs
= &local_TSt22
;
3835 write_var (p_lhs
, field
);
3836 phc_check_invariants (TSRMLS_C
);
3838 // $TLE23 = (array) $TSt22;
3840 if (local_TLE23
== NULL
)
3842 local_TLE23
= EG (uninitialized_zval_ptr
);
3843 local_TLE23
->refcount
++;
3845 zval
** p_lhs
= &local_TLE23
;
3848 if (local_TSt22
== NULL
)
3849 rhs
= EG (uninitialized_zval_ptr
);
3855 if ((*p_lhs
)->is_ref
)
3856 overwrite_lhs (*p_lhs
, rhs
);
3859 zval_ptr_dtor (p_lhs
);
3862 // Take a copy of RHS for LHS
3863 *p_lhs
= zvp_clone_ex (rhs
);
3876 assert (IS_ARRAY
>= 0 && IS_ARRAY
<= 6);
3877 if ((*p_lhs
)->type
!= IS_ARRAY
)
3879 sep_copy_on_write (p_lhs
);
3880 convert_to_array (*p_lhs
);
3883 phc_check_invariants (TSRMLS_C
);
3888 if (local_TLE23
== NULL
)
3889 rhs
= EG (uninitialized_zval_ptr
);
3893 // Run-time return by reference has different semantics to compile-time.
3894 // If the function has CTRBR and RTRBR, the the assignment will be
3895 // reference. If one or the other is return-by-copy, the result will be
3896 // by copy. Its a question of whether its separated at return-time (which
3897 // we do here) or at the call-site.
3898 return_value
->value
= rhs
->value
;
3899 return_value
->type
= rhs
->type
;
3900 zval_copy_ctor (return_value
);
3901 goto end_of_function
;
3902 phc_check_invariants (TSRMLS_C
);
3905 end_of_function
:__attribute__((unused
));
3906 if (local_TLE23
!= NULL
)
3908 zval_ptr_dtor (&local_TLE23
);
3910 if (local_TSt22
!= NULL
)
3912 zval_ptr_dtor (&local_TSt22
);
3915 // function getwarnings()
3917 // $TLE102 = param_is_ref (NULL, "array_keys", 0);
3919 // if (TLE102) goto L131 else goto L132;
3921 // $TMIt101 =& $this->mWarnings;
3924 // $TMIt101 = $this->mWarnings;
3927 // $TLE24 = array_keys($TMIt101);
3930 PHP_METHOD(ParserOutput
, getwarnings
)
3932 zval
* local_TLE102
= NULL
;
3933 zval
* local_TLE24
= NULL
;
3934 zval
* local_TMIt101
= NULL
;
3935 zval
* local_this
= getThis();
3937 // $TLE102 = param_is_ref (NULL, "array_keys", 0);
3940 initialize_function_call (&array_keys_fci
, &array_keys_fcic
, "array_keys", "<unknown>", 0 TSRMLS_CC
);
3941 zend_function
* signature
= array_keys_fcic
.function_handler
;
3942 zend_arg_info
* arg_info
= signature
->common
.arg_info
;
3944 while (arg_info
&& count
< 0)
3950 if (local_TLE102
== NULL
)
3952 local_TLE102
= EG (uninitialized_zval_ptr
);
3953 local_TLE102
->refcount
++;
3955 zval
** p_lhs
= &local_TLE102
;
3958 ALLOC_INIT_ZVAL (rhs
);
3959 if (arg_info
&& count
== 0)
3961 ZVAL_BOOL (rhs
, arg_info
->pass_by_reference
);
3965 ZVAL_BOOL (rhs
, signature
->common
.pass_rest_by_reference
);
3967 write_var (p_lhs
, rhs
);
3968 zval_ptr_dtor (&rhs
);
3969 phc_check_invariants (TSRMLS_C
);
3971 // if (TLE102) goto L131 else goto L132;
3974 if (local_TLE102
== NULL
)
3975 p_cond
= EG (uninitialized_zval_ptr
);
3977 p_cond
= local_TLE102
;
3979 zend_bool bcond
= zend_is_true (p_cond
);
3984 phc_check_invariants (TSRMLS_C
);
3988 // $TMIt101 =& $this->mWarnings;
3990 if (local_this
== NULL
)
3992 local_this
= EG (uninitialized_zval_ptr
);
3993 local_this
->refcount
++;
3995 zval
** p_obj
= &local_this
;
3998 INIT_ZVAL (field_name
);
3999 ZVAL_STRING (&field_name
, "mWarnings", 0);
4001 zval
** field
= Z_OBJ_HT_PP(p_obj
)->get_property_ptr_ptr(*p_obj
, &field_name TSRMLS_CC
);
4002 sep_copy_on_write (field
);
4003 if (local_TMIt101
== NULL
)
4005 local_TMIt101
= EG (uninitialized_zval_ptr
);
4006 local_TMIt101
->refcount
++;
4008 zval
** p_lhs
= &local_TMIt101
;
4010 copy_into_ref (p_lhs
, field
);
4011 phc_check_invariants (TSRMLS_C
);
4016 phc_check_invariants (TSRMLS_C
);
4020 // $TMIt101 = $this->mWarnings;
4022 if (local_this
== NULL
)
4024 local_this
= EG (uninitialized_zval_ptr
);
4025 local_this
->refcount
++;
4027 zval
** p_obj
= &local_this
;
4030 INIT_ZVAL (field_name
);
4031 ZVAL_STRING (&field_name
, "mWarnings", 0);
4033 // I *think* this is correct, but documentation of the Zend API is scarce :)
4034 zval
* field
= Z_OBJ_HT_PP(p_obj
)->read_property(*p_obj
, &field_name
, BP_VAR_R TSRMLS_CC
);
4035 if (local_TMIt101
== NULL
)
4037 local_TMIt101
= EG (uninitialized_zval_ptr
);
4038 local_TMIt101
->refcount
++;
4040 zval
** p_lhs
= &local_TMIt101
;
4042 write_var (p_lhs
, field
);
4043 phc_check_invariants (TSRMLS_C
);
4048 phc_check_invariants (TSRMLS_C
);
4052 // $TLE24 = array_keys($TMIt101);
4054 initialize_function_call (&array_keys_fci
, &array_keys_fcic
, "array_keys", "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 58 TSRMLS_CC
);
4055 zend_function
* signature
= array_keys_fcic
.function_handler
;
4056 zend_arg_info
* arg_info
= signature
->common
.arg_info
; // optional
4060 // TODO: find names to replace index
4063 by_ref
[abr_index
] = arg_info
->pass_by_reference
;
4067 by_ref
[abr_index
] = signature
->common
.pass_rest_by_reference
;
4072 // Setup array of arguments
4073 // TODO: i think arrays of size 0 is an error
4076 zval
** args_ind
[1];
4079 destruct
[af_index
] = 0;
4080 if (by_ref
[af_index
])
4082 if (local_TMIt101
== NULL
)
4084 local_TMIt101
= EG (uninitialized_zval_ptr
);
4085 local_TMIt101
->refcount
++;
4087 zval
** p_arg
= &local_TMIt101
;
4089 args_ind
[af_index
] = fetch_var_arg_by_ref (p_arg
);
4090 assert (!in_copy_on_write (*args_ind
[af_index
]));
4091 args
[af_index
] = *args_ind
[af_index
];
4096 if (local_TMIt101
== NULL
)
4097 arg
= EG (uninitialized_zval_ptr
);
4099 arg
= local_TMIt101
;
4101 args
[af_index
] = fetch_var_arg (arg
, &destruct
[af_index
]);
4102 args_ind
[af_index
] = &args
[af_index
];
4107 phc_setup_error (1, "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 58, NULL TSRMLS_CC
);
4109 // save existing parameters, in case of recursion
4110 int param_count_save
= array_keys_fci
.param_count
;
4111 zval
*** params_save
= array_keys_fci
.params
;
4112 zval
** retval_save
= array_keys_fci
.retval_ptr_ptr
;
4117 array_keys_fci
.params
= args_ind
;
4118 array_keys_fci
.param_count
= 1;
4119 array_keys_fci
.retval_ptr_ptr
= &rhs
;
4121 // call the function
4122 int success
= zend_call_function (&array_keys_fci
, &array_keys_fcic TSRMLS_CC
);
4123 assert(success
== SUCCESS
);
4126 array_keys_fci
.params
= params_save
;
4127 array_keys_fci
.param_count
= param_count_save
;
4128 array_keys_fci
.retval_ptr_ptr
= retval_save
;
4131 phc_setup_error (0, NULL
, 0, NULL TSRMLS_CC
);
4134 for (i
= 0; i
< 1; i
++)
4138 assert (destruct
[i
]);
4139 zval_ptr_dtor (args_ind
[i
]);
4144 // When the Zend engine returns by reference, it allocates a zval into
4145 // retval_ptr_ptr. To return by reference, the callee writes into the
4146 // retval_ptr_ptr, freeing the allocated value as it does. (Note, it may
4147 // not actually return anything). So the zval returned - whether we return
4148 // it, or it is the allocated zval - has a refcount of 1.
4150 // The caller is responsible for cleaning that up (note, this is unaffected
4151 // by whether it is added to some COW set).
4153 // For reasons unknown, the Zend API resets the refcount and is_ref fields
4154 // of the return value after the function returns (unless the callee is
4155 // interpreted). If the function is supposed to return by reference, this
4156 // loses the refcount. This only happens when non-interpreted code is
4157 // called. We work around it, when compiled code is called, by saving the
4158 // refcount into SAVED_REFCOUNT, in the return statement. The downside is
4159 // that we may create an error if our code is called by a callback, and
4160 // returns by reference, and the callback returns by reference. At least
4161 // this is an obscure case.
4162 if(signature
->common
.return_reference
&& signature
->type
!= ZEND_USER_FUNCTION
)
4164 assert (rhs
!= EG(uninitialized_zval_ptr
));
4166 if (saved_refcount
!= 0)
4168 rhs
->refcount
= saved_refcount
;
4172 saved_refcount
= 0; // for 'obscure cases'
4174 if (local_TLE24
== NULL
)
4176 local_TLE24
= EG (uninitialized_zval_ptr
);
4177 local_TLE24
->refcount
++;
4179 zval
** p_lhs
= &local_TLE24
;
4181 write_var (p_lhs
, rhs
);
4184 zval_ptr_dtor (&rhs
);
4185 if(signature
->common
.return_reference
&& signature
->type
!= ZEND_USER_FUNCTION
)
4186 zval_ptr_dtor (&rhs
);
4188 phc_check_invariants (TSRMLS_C
);
4193 if (local_TLE24
== NULL
)
4194 rhs
= EG (uninitialized_zval_ptr
);
4198 // Run-time return by reference has different semantics to compile-time.
4199 // If the function has CTRBR and RTRBR, the the assignment will be
4200 // reference. If one or the other is return-by-copy, the result will be
4201 // by copy. Its a question of whether its separated at return-time (which
4202 // we do here) or at the call-site.
4203 return_value
->value
= rhs
->value
;
4204 return_value
->type
= rhs
->type
;
4205 zval_copy_ctor (return_value
);
4206 goto end_of_function
;
4207 phc_check_invariants (TSRMLS_C
);
4210 end_of_function
:__attribute__((unused
));
4211 if (local_TLE102
!= NULL
)
4213 zval_ptr_dtor (&local_TLE102
);
4215 if (local_TLE24
!= NULL
)
4217 zval_ptr_dtor (&local_TLE24
);
4219 if (local_TMIt101
!= NULL
)
4221 zval_ptr_dtor (&local_TMIt101
);
4224 // function getindexpolicy()
4226 // $TSt25 = $this->mIndexPolicy;
4229 PHP_METHOD(ParserOutput
, getindexpolicy
)
4231 zval
* local_TSt25
= NULL
;
4232 zval
* local_this
= getThis();
4234 // $TSt25 = $this->mIndexPolicy;
4236 if (local_this
== NULL
)
4238 local_this
= EG (uninitialized_zval_ptr
);
4239 local_this
->refcount
++;
4241 zval
** p_obj
= &local_this
;
4244 INIT_ZVAL (field_name
);
4245 ZVAL_STRING (&field_name
, "mIndexPolicy", 0);
4247 // I *think* this is correct, but documentation of the Zend API is scarce :)
4248 zval
* field
= Z_OBJ_HT_PP(p_obj
)->read_property(*p_obj
, &field_name
, BP_VAR_R TSRMLS_CC
);
4249 if (local_TSt25
== NULL
)
4251 local_TSt25
= EG (uninitialized_zval_ptr
);
4252 local_TSt25
->refcount
++;
4254 zval
** p_lhs
= &local_TSt25
;
4256 write_var (p_lhs
, field
);
4257 phc_check_invariants (TSRMLS_C
);
4262 if (local_TSt25
== NULL
)
4263 rhs
= EG (uninitialized_zval_ptr
);
4267 // Run-time return by reference has different semantics to compile-time.
4268 // If the function has CTRBR and RTRBR, the the assignment will be
4269 // reference. If one or the other is return-by-copy, the result will be
4270 // by copy. Its a question of whether its separated at return-time (which
4271 // we do here) or at the call-site.
4272 return_value
->value
= rhs
->value
;
4273 return_value
->type
= rhs
->type
;
4274 zval_copy_ctor (return_value
);
4275 goto end_of_function
;
4276 phc_check_invariants (TSRMLS_C
);
4279 end_of_function
:__attribute__((unused
));
4280 if (local_TSt25
!= NULL
)
4282 zval_ptr_dtor (&local_TSt25
);
4285 // function containsoldmagic()
4287 // $TSt26 = $this->mContainsOldMagic;
4290 PHP_METHOD(ParserOutput
, containsoldmagic
)
4292 zval
* local_TSt26
= NULL
;
4293 zval
* local_this
= getThis();
4295 // $TSt26 = $this->mContainsOldMagic;
4297 if (local_this
== NULL
)
4299 local_this
= EG (uninitialized_zval_ptr
);
4300 local_this
->refcount
++;
4302 zval
** p_obj
= &local_this
;
4305 INIT_ZVAL (field_name
);
4306 ZVAL_STRING (&field_name
, "mContainsOldMagic", 0);
4308 // I *think* this is correct, but documentation of the Zend API is scarce :)
4309 zval
* field
= Z_OBJ_HT_PP(p_obj
)->read_property(*p_obj
, &field_name
, BP_VAR_R TSRMLS_CC
);
4310 if (local_TSt26
== NULL
)
4312 local_TSt26
= EG (uninitialized_zval_ptr
);
4313 local_TSt26
->refcount
++;
4315 zval
** p_lhs
= &local_TSt26
;
4317 write_var (p_lhs
, field
);
4318 phc_check_invariants (TSRMLS_C
);
4323 if (local_TSt26
== NULL
)
4324 rhs
= EG (uninitialized_zval_ptr
);
4328 // Run-time return by reference has different semantics to compile-time.
4329 // If the function has CTRBR and RTRBR, the the assignment will be
4330 // reference. If one or the other is return-by-copy, the result will be
4331 // by copy. Its a question of whether its separated at return-time (which
4332 // we do here) or at the call-site.
4333 return_value
->value
= rhs
->value
;
4334 return_value
->type
= rhs
->type
;
4335 zval_copy_ctor (return_value
);
4336 goto end_of_function
;
4337 phc_check_invariants (TSRMLS_C
);
4340 end_of_function
:__attribute__((unused
));
4341 if (local_TSt26
!= NULL
)
4343 zval_ptr_dtor (&local_TSt26
);
4346 // function settext($text)
4348 // $TLE104 = param_is_ref (NULL, "wfsetvar", 0);
4350 // if (TLE104) goto L134 else goto L135;
4352 // $TMIt103 =& $this->mText;
4355 // $TMIt103 = $this->mText;
4358 // $TLE27 = wfsetvar($TMIt103, $text);
4361 PHP_METHOD(ParserOutput
, settext
)
4363 zval
* local_TLE104
= NULL
;
4364 zval
* local_TLE27
= NULL
;
4365 zval
* local_TMIt103
= NULL
;
4366 zval
* local_text
= NULL
;
4367 zval
* local_this
= getThis();
4368 // Add all parameters as local variables
4370 int num_args
= ZEND_NUM_ARGS ();
4372 zend_get_parameters_array(0, num_args
, params
);
4374 params
[0]->refcount
++;
4375 if (local_text
!= NULL
)
4377 zval_ptr_dtor (&local_text
);
4379 local_text
= params
[0];
4382 // $TLE104 = param_is_ref (NULL, "wfsetvar", 0);
4385 initialize_function_call (&wfsetvar_fci
, &wfsetvar_fcic
, "wfsetvar", "<unknown>", 0 TSRMLS_CC
);
4386 zend_function
* signature
= wfsetvar_fcic
.function_handler
;
4387 zend_arg_info
* arg_info
= signature
->common
.arg_info
;
4389 while (arg_info
&& count
< 0)
4395 if (local_TLE104
== NULL
)
4397 local_TLE104
= EG (uninitialized_zval_ptr
);
4398 local_TLE104
->refcount
++;
4400 zval
** p_lhs
= &local_TLE104
;
4403 ALLOC_INIT_ZVAL (rhs
);
4404 if (arg_info
&& count
== 0)
4406 ZVAL_BOOL (rhs
, arg_info
->pass_by_reference
);
4410 ZVAL_BOOL (rhs
, signature
->common
.pass_rest_by_reference
);
4412 write_var (p_lhs
, rhs
);
4413 zval_ptr_dtor (&rhs
);
4414 phc_check_invariants (TSRMLS_C
);
4416 // if (TLE104) goto L134 else goto L135;
4419 if (local_TLE104
== NULL
)
4420 p_cond
= EG (uninitialized_zval_ptr
);
4422 p_cond
= local_TLE104
;
4424 zend_bool bcond
= zend_is_true (p_cond
);
4429 phc_check_invariants (TSRMLS_C
);
4433 // $TMIt103 =& $this->mText;
4435 if (local_this
== NULL
)
4437 local_this
= EG (uninitialized_zval_ptr
);
4438 local_this
->refcount
++;
4440 zval
** p_obj
= &local_this
;
4443 INIT_ZVAL (field_name
);
4444 ZVAL_STRING (&field_name
, "mText", 0);
4446 zval
** field
= Z_OBJ_HT_PP(p_obj
)->get_property_ptr_ptr(*p_obj
, &field_name TSRMLS_CC
);
4447 sep_copy_on_write (field
);
4448 if (local_TMIt103
== NULL
)
4450 local_TMIt103
= EG (uninitialized_zval_ptr
);
4451 local_TMIt103
->refcount
++;
4453 zval
** p_lhs
= &local_TMIt103
;
4455 copy_into_ref (p_lhs
, field
);
4456 phc_check_invariants (TSRMLS_C
);
4461 phc_check_invariants (TSRMLS_C
);
4465 // $TMIt103 = $this->mText;
4467 if (local_this
== NULL
)
4469 local_this
= EG (uninitialized_zval_ptr
);
4470 local_this
->refcount
++;
4472 zval
** p_obj
= &local_this
;
4475 INIT_ZVAL (field_name
);
4476 ZVAL_STRING (&field_name
, "mText", 0);
4478 // I *think* this is correct, but documentation of the Zend API is scarce :)
4479 zval
* field
= Z_OBJ_HT_PP(p_obj
)->read_property(*p_obj
, &field_name
, BP_VAR_R TSRMLS_CC
);
4480 if (local_TMIt103
== NULL
)
4482 local_TMIt103
= EG (uninitialized_zval_ptr
);
4483 local_TMIt103
->refcount
++;
4485 zval
** p_lhs
= &local_TMIt103
;
4487 write_var (p_lhs
, field
);
4488 phc_check_invariants (TSRMLS_C
);
4493 phc_check_invariants (TSRMLS_C
);
4497 // $TLE27 = wfsetvar($TMIt103, $text);
4499 initialize_function_call (&wfsetvar_fci
, &wfsetvar_fcic
, "wfsetvar", "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 62 TSRMLS_CC
);
4500 zend_function
* signature
= wfsetvar_fcic
.function_handler
;
4501 zend_arg_info
* arg_info
= signature
->common
.arg_info
; // optional
4505 // TODO: find names to replace index
4508 by_ref
[abr_index
] = arg_info
->pass_by_reference
;
4512 by_ref
[abr_index
] = signature
->common
.pass_rest_by_reference
;
4515 // TODO: find names to replace index
4518 by_ref
[abr_index
] = arg_info
->pass_by_reference
;
4522 by_ref
[abr_index
] = signature
->common
.pass_rest_by_reference
;
4527 // Setup array of arguments
4528 // TODO: i think arrays of size 0 is an error
4531 zval
** args_ind
[2];
4534 destruct
[af_index
] = 0;
4535 if (by_ref
[af_index
])
4537 if (local_TMIt103
== NULL
)
4539 local_TMIt103
= EG (uninitialized_zval_ptr
);
4540 local_TMIt103
->refcount
++;
4542 zval
** p_arg
= &local_TMIt103
;
4544 args_ind
[af_index
] = fetch_var_arg_by_ref (p_arg
);
4545 assert (!in_copy_on_write (*args_ind
[af_index
]));
4546 args
[af_index
] = *args_ind
[af_index
];
4551 if (local_TMIt103
== NULL
)
4552 arg
= EG (uninitialized_zval_ptr
);
4554 arg
= local_TMIt103
;
4556 args
[af_index
] = fetch_var_arg (arg
, &destruct
[af_index
]);
4557 args_ind
[af_index
] = &args
[af_index
];
4560 destruct
[af_index
] = 0;
4561 if (by_ref
[af_index
])
4563 if (local_text
== NULL
)
4565 local_text
= EG (uninitialized_zval_ptr
);
4566 local_text
->refcount
++;
4568 zval
** p_arg
= &local_text
;
4570 args_ind
[af_index
] = fetch_var_arg_by_ref (p_arg
);
4571 assert (!in_copy_on_write (*args_ind
[af_index
]));
4572 args
[af_index
] = *args_ind
[af_index
];
4577 if (local_text
== NULL
)
4578 arg
= EG (uninitialized_zval_ptr
);
4582 args
[af_index
] = fetch_var_arg (arg
, &destruct
[af_index
]);
4583 args_ind
[af_index
] = &args
[af_index
];
4588 phc_setup_error (1, "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 62, NULL TSRMLS_CC
);
4590 // save existing parameters, in case of recursion
4591 int param_count_save
= wfsetvar_fci
.param_count
;
4592 zval
*** params_save
= wfsetvar_fci
.params
;
4593 zval
** retval_save
= wfsetvar_fci
.retval_ptr_ptr
;
4598 wfsetvar_fci
.params
= args_ind
;
4599 wfsetvar_fci
.param_count
= 2;
4600 wfsetvar_fci
.retval_ptr_ptr
= &rhs
;
4602 // call the function
4603 int success
= zend_call_function (&wfsetvar_fci
, &wfsetvar_fcic TSRMLS_CC
);
4604 assert(success
== SUCCESS
);
4607 wfsetvar_fci
.params
= params_save
;
4608 wfsetvar_fci
.param_count
= param_count_save
;
4609 wfsetvar_fci
.retval_ptr_ptr
= retval_save
;
4612 phc_setup_error (0, NULL
, 0, NULL TSRMLS_CC
);
4615 for (i
= 0; i
< 2; i
++)
4619 assert (destruct
[i
]);
4620 zval_ptr_dtor (args_ind
[i
]);
4625 // When the Zend engine returns by reference, it allocates a zval into
4626 // retval_ptr_ptr. To return by reference, the callee writes into the
4627 // retval_ptr_ptr, freeing the allocated value as it does. (Note, it may
4628 // not actually return anything). So the zval returned - whether we return
4629 // it, or it is the allocated zval - has a refcount of 1.
4631 // The caller is responsible for cleaning that up (note, this is unaffected
4632 // by whether it is added to some COW set).
4634 // For reasons unknown, the Zend API resets the refcount and is_ref fields
4635 // of the return value after the function returns (unless the callee is
4636 // interpreted). If the function is supposed to return by reference, this
4637 // loses the refcount. This only happens when non-interpreted code is
4638 // called. We work around it, when compiled code is called, by saving the
4639 // refcount into SAVED_REFCOUNT, in the return statement. The downside is
4640 // that we may create an error if our code is called by a callback, and
4641 // returns by reference, and the callback returns by reference. At least
4642 // this is an obscure case.
4643 if(signature
->common
.return_reference
&& signature
->type
!= ZEND_USER_FUNCTION
)
4645 assert (rhs
!= EG(uninitialized_zval_ptr
));
4647 if (saved_refcount
!= 0)
4649 rhs
->refcount
= saved_refcount
;
4653 saved_refcount
= 0; // for 'obscure cases'
4655 if (local_TLE27
== NULL
)
4657 local_TLE27
= EG (uninitialized_zval_ptr
);
4658 local_TLE27
->refcount
++;
4660 zval
** p_lhs
= &local_TLE27
;
4662 write_var (p_lhs
, rhs
);
4665 zval_ptr_dtor (&rhs
);
4666 if(signature
->common
.return_reference
&& signature
->type
!= ZEND_USER_FUNCTION
)
4667 zval_ptr_dtor (&rhs
);
4669 phc_check_invariants (TSRMLS_C
);
4674 if (local_TLE27
== NULL
)
4675 rhs
= EG (uninitialized_zval_ptr
);
4679 // Run-time return by reference has different semantics to compile-time.
4680 // If the function has CTRBR and RTRBR, the the assignment will be
4681 // reference. If one or the other is return-by-copy, the result will be
4682 // by copy. Its a question of whether its separated at return-time (which
4683 // we do here) or at the call-site.
4684 return_value
->value
= rhs
->value
;
4685 return_value
->type
= rhs
->type
;
4686 zval_copy_ctor (return_value
);
4687 goto end_of_function
;
4688 phc_check_invariants (TSRMLS_C
);
4691 end_of_function
:__attribute__((unused
));
4692 if (local_TLE104
!= NULL
)
4694 zval_ptr_dtor (&local_TLE104
);
4696 if (local_TLE27
!= NULL
)
4698 zval_ptr_dtor (&local_TLE27
);
4700 if (local_TMIt103
!= NULL
)
4702 zval_ptr_dtor (&local_TMIt103
);
4704 if (local_text
!= NULL
)
4706 zval_ptr_dtor (&local_text
);
4709 // function setlanguagelinks($ll)
4711 // $TLE106 = param_is_ref (NULL, "wfsetvar", 0);
4713 // if (TLE106) goto L137 else goto L138;
4715 // $TMIt105 =& $this->mLanguageLinks;
4718 // $TMIt105 = $this->mLanguageLinks;
4721 // $TLE28 = wfsetvar($TMIt105, $ll);
4724 PHP_METHOD(ParserOutput
, setlanguagelinks
)
4726 zval
* local_TLE106
= NULL
;
4727 zval
* local_TLE28
= NULL
;
4728 zval
* local_TMIt105
= NULL
;
4729 zval
* local_ll
= NULL
;
4730 zval
* local_this
= getThis();
4731 // Add all parameters as local variables
4733 int num_args
= ZEND_NUM_ARGS ();
4735 zend_get_parameters_array(0, num_args
, params
);
4737 params
[0]->refcount
++;
4738 if (local_ll
!= NULL
)
4740 zval_ptr_dtor (&local_ll
);
4742 local_ll
= params
[0];
4745 // $TLE106 = param_is_ref (NULL, "wfsetvar", 0);
4748 initialize_function_call (&wfsetvar_fci
, &wfsetvar_fcic
, "wfsetvar", "<unknown>", 0 TSRMLS_CC
);
4749 zend_function
* signature
= wfsetvar_fcic
.function_handler
;
4750 zend_arg_info
* arg_info
= signature
->common
.arg_info
;
4752 while (arg_info
&& count
< 0)
4758 if (local_TLE106
== NULL
)
4760 local_TLE106
= EG (uninitialized_zval_ptr
);
4761 local_TLE106
->refcount
++;
4763 zval
** p_lhs
= &local_TLE106
;
4766 ALLOC_INIT_ZVAL (rhs
);
4767 if (arg_info
&& count
== 0)
4769 ZVAL_BOOL (rhs
, arg_info
->pass_by_reference
);
4773 ZVAL_BOOL (rhs
, signature
->common
.pass_rest_by_reference
);
4775 write_var (p_lhs
, rhs
);
4776 zval_ptr_dtor (&rhs
);
4777 phc_check_invariants (TSRMLS_C
);
4779 // if (TLE106) goto L137 else goto L138;
4782 if (local_TLE106
== NULL
)
4783 p_cond
= EG (uninitialized_zval_ptr
);
4785 p_cond
= local_TLE106
;
4787 zend_bool bcond
= zend_is_true (p_cond
);
4792 phc_check_invariants (TSRMLS_C
);
4796 // $TMIt105 =& $this->mLanguageLinks;
4798 if (local_this
== NULL
)
4800 local_this
= EG (uninitialized_zval_ptr
);
4801 local_this
->refcount
++;
4803 zval
** p_obj
= &local_this
;
4806 INIT_ZVAL (field_name
);
4807 ZVAL_STRING (&field_name
, "mLanguageLinks", 0);
4809 zval
** field
= Z_OBJ_HT_PP(p_obj
)->get_property_ptr_ptr(*p_obj
, &field_name TSRMLS_CC
);
4810 sep_copy_on_write (field
);
4811 if (local_TMIt105
== NULL
)
4813 local_TMIt105
= EG (uninitialized_zval_ptr
);
4814 local_TMIt105
->refcount
++;
4816 zval
** p_lhs
= &local_TMIt105
;
4818 copy_into_ref (p_lhs
, field
);
4819 phc_check_invariants (TSRMLS_C
);
4824 phc_check_invariants (TSRMLS_C
);
4828 // $TMIt105 = $this->mLanguageLinks;
4830 if (local_this
== NULL
)
4832 local_this
= EG (uninitialized_zval_ptr
);
4833 local_this
->refcount
++;
4835 zval
** p_obj
= &local_this
;
4838 INIT_ZVAL (field_name
);
4839 ZVAL_STRING (&field_name
, "mLanguageLinks", 0);
4841 // I *think* this is correct, but documentation of the Zend API is scarce :)
4842 zval
* field
= Z_OBJ_HT_PP(p_obj
)->read_property(*p_obj
, &field_name
, BP_VAR_R TSRMLS_CC
);
4843 if (local_TMIt105
== NULL
)
4845 local_TMIt105
= EG (uninitialized_zval_ptr
);
4846 local_TMIt105
->refcount
++;
4848 zval
** p_lhs
= &local_TMIt105
;
4850 write_var (p_lhs
, field
);
4851 phc_check_invariants (TSRMLS_C
);
4856 phc_check_invariants (TSRMLS_C
);
4860 // $TLE28 = wfsetvar($TMIt105, $ll);
4862 initialize_function_call (&wfsetvar_fci
, &wfsetvar_fcic
, "wfsetvar", "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 63 TSRMLS_CC
);
4863 zend_function
* signature
= wfsetvar_fcic
.function_handler
;
4864 zend_arg_info
* arg_info
= signature
->common
.arg_info
; // optional
4868 // TODO: find names to replace index
4871 by_ref
[abr_index
] = arg_info
->pass_by_reference
;
4875 by_ref
[abr_index
] = signature
->common
.pass_rest_by_reference
;
4878 // TODO: find names to replace index
4881 by_ref
[abr_index
] = arg_info
->pass_by_reference
;
4885 by_ref
[abr_index
] = signature
->common
.pass_rest_by_reference
;
4890 // Setup array of arguments
4891 // TODO: i think arrays of size 0 is an error
4894 zval
** args_ind
[2];
4897 destruct
[af_index
] = 0;
4898 if (by_ref
[af_index
])
4900 if (local_TMIt105
== NULL
)
4902 local_TMIt105
= EG (uninitialized_zval_ptr
);
4903 local_TMIt105
->refcount
++;
4905 zval
** p_arg
= &local_TMIt105
;
4907 args_ind
[af_index
] = fetch_var_arg_by_ref (p_arg
);
4908 assert (!in_copy_on_write (*args_ind
[af_index
]));
4909 args
[af_index
] = *args_ind
[af_index
];
4914 if (local_TMIt105
== NULL
)
4915 arg
= EG (uninitialized_zval_ptr
);
4917 arg
= local_TMIt105
;
4919 args
[af_index
] = fetch_var_arg (arg
, &destruct
[af_index
]);
4920 args_ind
[af_index
] = &args
[af_index
];
4923 destruct
[af_index
] = 0;
4924 if (by_ref
[af_index
])
4926 if (local_ll
== NULL
)
4928 local_ll
= EG (uninitialized_zval_ptr
);
4929 local_ll
->refcount
++;
4931 zval
** p_arg
= &local_ll
;
4933 args_ind
[af_index
] = fetch_var_arg_by_ref (p_arg
);
4934 assert (!in_copy_on_write (*args_ind
[af_index
]));
4935 args
[af_index
] = *args_ind
[af_index
];
4940 if (local_ll
== NULL
)
4941 arg
= EG (uninitialized_zval_ptr
);
4945 args
[af_index
] = fetch_var_arg (arg
, &destruct
[af_index
]);
4946 args_ind
[af_index
] = &args
[af_index
];
4951 phc_setup_error (1, "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 63, NULL TSRMLS_CC
);
4953 // save existing parameters, in case of recursion
4954 int param_count_save
= wfsetvar_fci
.param_count
;
4955 zval
*** params_save
= wfsetvar_fci
.params
;
4956 zval
** retval_save
= wfsetvar_fci
.retval_ptr_ptr
;
4961 wfsetvar_fci
.params
= args_ind
;
4962 wfsetvar_fci
.param_count
= 2;
4963 wfsetvar_fci
.retval_ptr_ptr
= &rhs
;
4965 // call the function
4966 int success
= zend_call_function (&wfsetvar_fci
, &wfsetvar_fcic TSRMLS_CC
);
4967 assert(success
== SUCCESS
);
4970 wfsetvar_fci
.params
= params_save
;
4971 wfsetvar_fci
.param_count
= param_count_save
;
4972 wfsetvar_fci
.retval_ptr_ptr
= retval_save
;
4975 phc_setup_error (0, NULL
, 0, NULL TSRMLS_CC
);
4978 for (i
= 0; i
< 2; i
++)
4982 assert (destruct
[i
]);
4983 zval_ptr_dtor (args_ind
[i
]);
4988 // When the Zend engine returns by reference, it allocates a zval into
4989 // retval_ptr_ptr. To return by reference, the callee writes into the
4990 // retval_ptr_ptr, freeing the allocated value as it does. (Note, it may
4991 // not actually return anything). So the zval returned - whether we return
4992 // it, or it is the allocated zval - has a refcount of 1.
4994 // The caller is responsible for cleaning that up (note, this is unaffected
4995 // by whether it is added to some COW set).
4997 // For reasons unknown, the Zend API resets the refcount and is_ref fields
4998 // of the return value after the function returns (unless the callee is
4999 // interpreted). If the function is supposed to return by reference, this
5000 // loses the refcount. This only happens when non-interpreted code is
5001 // called. We work around it, when compiled code is called, by saving the
5002 // refcount into SAVED_REFCOUNT, in the return statement. The downside is
5003 // that we may create an error if our code is called by a callback, and
5004 // returns by reference, and the callback returns by reference. At least
5005 // this is an obscure case.
5006 if(signature
->common
.return_reference
&& signature
->type
!= ZEND_USER_FUNCTION
)
5008 assert (rhs
!= EG(uninitialized_zval_ptr
));
5010 if (saved_refcount
!= 0)
5012 rhs
->refcount
= saved_refcount
;
5016 saved_refcount
= 0; // for 'obscure cases'
5018 if (local_TLE28
== NULL
)
5020 local_TLE28
= EG (uninitialized_zval_ptr
);
5021 local_TLE28
->refcount
++;
5023 zval
** p_lhs
= &local_TLE28
;
5025 write_var (p_lhs
, rhs
);
5028 zval_ptr_dtor (&rhs
);
5029 if(signature
->common
.return_reference
&& signature
->type
!= ZEND_USER_FUNCTION
)
5030 zval_ptr_dtor (&rhs
);
5032 phc_check_invariants (TSRMLS_C
);
5037 if (local_TLE28
== NULL
)
5038 rhs
= EG (uninitialized_zval_ptr
);
5042 // Run-time return by reference has different semantics to compile-time.
5043 // If the function has CTRBR and RTRBR, the the assignment will be
5044 // reference. If one or the other is return-by-copy, the result will be
5045 // by copy. Its a question of whether its separated at return-time (which
5046 // we do here) or at the call-site.
5047 return_value
->value
= rhs
->value
;
5048 return_value
->type
= rhs
->type
;
5049 zval_copy_ctor (return_value
);
5050 goto end_of_function
;
5051 phc_check_invariants (TSRMLS_C
);
5054 end_of_function
:__attribute__((unused
));
5055 if (local_TLE106
!= NULL
)
5057 zval_ptr_dtor (&local_TLE106
);
5059 if (local_TLE28
!= NULL
)
5061 zval_ptr_dtor (&local_TLE28
);
5063 if (local_TMIt105
!= NULL
)
5065 zval_ptr_dtor (&local_TMIt105
);
5067 if (local_ll
!= NULL
)
5069 zval_ptr_dtor (&local_ll
);
5072 // function setcategorylinks($cl)
5074 // $TLE108 = param_is_ref (NULL, "wfsetvar", 0);
5076 // if (TLE108) goto L140 else goto L141;
5078 // $TMIt107 =& $this->mCategories;
5081 // $TMIt107 = $this->mCategories;
5084 // $TLE29 = wfsetvar($TMIt107, $cl);
5087 PHP_METHOD(ParserOutput
, setcategorylinks
)
5089 zval
* local_TLE108
= NULL
;
5090 zval
* local_TLE29
= NULL
;
5091 zval
* local_TMIt107
= NULL
;
5092 zval
* local_cl
= NULL
;
5093 zval
* local_this
= getThis();
5094 // Add all parameters as local variables
5096 int num_args
= ZEND_NUM_ARGS ();
5098 zend_get_parameters_array(0, num_args
, params
);
5100 params
[0]->refcount
++;
5101 if (local_cl
!= NULL
)
5103 zval_ptr_dtor (&local_cl
);
5105 local_cl
= params
[0];
5108 // $TLE108 = param_is_ref (NULL, "wfsetvar", 0);
5111 initialize_function_call (&wfsetvar_fci
, &wfsetvar_fcic
, "wfsetvar", "<unknown>", 0 TSRMLS_CC
);
5112 zend_function
* signature
= wfsetvar_fcic
.function_handler
;
5113 zend_arg_info
* arg_info
= signature
->common
.arg_info
;
5115 while (arg_info
&& count
< 0)
5121 if (local_TLE108
== NULL
)
5123 local_TLE108
= EG (uninitialized_zval_ptr
);
5124 local_TLE108
->refcount
++;
5126 zval
** p_lhs
= &local_TLE108
;
5129 ALLOC_INIT_ZVAL (rhs
);
5130 if (arg_info
&& count
== 0)
5132 ZVAL_BOOL (rhs
, arg_info
->pass_by_reference
);
5136 ZVAL_BOOL (rhs
, signature
->common
.pass_rest_by_reference
);
5138 write_var (p_lhs
, rhs
);
5139 zval_ptr_dtor (&rhs
);
5140 phc_check_invariants (TSRMLS_C
);
5142 // if (TLE108) goto L140 else goto L141;
5145 if (local_TLE108
== NULL
)
5146 p_cond
= EG (uninitialized_zval_ptr
);
5148 p_cond
= local_TLE108
;
5150 zend_bool bcond
= zend_is_true (p_cond
);
5155 phc_check_invariants (TSRMLS_C
);
5159 // $TMIt107 =& $this->mCategories;
5161 if (local_this
== NULL
)
5163 local_this
= EG (uninitialized_zval_ptr
);
5164 local_this
->refcount
++;
5166 zval
** p_obj
= &local_this
;
5169 INIT_ZVAL (field_name
);
5170 ZVAL_STRING (&field_name
, "mCategories", 0);
5172 zval
** field
= Z_OBJ_HT_PP(p_obj
)->get_property_ptr_ptr(*p_obj
, &field_name TSRMLS_CC
);
5173 sep_copy_on_write (field
);
5174 if (local_TMIt107
== NULL
)
5176 local_TMIt107
= EG (uninitialized_zval_ptr
);
5177 local_TMIt107
->refcount
++;
5179 zval
** p_lhs
= &local_TMIt107
;
5181 copy_into_ref (p_lhs
, field
);
5182 phc_check_invariants (TSRMLS_C
);
5187 phc_check_invariants (TSRMLS_C
);
5191 // $TMIt107 = $this->mCategories;
5193 if (local_this
== NULL
)
5195 local_this
= EG (uninitialized_zval_ptr
);
5196 local_this
->refcount
++;
5198 zval
** p_obj
= &local_this
;
5201 INIT_ZVAL (field_name
);
5202 ZVAL_STRING (&field_name
, "mCategories", 0);
5204 // I *think* this is correct, but documentation of the Zend API is scarce :)
5205 zval
* field
= Z_OBJ_HT_PP(p_obj
)->read_property(*p_obj
, &field_name
, BP_VAR_R TSRMLS_CC
);
5206 if (local_TMIt107
== NULL
)
5208 local_TMIt107
= EG (uninitialized_zval_ptr
);
5209 local_TMIt107
->refcount
++;
5211 zval
** p_lhs
= &local_TMIt107
;
5213 write_var (p_lhs
, field
);
5214 phc_check_invariants (TSRMLS_C
);
5219 phc_check_invariants (TSRMLS_C
);
5223 // $TLE29 = wfsetvar($TMIt107, $cl);
5225 initialize_function_call (&wfsetvar_fci
, &wfsetvar_fcic
, "wfsetvar", "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 64 TSRMLS_CC
);
5226 zend_function
* signature
= wfsetvar_fcic
.function_handler
;
5227 zend_arg_info
* arg_info
= signature
->common
.arg_info
; // optional
5231 // TODO: find names to replace index
5234 by_ref
[abr_index
] = arg_info
->pass_by_reference
;
5238 by_ref
[abr_index
] = signature
->common
.pass_rest_by_reference
;
5241 // TODO: find names to replace index
5244 by_ref
[abr_index
] = arg_info
->pass_by_reference
;
5248 by_ref
[abr_index
] = signature
->common
.pass_rest_by_reference
;
5253 // Setup array of arguments
5254 // TODO: i think arrays of size 0 is an error
5257 zval
** args_ind
[2];
5260 destruct
[af_index
] = 0;
5261 if (by_ref
[af_index
])
5263 if (local_TMIt107
== NULL
)
5265 local_TMIt107
= EG (uninitialized_zval_ptr
);
5266 local_TMIt107
->refcount
++;
5268 zval
** p_arg
= &local_TMIt107
;
5270 args_ind
[af_index
] = fetch_var_arg_by_ref (p_arg
);
5271 assert (!in_copy_on_write (*args_ind
[af_index
]));
5272 args
[af_index
] = *args_ind
[af_index
];
5277 if (local_TMIt107
== NULL
)
5278 arg
= EG (uninitialized_zval_ptr
);
5280 arg
= local_TMIt107
;
5282 args
[af_index
] = fetch_var_arg (arg
, &destruct
[af_index
]);
5283 args_ind
[af_index
] = &args
[af_index
];
5286 destruct
[af_index
] = 0;
5287 if (by_ref
[af_index
])
5289 if (local_cl
== NULL
)
5291 local_cl
= EG (uninitialized_zval_ptr
);
5292 local_cl
->refcount
++;
5294 zval
** p_arg
= &local_cl
;
5296 args_ind
[af_index
] = fetch_var_arg_by_ref (p_arg
);
5297 assert (!in_copy_on_write (*args_ind
[af_index
]));
5298 args
[af_index
] = *args_ind
[af_index
];
5303 if (local_cl
== NULL
)
5304 arg
= EG (uninitialized_zval_ptr
);
5308 args
[af_index
] = fetch_var_arg (arg
, &destruct
[af_index
]);
5309 args_ind
[af_index
] = &args
[af_index
];
5314 phc_setup_error (1, "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 64, NULL TSRMLS_CC
);
5316 // save existing parameters, in case of recursion
5317 int param_count_save
= wfsetvar_fci
.param_count
;
5318 zval
*** params_save
= wfsetvar_fci
.params
;
5319 zval
** retval_save
= wfsetvar_fci
.retval_ptr_ptr
;
5324 wfsetvar_fci
.params
= args_ind
;
5325 wfsetvar_fci
.param_count
= 2;
5326 wfsetvar_fci
.retval_ptr_ptr
= &rhs
;
5328 // call the function
5329 int success
= zend_call_function (&wfsetvar_fci
, &wfsetvar_fcic TSRMLS_CC
);
5330 assert(success
== SUCCESS
);
5333 wfsetvar_fci
.params
= params_save
;
5334 wfsetvar_fci
.param_count
= param_count_save
;
5335 wfsetvar_fci
.retval_ptr_ptr
= retval_save
;
5338 phc_setup_error (0, NULL
, 0, NULL TSRMLS_CC
);
5341 for (i
= 0; i
< 2; i
++)
5345 assert (destruct
[i
]);
5346 zval_ptr_dtor (args_ind
[i
]);
5351 // When the Zend engine returns by reference, it allocates a zval into
5352 // retval_ptr_ptr. To return by reference, the callee writes into the
5353 // retval_ptr_ptr, freeing the allocated value as it does. (Note, it may
5354 // not actually return anything). So the zval returned - whether we return
5355 // it, or it is the allocated zval - has a refcount of 1.
5357 // The caller is responsible for cleaning that up (note, this is unaffected
5358 // by whether it is added to some COW set).
5360 // For reasons unknown, the Zend API resets the refcount and is_ref fields
5361 // of the return value after the function returns (unless the callee is
5362 // interpreted). If the function is supposed to return by reference, this
5363 // loses the refcount. This only happens when non-interpreted code is
5364 // called. We work around it, when compiled code is called, by saving the
5365 // refcount into SAVED_REFCOUNT, in the return statement. The downside is
5366 // that we may create an error if our code is called by a callback, and
5367 // returns by reference, and the callback returns by reference. At least
5368 // this is an obscure case.
5369 if(signature
->common
.return_reference
&& signature
->type
!= ZEND_USER_FUNCTION
)
5371 assert (rhs
!= EG(uninitialized_zval_ptr
));
5373 if (saved_refcount
!= 0)
5375 rhs
->refcount
= saved_refcount
;
5379 saved_refcount
= 0; // for 'obscure cases'
5381 if (local_TLE29
== NULL
)
5383 local_TLE29
= EG (uninitialized_zval_ptr
);
5384 local_TLE29
->refcount
++;
5386 zval
** p_lhs
= &local_TLE29
;
5388 write_var (p_lhs
, rhs
);
5391 zval_ptr_dtor (&rhs
);
5392 if(signature
->common
.return_reference
&& signature
->type
!= ZEND_USER_FUNCTION
)
5393 zval_ptr_dtor (&rhs
);
5395 phc_check_invariants (TSRMLS_C
);
5400 if (local_TLE29
== NULL
)
5401 rhs
= EG (uninitialized_zval_ptr
);
5405 // Run-time return by reference has different semantics to compile-time.
5406 // If the function has CTRBR and RTRBR, the the assignment will be
5407 // reference. If one or the other is return-by-copy, the result will be
5408 // by copy. Its a question of whether its separated at return-time (which
5409 // we do here) or at the call-site.
5410 return_value
->value
= rhs
->value
;
5411 return_value
->type
= rhs
->type
;
5412 zval_copy_ctor (return_value
);
5413 goto end_of_function
;
5414 phc_check_invariants (TSRMLS_C
);
5417 end_of_function
:__attribute__((unused
));
5418 if (local_TLE108
!= NULL
)
5420 zval_ptr_dtor (&local_TLE108
);
5422 if (local_TLE29
!= NULL
)
5424 zval_ptr_dtor (&local_TLE29
);
5426 if (local_TMIt107
!= NULL
)
5428 zval_ptr_dtor (&local_TMIt107
);
5430 if (local_cl
!= NULL
)
5432 zval_ptr_dtor (&local_cl
);
5435 // function setcontainsoldmagic($com)
5437 // $TLE110 = param_is_ref (NULL, "wfsetvar", 0);
5439 // if (TLE110) goto L143 else goto L144;
5441 // $TMIt109 =& $this->mContainsOldMagic;
5444 // $TMIt109 = $this->mContainsOldMagic;
5447 // $TLE30 = wfsetvar($TMIt109, $com);
5450 PHP_METHOD(ParserOutput
, setcontainsoldmagic
)
5452 zval
* local_TLE110
= NULL
;
5453 zval
* local_TLE30
= NULL
;
5454 zval
* local_TMIt109
= NULL
;
5455 zval
* local_com
= NULL
;
5456 zval
* local_this
= getThis();
5457 // Add all parameters as local variables
5459 int num_args
= ZEND_NUM_ARGS ();
5461 zend_get_parameters_array(0, num_args
, params
);
5463 params
[0]->refcount
++;
5464 if (local_com
!= NULL
)
5466 zval_ptr_dtor (&local_com
);
5468 local_com
= params
[0];
5471 // $TLE110 = param_is_ref (NULL, "wfsetvar", 0);
5474 initialize_function_call (&wfsetvar_fci
, &wfsetvar_fcic
, "wfsetvar", "<unknown>", 0 TSRMLS_CC
);
5475 zend_function
* signature
= wfsetvar_fcic
.function_handler
;
5476 zend_arg_info
* arg_info
= signature
->common
.arg_info
;
5478 while (arg_info
&& count
< 0)
5484 if (local_TLE110
== NULL
)
5486 local_TLE110
= EG (uninitialized_zval_ptr
);
5487 local_TLE110
->refcount
++;
5489 zval
** p_lhs
= &local_TLE110
;
5492 ALLOC_INIT_ZVAL (rhs
);
5493 if (arg_info
&& count
== 0)
5495 ZVAL_BOOL (rhs
, arg_info
->pass_by_reference
);
5499 ZVAL_BOOL (rhs
, signature
->common
.pass_rest_by_reference
);
5501 write_var (p_lhs
, rhs
);
5502 zval_ptr_dtor (&rhs
);
5503 phc_check_invariants (TSRMLS_C
);
5505 // if (TLE110) goto L143 else goto L144;
5508 if (local_TLE110
== NULL
)
5509 p_cond
= EG (uninitialized_zval_ptr
);
5511 p_cond
= local_TLE110
;
5513 zend_bool bcond
= zend_is_true (p_cond
);
5518 phc_check_invariants (TSRMLS_C
);
5522 // $TMIt109 =& $this->mContainsOldMagic;
5524 if (local_this
== NULL
)
5526 local_this
= EG (uninitialized_zval_ptr
);
5527 local_this
->refcount
++;
5529 zval
** p_obj
= &local_this
;
5532 INIT_ZVAL (field_name
);
5533 ZVAL_STRING (&field_name
, "mContainsOldMagic", 0);
5535 zval
** field
= Z_OBJ_HT_PP(p_obj
)->get_property_ptr_ptr(*p_obj
, &field_name TSRMLS_CC
);
5536 sep_copy_on_write (field
);
5537 if (local_TMIt109
== NULL
)
5539 local_TMIt109
= EG (uninitialized_zval_ptr
);
5540 local_TMIt109
->refcount
++;
5542 zval
** p_lhs
= &local_TMIt109
;
5544 copy_into_ref (p_lhs
, field
);
5545 phc_check_invariants (TSRMLS_C
);
5550 phc_check_invariants (TSRMLS_C
);
5554 // $TMIt109 = $this->mContainsOldMagic;
5556 if (local_this
== NULL
)
5558 local_this
= EG (uninitialized_zval_ptr
);
5559 local_this
->refcount
++;
5561 zval
** p_obj
= &local_this
;
5564 INIT_ZVAL (field_name
);
5565 ZVAL_STRING (&field_name
, "mContainsOldMagic", 0);
5567 // I *think* this is correct, but documentation of the Zend API is scarce :)
5568 zval
* field
= Z_OBJ_HT_PP(p_obj
)->read_property(*p_obj
, &field_name
, BP_VAR_R TSRMLS_CC
);
5569 if (local_TMIt109
== NULL
)
5571 local_TMIt109
= EG (uninitialized_zval_ptr
);
5572 local_TMIt109
->refcount
++;
5574 zval
** p_lhs
= &local_TMIt109
;
5576 write_var (p_lhs
, field
);
5577 phc_check_invariants (TSRMLS_C
);
5582 phc_check_invariants (TSRMLS_C
);
5586 // $TLE30 = wfsetvar($TMIt109, $com);
5588 initialize_function_call (&wfsetvar_fci
, &wfsetvar_fcic
, "wfsetvar", "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 65 TSRMLS_CC
);
5589 zend_function
* signature
= wfsetvar_fcic
.function_handler
;
5590 zend_arg_info
* arg_info
= signature
->common
.arg_info
; // optional
5594 // TODO: find names to replace index
5597 by_ref
[abr_index
] = arg_info
->pass_by_reference
;
5601 by_ref
[abr_index
] = signature
->common
.pass_rest_by_reference
;
5604 // TODO: find names to replace index
5607 by_ref
[abr_index
] = arg_info
->pass_by_reference
;
5611 by_ref
[abr_index
] = signature
->common
.pass_rest_by_reference
;
5616 // Setup array of arguments
5617 // TODO: i think arrays of size 0 is an error
5620 zval
** args_ind
[2];
5623 destruct
[af_index
] = 0;
5624 if (by_ref
[af_index
])
5626 if (local_TMIt109
== NULL
)
5628 local_TMIt109
= EG (uninitialized_zval_ptr
);
5629 local_TMIt109
->refcount
++;
5631 zval
** p_arg
= &local_TMIt109
;
5633 args_ind
[af_index
] = fetch_var_arg_by_ref (p_arg
);
5634 assert (!in_copy_on_write (*args_ind
[af_index
]));
5635 args
[af_index
] = *args_ind
[af_index
];
5640 if (local_TMIt109
== NULL
)
5641 arg
= EG (uninitialized_zval_ptr
);
5643 arg
= local_TMIt109
;
5645 args
[af_index
] = fetch_var_arg (arg
, &destruct
[af_index
]);
5646 args_ind
[af_index
] = &args
[af_index
];
5649 destruct
[af_index
] = 0;
5650 if (by_ref
[af_index
])
5652 if (local_com
== NULL
)
5654 local_com
= EG (uninitialized_zval_ptr
);
5655 local_com
->refcount
++;
5657 zval
** p_arg
= &local_com
;
5659 args_ind
[af_index
] = fetch_var_arg_by_ref (p_arg
);
5660 assert (!in_copy_on_write (*args_ind
[af_index
]));
5661 args
[af_index
] = *args_ind
[af_index
];
5666 if (local_com
== NULL
)
5667 arg
= EG (uninitialized_zval_ptr
);
5671 args
[af_index
] = fetch_var_arg (arg
, &destruct
[af_index
]);
5672 args_ind
[af_index
] = &args
[af_index
];
5677 phc_setup_error (1, "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 65, NULL TSRMLS_CC
);
5679 // save existing parameters, in case of recursion
5680 int param_count_save
= wfsetvar_fci
.param_count
;
5681 zval
*** params_save
= wfsetvar_fci
.params
;
5682 zval
** retval_save
= wfsetvar_fci
.retval_ptr_ptr
;
5687 wfsetvar_fci
.params
= args_ind
;
5688 wfsetvar_fci
.param_count
= 2;
5689 wfsetvar_fci
.retval_ptr_ptr
= &rhs
;
5691 // call the function
5692 int success
= zend_call_function (&wfsetvar_fci
, &wfsetvar_fcic TSRMLS_CC
);
5693 assert(success
== SUCCESS
);
5696 wfsetvar_fci
.params
= params_save
;
5697 wfsetvar_fci
.param_count
= param_count_save
;
5698 wfsetvar_fci
.retval_ptr_ptr
= retval_save
;
5701 phc_setup_error (0, NULL
, 0, NULL TSRMLS_CC
);
5704 for (i
= 0; i
< 2; i
++)
5708 assert (destruct
[i
]);
5709 zval_ptr_dtor (args_ind
[i
]);
5714 // When the Zend engine returns by reference, it allocates a zval into
5715 // retval_ptr_ptr. To return by reference, the callee writes into the
5716 // retval_ptr_ptr, freeing the allocated value as it does. (Note, it may
5717 // not actually return anything). So the zval returned - whether we return
5718 // it, or it is the allocated zval - has a refcount of 1.
5720 // The caller is responsible for cleaning that up (note, this is unaffected
5721 // by whether it is added to some COW set).
5723 // For reasons unknown, the Zend API resets the refcount and is_ref fields
5724 // of the return value after the function returns (unless the callee is
5725 // interpreted). If the function is supposed to return by reference, this
5726 // loses the refcount. This only happens when non-interpreted code is
5727 // called. We work around it, when compiled code is called, by saving the
5728 // refcount into SAVED_REFCOUNT, in the return statement. The downside is
5729 // that we may create an error if our code is called by a callback, and
5730 // returns by reference, and the callback returns by reference. At least
5731 // this is an obscure case.
5732 if(signature
->common
.return_reference
&& signature
->type
!= ZEND_USER_FUNCTION
)
5734 assert (rhs
!= EG(uninitialized_zval_ptr
));
5736 if (saved_refcount
!= 0)
5738 rhs
->refcount
= saved_refcount
;
5742 saved_refcount
= 0; // for 'obscure cases'
5744 if (local_TLE30
== NULL
)
5746 local_TLE30
= EG (uninitialized_zval_ptr
);
5747 local_TLE30
->refcount
++;
5749 zval
** p_lhs
= &local_TLE30
;
5751 write_var (p_lhs
, rhs
);
5754 zval_ptr_dtor (&rhs
);
5755 if(signature
->common
.return_reference
&& signature
->type
!= ZEND_USER_FUNCTION
)
5756 zval_ptr_dtor (&rhs
);
5758 phc_check_invariants (TSRMLS_C
);
5763 if (local_TLE30
== NULL
)
5764 rhs
= EG (uninitialized_zval_ptr
);
5768 // Run-time return by reference has different semantics to compile-time.
5769 // If the function has CTRBR and RTRBR, the the assignment will be
5770 // reference. If one or the other is return-by-copy, the result will be
5771 // by copy. Its a question of whether its separated at return-time (which
5772 // we do here) or at the call-site.
5773 return_value
->value
= rhs
->value
;
5774 return_value
->type
= rhs
->type
;
5775 zval_copy_ctor (return_value
);
5776 goto end_of_function
;
5777 phc_check_invariants (TSRMLS_C
);
5780 end_of_function
:__attribute__((unused
));
5781 if (local_TLE110
!= NULL
)
5783 zval_ptr_dtor (&local_TLE110
);
5785 if (local_TLE30
!= NULL
)
5787 zval_ptr_dtor (&local_TLE30
);
5789 if (local_TMIt109
!= NULL
)
5791 zval_ptr_dtor (&local_TMIt109
);
5793 if (local_com
!= NULL
)
5795 zval_ptr_dtor (&local_com
);
5798 // function setcachetime($t)
5800 // $TLE112 = param_is_ref (NULL, "wfsetvar", 0);
5802 // if (TLE112) goto L146 else goto L147;
5804 // $TMIt111 =& $this->mCacheTime;
5807 // $TMIt111 = $this->mCacheTime;
5810 // $TLE31 = wfsetvar($TMIt111, $t);
5813 PHP_METHOD(ParserOutput
, setcachetime
)
5815 zval
* local_TLE112
= NULL
;
5816 zval
* local_TLE31
= NULL
;
5817 zval
* local_TMIt111
= NULL
;
5818 zval
* local_t
= NULL
;
5819 zval
* local_this
= getThis();
5820 // Add all parameters as local variables
5822 int num_args
= ZEND_NUM_ARGS ();
5824 zend_get_parameters_array(0, num_args
, params
);
5826 params
[0]->refcount
++;
5827 if (local_t
!= NULL
)
5829 zval_ptr_dtor (&local_t
);
5831 local_t
= params
[0];
5834 // $TLE112 = param_is_ref (NULL, "wfsetvar", 0);
5837 initialize_function_call (&wfsetvar_fci
, &wfsetvar_fcic
, "wfsetvar", "<unknown>", 0 TSRMLS_CC
);
5838 zend_function
* signature
= wfsetvar_fcic
.function_handler
;
5839 zend_arg_info
* arg_info
= signature
->common
.arg_info
;
5841 while (arg_info
&& count
< 0)
5847 if (local_TLE112
== NULL
)
5849 local_TLE112
= EG (uninitialized_zval_ptr
);
5850 local_TLE112
->refcount
++;
5852 zval
** p_lhs
= &local_TLE112
;
5855 ALLOC_INIT_ZVAL (rhs
);
5856 if (arg_info
&& count
== 0)
5858 ZVAL_BOOL (rhs
, arg_info
->pass_by_reference
);
5862 ZVAL_BOOL (rhs
, signature
->common
.pass_rest_by_reference
);
5864 write_var (p_lhs
, rhs
);
5865 zval_ptr_dtor (&rhs
);
5866 phc_check_invariants (TSRMLS_C
);
5868 // if (TLE112) goto L146 else goto L147;
5871 if (local_TLE112
== NULL
)
5872 p_cond
= EG (uninitialized_zval_ptr
);
5874 p_cond
= local_TLE112
;
5876 zend_bool bcond
= zend_is_true (p_cond
);
5881 phc_check_invariants (TSRMLS_C
);
5885 // $TMIt111 =& $this->mCacheTime;
5887 if (local_this
== NULL
)
5889 local_this
= EG (uninitialized_zval_ptr
);
5890 local_this
->refcount
++;
5892 zval
** p_obj
= &local_this
;
5895 INIT_ZVAL (field_name
);
5896 ZVAL_STRING (&field_name
, "mCacheTime", 0);
5898 zval
** field
= Z_OBJ_HT_PP(p_obj
)->get_property_ptr_ptr(*p_obj
, &field_name TSRMLS_CC
);
5899 sep_copy_on_write (field
);
5900 if (local_TMIt111
== NULL
)
5902 local_TMIt111
= EG (uninitialized_zval_ptr
);
5903 local_TMIt111
->refcount
++;
5905 zval
** p_lhs
= &local_TMIt111
;
5907 copy_into_ref (p_lhs
, field
);
5908 phc_check_invariants (TSRMLS_C
);
5913 phc_check_invariants (TSRMLS_C
);
5917 // $TMIt111 = $this->mCacheTime;
5919 if (local_this
== NULL
)
5921 local_this
= EG (uninitialized_zval_ptr
);
5922 local_this
->refcount
++;
5924 zval
** p_obj
= &local_this
;
5927 INIT_ZVAL (field_name
);
5928 ZVAL_STRING (&field_name
, "mCacheTime", 0);
5930 // I *think* this is correct, but documentation of the Zend API is scarce :)
5931 zval
* field
= Z_OBJ_HT_PP(p_obj
)->read_property(*p_obj
, &field_name
, BP_VAR_R TSRMLS_CC
);
5932 if (local_TMIt111
== NULL
)
5934 local_TMIt111
= EG (uninitialized_zval_ptr
);
5935 local_TMIt111
->refcount
++;
5937 zval
** p_lhs
= &local_TMIt111
;
5939 write_var (p_lhs
, field
);
5940 phc_check_invariants (TSRMLS_C
);
5945 phc_check_invariants (TSRMLS_C
);
5949 // $TLE31 = wfsetvar($TMIt111, $t);
5951 initialize_function_call (&wfsetvar_fci
, &wfsetvar_fcic
, "wfsetvar", "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 66 TSRMLS_CC
);
5952 zend_function
* signature
= wfsetvar_fcic
.function_handler
;
5953 zend_arg_info
* arg_info
= signature
->common
.arg_info
; // optional
5957 // TODO: find names to replace index
5960 by_ref
[abr_index
] = arg_info
->pass_by_reference
;
5964 by_ref
[abr_index
] = signature
->common
.pass_rest_by_reference
;
5967 // TODO: find names to replace index
5970 by_ref
[abr_index
] = arg_info
->pass_by_reference
;
5974 by_ref
[abr_index
] = signature
->common
.pass_rest_by_reference
;
5979 // Setup array of arguments
5980 // TODO: i think arrays of size 0 is an error
5983 zval
** args_ind
[2];
5986 destruct
[af_index
] = 0;
5987 if (by_ref
[af_index
])
5989 if (local_TMIt111
== NULL
)
5991 local_TMIt111
= EG (uninitialized_zval_ptr
);
5992 local_TMIt111
->refcount
++;
5994 zval
** p_arg
= &local_TMIt111
;
5996 args_ind
[af_index
] = fetch_var_arg_by_ref (p_arg
);
5997 assert (!in_copy_on_write (*args_ind
[af_index
]));
5998 args
[af_index
] = *args_ind
[af_index
];
6003 if (local_TMIt111
== NULL
)
6004 arg
= EG (uninitialized_zval_ptr
);
6006 arg
= local_TMIt111
;
6008 args
[af_index
] = fetch_var_arg (arg
, &destruct
[af_index
]);
6009 args_ind
[af_index
] = &args
[af_index
];
6012 destruct
[af_index
] = 0;
6013 if (by_ref
[af_index
])
6015 if (local_t
== NULL
)
6017 local_t
= EG (uninitialized_zval_ptr
);
6018 local_t
->refcount
++;
6020 zval
** p_arg
= &local_t
;
6022 args_ind
[af_index
] = fetch_var_arg_by_ref (p_arg
);
6023 assert (!in_copy_on_write (*args_ind
[af_index
]));
6024 args
[af_index
] = *args_ind
[af_index
];
6029 if (local_t
== NULL
)
6030 arg
= EG (uninitialized_zval_ptr
);
6034 args
[af_index
] = fetch_var_arg (arg
, &destruct
[af_index
]);
6035 args_ind
[af_index
] = &args
[af_index
];
6040 phc_setup_error (1, "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 66, NULL TSRMLS_CC
);
6042 // save existing parameters, in case of recursion
6043 int param_count_save
= wfsetvar_fci
.param_count
;
6044 zval
*** params_save
= wfsetvar_fci
.params
;
6045 zval
** retval_save
= wfsetvar_fci
.retval_ptr_ptr
;
6050 wfsetvar_fci
.params
= args_ind
;
6051 wfsetvar_fci
.param_count
= 2;
6052 wfsetvar_fci
.retval_ptr_ptr
= &rhs
;
6054 // call the function
6055 int success
= zend_call_function (&wfsetvar_fci
, &wfsetvar_fcic TSRMLS_CC
);
6056 assert(success
== SUCCESS
);
6059 wfsetvar_fci
.params
= params_save
;
6060 wfsetvar_fci
.param_count
= param_count_save
;
6061 wfsetvar_fci
.retval_ptr_ptr
= retval_save
;
6064 phc_setup_error (0, NULL
, 0, NULL TSRMLS_CC
);
6067 for (i
= 0; i
< 2; i
++)
6071 assert (destruct
[i
]);
6072 zval_ptr_dtor (args_ind
[i
]);
6077 // When the Zend engine returns by reference, it allocates a zval into
6078 // retval_ptr_ptr. To return by reference, the callee writes into the
6079 // retval_ptr_ptr, freeing the allocated value as it does. (Note, it may
6080 // not actually return anything). So the zval returned - whether we return
6081 // it, or it is the allocated zval - has a refcount of 1.
6083 // The caller is responsible for cleaning that up (note, this is unaffected
6084 // by whether it is added to some COW set).
6086 // For reasons unknown, the Zend API resets the refcount and is_ref fields
6087 // of the return value after the function returns (unless the callee is
6088 // interpreted). If the function is supposed to return by reference, this
6089 // loses the refcount. This only happens when non-interpreted code is
6090 // called. We work around it, when compiled code is called, by saving the
6091 // refcount into SAVED_REFCOUNT, in the return statement. The downside is
6092 // that we may create an error if our code is called by a callback, and
6093 // returns by reference, and the callback returns by reference. At least
6094 // this is an obscure case.
6095 if(signature
->common
.return_reference
&& signature
->type
!= ZEND_USER_FUNCTION
)
6097 assert (rhs
!= EG(uninitialized_zval_ptr
));
6099 if (saved_refcount
!= 0)
6101 rhs
->refcount
= saved_refcount
;
6105 saved_refcount
= 0; // for 'obscure cases'
6107 if (local_TLE31
== NULL
)
6109 local_TLE31
= EG (uninitialized_zval_ptr
);
6110 local_TLE31
->refcount
++;
6112 zval
** p_lhs
= &local_TLE31
;
6114 write_var (p_lhs
, rhs
);
6117 zval_ptr_dtor (&rhs
);
6118 if(signature
->common
.return_reference
&& signature
->type
!= ZEND_USER_FUNCTION
)
6119 zval_ptr_dtor (&rhs
);
6121 phc_check_invariants (TSRMLS_C
);
6126 if (local_TLE31
== NULL
)
6127 rhs
= EG (uninitialized_zval_ptr
);
6131 // Run-time return by reference has different semantics to compile-time.
6132 // If the function has CTRBR and RTRBR, the the assignment will be
6133 // reference. If one or the other is return-by-copy, the result will be
6134 // by copy. Its a question of whether its separated at return-time (which
6135 // we do here) or at the call-site.
6136 return_value
->value
= rhs
->value
;
6137 return_value
->type
= rhs
->type
;
6138 zval_copy_ctor (return_value
);
6139 goto end_of_function
;
6140 phc_check_invariants (TSRMLS_C
);
6143 end_of_function
:__attribute__((unused
));
6144 if (local_TLE112
!= NULL
)
6146 zval_ptr_dtor (&local_TLE112
);
6148 if (local_TLE31
!= NULL
)
6150 zval_ptr_dtor (&local_TLE31
);
6152 if (local_TMIt111
!= NULL
)
6154 zval_ptr_dtor (&local_TMIt111
);
6156 if (local_t
!= NULL
)
6158 zval_ptr_dtor (&local_t
);
6161 // function settitletext($t)
6163 // $TLE114 = param_is_ref (NULL, "wfsetvar", 0);
6165 // if (TLE114) goto L149 else goto L150;
6167 // $TMIt113 =& $this->mTitleText;
6170 // $TMIt113 = $this->mTitleText;
6173 // $TLE32 = wfsetvar($TMIt113, $t);
6176 PHP_METHOD(ParserOutput
, settitletext
)
6178 zval
* local_TLE114
= NULL
;
6179 zval
* local_TLE32
= NULL
;
6180 zval
* local_TMIt113
= NULL
;
6181 zval
* local_t
= NULL
;
6182 zval
* local_this
= getThis();
6183 // Add all parameters as local variables
6185 int num_args
= ZEND_NUM_ARGS ();
6187 zend_get_parameters_array(0, num_args
, params
);
6189 params
[0]->refcount
++;
6190 if (local_t
!= NULL
)
6192 zval_ptr_dtor (&local_t
);
6194 local_t
= params
[0];
6197 // $TLE114 = param_is_ref (NULL, "wfsetvar", 0);
6200 initialize_function_call (&wfsetvar_fci
, &wfsetvar_fcic
, "wfsetvar", "<unknown>", 0 TSRMLS_CC
);
6201 zend_function
* signature
= wfsetvar_fcic
.function_handler
;
6202 zend_arg_info
* arg_info
= signature
->common
.arg_info
;
6204 while (arg_info
&& count
< 0)
6210 if (local_TLE114
== NULL
)
6212 local_TLE114
= EG (uninitialized_zval_ptr
);
6213 local_TLE114
->refcount
++;
6215 zval
** p_lhs
= &local_TLE114
;
6218 ALLOC_INIT_ZVAL (rhs
);
6219 if (arg_info
&& count
== 0)
6221 ZVAL_BOOL (rhs
, arg_info
->pass_by_reference
);
6225 ZVAL_BOOL (rhs
, signature
->common
.pass_rest_by_reference
);
6227 write_var (p_lhs
, rhs
);
6228 zval_ptr_dtor (&rhs
);
6229 phc_check_invariants (TSRMLS_C
);
6231 // if (TLE114) goto L149 else goto L150;
6234 if (local_TLE114
== NULL
)
6235 p_cond
= EG (uninitialized_zval_ptr
);
6237 p_cond
= local_TLE114
;
6239 zend_bool bcond
= zend_is_true (p_cond
);
6244 phc_check_invariants (TSRMLS_C
);
6248 // $TMIt113 =& $this->mTitleText;
6250 if (local_this
== NULL
)
6252 local_this
= EG (uninitialized_zval_ptr
);
6253 local_this
->refcount
++;
6255 zval
** p_obj
= &local_this
;
6258 INIT_ZVAL (field_name
);
6259 ZVAL_STRING (&field_name
, "mTitleText", 0);
6261 zval
** field
= Z_OBJ_HT_PP(p_obj
)->get_property_ptr_ptr(*p_obj
, &field_name TSRMLS_CC
);
6262 sep_copy_on_write (field
);
6263 if (local_TMIt113
== NULL
)
6265 local_TMIt113
= EG (uninitialized_zval_ptr
);
6266 local_TMIt113
->refcount
++;
6268 zval
** p_lhs
= &local_TMIt113
;
6270 copy_into_ref (p_lhs
, field
);
6271 phc_check_invariants (TSRMLS_C
);
6276 phc_check_invariants (TSRMLS_C
);
6280 // $TMIt113 = $this->mTitleText;
6282 if (local_this
== NULL
)
6284 local_this
= EG (uninitialized_zval_ptr
);
6285 local_this
->refcount
++;
6287 zval
** p_obj
= &local_this
;
6290 INIT_ZVAL (field_name
);
6291 ZVAL_STRING (&field_name
, "mTitleText", 0);
6293 // I *think* this is correct, but documentation of the Zend API is scarce :)
6294 zval
* field
= Z_OBJ_HT_PP(p_obj
)->read_property(*p_obj
, &field_name
, BP_VAR_R TSRMLS_CC
);
6295 if (local_TMIt113
== NULL
)
6297 local_TMIt113
= EG (uninitialized_zval_ptr
);
6298 local_TMIt113
->refcount
++;
6300 zval
** p_lhs
= &local_TMIt113
;
6302 write_var (p_lhs
, field
);
6303 phc_check_invariants (TSRMLS_C
);
6308 phc_check_invariants (TSRMLS_C
);
6312 // $TLE32 = wfsetvar($TMIt113, $t);
6314 initialize_function_call (&wfsetvar_fci
, &wfsetvar_fcic
, "wfsetvar", "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 67 TSRMLS_CC
);
6315 zend_function
* signature
= wfsetvar_fcic
.function_handler
;
6316 zend_arg_info
* arg_info
= signature
->common
.arg_info
; // optional
6320 // TODO: find names to replace index
6323 by_ref
[abr_index
] = arg_info
->pass_by_reference
;
6327 by_ref
[abr_index
] = signature
->common
.pass_rest_by_reference
;
6330 // TODO: find names to replace index
6333 by_ref
[abr_index
] = arg_info
->pass_by_reference
;
6337 by_ref
[abr_index
] = signature
->common
.pass_rest_by_reference
;
6342 // Setup array of arguments
6343 // TODO: i think arrays of size 0 is an error
6346 zval
** args_ind
[2];
6349 destruct
[af_index
] = 0;
6350 if (by_ref
[af_index
])
6352 if (local_TMIt113
== NULL
)
6354 local_TMIt113
= EG (uninitialized_zval_ptr
);
6355 local_TMIt113
->refcount
++;
6357 zval
** p_arg
= &local_TMIt113
;
6359 args_ind
[af_index
] = fetch_var_arg_by_ref (p_arg
);
6360 assert (!in_copy_on_write (*args_ind
[af_index
]));
6361 args
[af_index
] = *args_ind
[af_index
];
6366 if (local_TMIt113
== NULL
)
6367 arg
= EG (uninitialized_zval_ptr
);
6369 arg
= local_TMIt113
;
6371 args
[af_index
] = fetch_var_arg (arg
, &destruct
[af_index
]);
6372 args_ind
[af_index
] = &args
[af_index
];
6375 destruct
[af_index
] = 0;
6376 if (by_ref
[af_index
])
6378 if (local_t
== NULL
)
6380 local_t
= EG (uninitialized_zval_ptr
);
6381 local_t
->refcount
++;
6383 zval
** p_arg
= &local_t
;
6385 args_ind
[af_index
] = fetch_var_arg_by_ref (p_arg
);
6386 assert (!in_copy_on_write (*args_ind
[af_index
]));
6387 args
[af_index
] = *args_ind
[af_index
];
6392 if (local_t
== NULL
)
6393 arg
= EG (uninitialized_zval_ptr
);
6397 args
[af_index
] = fetch_var_arg (arg
, &destruct
[af_index
]);
6398 args_ind
[af_index
] = &args
[af_index
];
6403 phc_setup_error (1, "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 67, NULL TSRMLS_CC
);
6405 // save existing parameters, in case of recursion
6406 int param_count_save
= wfsetvar_fci
.param_count
;
6407 zval
*** params_save
= wfsetvar_fci
.params
;
6408 zval
** retval_save
= wfsetvar_fci
.retval_ptr_ptr
;
6413 wfsetvar_fci
.params
= args_ind
;
6414 wfsetvar_fci
.param_count
= 2;
6415 wfsetvar_fci
.retval_ptr_ptr
= &rhs
;
6417 // call the function
6418 int success
= zend_call_function (&wfsetvar_fci
, &wfsetvar_fcic TSRMLS_CC
);
6419 assert(success
== SUCCESS
);
6422 wfsetvar_fci
.params
= params_save
;
6423 wfsetvar_fci
.param_count
= param_count_save
;
6424 wfsetvar_fci
.retval_ptr_ptr
= retval_save
;
6427 phc_setup_error (0, NULL
, 0, NULL TSRMLS_CC
);
6430 for (i
= 0; i
< 2; i
++)
6434 assert (destruct
[i
]);
6435 zval_ptr_dtor (args_ind
[i
]);
6440 // When the Zend engine returns by reference, it allocates a zval into
6441 // retval_ptr_ptr. To return by reference, the callee writes into the
6442 // retval_ptr_ptr, freeing the allocated value as it does. (Note, it may
6443 // not actually return anything). So the zval returned - whether we return
6444 // it, or it is the allocated zval - has a refcount of 1.
6446 // The caller is responsible for cleaning that up (note, this is unaffected
6447 // by whether it is added to some COW set).
6449 // For reasons unknown, the Zend API resets the refcount and is_ref fields
6450 // of the return value after the function returns (unless the callee is
6451 // interpreted). If the function is supposed to return by reference, this
6452 // loses the refcount. This only happens when non-interpreted code is
6453 // called. We work around it, when compiled code is called, by saving the
6454 // refcount into SAVED_REFCOUNT, in the return statement. The downside is
6455 // that we may create an error if our code is called by a callback, and
6456 // returns by reference, and the callback returns by reference. At least
6457 // this is an obscure case.
6458 if(signature
->common
.return_reference
&& signature
->type
!= ZEND_USER_FUNCTION
)
6460 assert (rhs
!= EG(uninitialized_zval_ptr
));
6462 if (saved_refcount
!= 0)
6464 rhs
->refcount
= saved_refcount
;
6468 saved_refcount
= 0; // for 'obscure cases'
6470 if (local_TLE32
== NULL
)
6472 local_TLE32
= EG (uninitialized_zval_ptr
);
6473 local_TLE32
->refcount
++;
6475 zval
** p_lhs
= &local_TLE32
;
6477 write_var (p_lhs
, rhs
);
6480 zval_ptr_dtor (&rhs
);
6481 if(signature
->common
.return_reference
&& signature
->type
!= ZEND_USER_FUNCTION
)
6482 zval_ptr_dtor (&rhs
);
6484 phc_check_invariants (TSRMLS_C
);
6489 if (local_TLE32
== NULL
)
6490 rhs
= EG (uninitialized_zval_ptr
);
6494 // Run-time return by reference has different semantics to compile-time.
6495 // If the function has CTRBR and RTRBR, the the assignment will be
6496 // reference. If one or the other is return-by-copy, the result will be
6497 // by copy. Its a question of whether its separated at return-time (which
6498 // we do here) or at the call-site.
6499 return_value
->value
= rhs
->value
;
6500 return_value
->type
= rhs
->type
;
6501 zval_copy_ctor (return_value
);
6502 goto end_of_function
;
6503 phc_check_invariants (TSRMLS_C
);
6506 end_of_function
:__attribute__((unused
));
6507 if (local_TLE114
!= NULL
)
6509 zval_ptr_dtor (&local_TLE114
);
6511 if (local_TLE32
!= NULL
)
6513 zval_ptr_dtor (&local_TLE32
);
6515 if (local_TMIt113
!= NULL
)
6517 zval_ptr_dtor (&local_TMIt113
);
6519 if (local_t
!= NULL
)
6521 zval_ptr_dtor (&local_t
);
6524 // function setsections($toc)
6526 // $TLE116 = param_is_ref (NULL, "wfsetvar", 0);
6528 // if (TLE116) goto L152 else goto L153;
6530 // $TMIt115 =& $this->mSections;
6533 // $TMIt115 = $this->mSections;
6536 // $TLE33 = wfsetvar($TMIt115, $toc);
6539 PHP_METHOD(ParserOutput
, setsections
)
6541 zval
* local_TLE116
= NULL
;
6542 zval
* local_TLE33
= NULL
;
6543 zval
* local_TMIt115
= NULL
;
6544 zval
* local_this
= getThis();
6545 zval
* local_toc
= NULL
;
6546 // Add all parameters as local variables
6548 int num_args
= ZEND_NUM_ARGS ();
6550 zend_get_parameters_array(0, num_args
, params
);
6552 params
[0]->refcount
++;
6553 if (local_toc
!= NULL
)
6555 zval_ptr_dtor (&local_toc
);
6557 local_toc
= params
[0];
6560 // $TLE116 = param_is_ref (NULL, "wfsetvar", 0);
6563 initialize_function_call (&wfsetvar_fci
, &wfsetvar_fcic
, "wfsetvar", "<unknown>", 0 TSRMLS_CC
);
6564 zend_function
* signature
= wfsetvar_fcic
.function_handler
;
6565 zend_arg_info
* arg_info
= signature
->common
.arg_info
;
6567 while (arg_info
&& count
< 0)
6573 if (local_TLE116
== NULL
)
6575 local_TLE116
= EG (uninitialized_zval_ptr
);
6576 local_TLE116
->refcount
++;
6578 zval
** p_lhs
= &local_TLE116
;
6581 ALLOC_INIT_ZVAL (rhs
);
6582 if (arg_info
&& count
== 0)
6584 ZVAL_BOOL (rhs
, arg_info
->pass_by_reference
);
6588 ZVAL_BOOL (rhs
, signature
->common
.pass_rest_by_reference
);
6590 write_var (p_lhs
, rhs
);
6591 zval_ptr_dtor (&rhs
);
6592 phc_check_invariants (TSRMLS_C
);
6594 // if (TLE116) goto L152 else goto L153;
6597 if (local_TLE116
== NULL
)
6598 p_cond
= EG (uninitialized_zval_ptr
);
6600 p_cond
= local_TLE116
;
6602 zend_bool bcond
= zend_is_true (p_cond
);
6607 phc_check_invariants (TSRMLS_C
);
6611 // $TMIt115 =& $this->mSections;
6613 if (local_this
== NULL
)
6615 local_this
= EG (uninitialized_zval_ptr
);
6616 local_this
->refcount
++;
6618 zval
** p_obj
= &local_this
;
6621 INIT_ZVAL (field_name
);
6622 ZVAL_STRING (&field_name
, "mSections", 0);
6624 zval
** field
= Z_OBJ_HT_PP(p_obj
)->get_property_ptr_ptr(*p_obj
, &field_name TSRMLS_CC
);
6625 sep_copy_on_write (field
);
6626 if (local_TMIt115
== NULL
)
6628 local_TMIt115
= EG (uninitialized_zval_ptr
);
6629 local_TMIt115
->refcount
++;
6631 zval
** p_lhs
= &local_TMIt115
;
6633 copy_into_ref (p_lhs
, field
);
6634 phc_check_invariants (TSRMLS_C
);
6639 phc_check_invariants (TSRMLS_C
);
6643 // $TMIt115 = $this->mSections;
6645 if (local_this
== NULL
)
6647 local_this
= EG (uninitialized_zval_ptr
);
6648 local_this
->refcount
++;
6650 zval
** p_obj
= &local_this
;
6653 INIT_ZVAL (field_name
);
6654 ZVAL_STRING (&field_name
, "mSections", 0);
6656 // I *think* this is correct, but documentation of the Zend API is scarce :)
6657 zval
* field
= Z_OBJ_HT_PP(p_obj
)->read_property(*p_obj
, &field_name
, BP_VAR_R TSRMLS_CC
);
6658 if (local_TMIt115
== NULL
)
6660 local_TMIt115
= EG (uninitialized_zval_ptr
);
6661 local_TMIt115
->refcount
++;
6663 zval
** p_lhs
= &local_TMIt115
;
6665 write_var (p_lhs
, field
);
6666 phc_check_invariants (TSRMLS_C
);
6671 phc_check_invariants (TSRMLS_C
);
6675 // $TLE33 = wfsetvar($TMIt115, $toc);
6677 initialize_function_call (&wfsetvar_fci
, &wfsetvar_fcic
, "wfsetvar", "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 68 TSRMLS_CC
);
6678 zend_function
* signature
= wfsetvar_fcic
.function_handler
;
6679 zend_arg_info
* arg_info
= signature
->common
.arg_info
; // optional
6683 // TODO: find names to replace index
6686 by_ref
[abr_index
] = arg_info
->pass_by_reference
;
6690 by_ref
[abr_index
] = signature
->common
.pass_rest_by_reference
;
6693 // TODO: find names to replace index
6696 by_ref
[abr_index
] = arg_info
->pass_by_reference
;
6700 by_ref
[abr_index
] = signature
->common
.pass_rest_by_reference
;
6705 // Setup array of arguments
6706 // TODO: i think arrays of size 0 is an error
6709 zval
** args_ind
[2];
6712 destruct
[af_index
] = 0;
6713 if (by_ref
[af_index
])
6715 if (local_TMIt115
== NULL
)
6717 local_TMIt115
= EG (uninitialized_zval_ptr
);
6718 local_TMIt115
->refcount
++;
6720 zval
** p_arg
= &local_TMIt115
;
6722 args_ind
[af_index
] = fetch_var_arg_by_ref (p_arg
);
6723 assert (!in_copy_on_write (*args_ind
[af_index
]));
6724 args
[af_index
] = *args_ind
[af_index
];
6729 if (local_TMIt115
== NULL
)
6730 arg
= EG (uninitialized_zval_ptr
);
6732 arg
= local_TMIt115
;
6734 args
[af_index
] = fetch_var_arg (arg
, &destruct
[af_index
]);
6735 args_ind
[af_index
] = &args
[af_index
];
6738 destruct
[af_index
] = 0;
6739 if (by_ref
[af_index
])
6741 if (local_toc
== NULL
)
6743 local_toc
= EG (uninitialized_zval_ptr
);
6744 local_toc
->refcount
++;
6746 zval
** p_arg
= &local_toc
;
6748 args_ind
[af_index
] = fetch_var_arg_by_ref (p_arg
);
6749 assert (!in_copy_on_write (*args_ind
[af_index
]));
6750 args
[af_index
] = *args_ind
[af_index
];
6755 if (local_toc
== NULL
)
6756 arg
= EG (uninitialized_zval_ptr
);
6760 args
[af_index
] = fetch_var_arg (arg
, &destruct
[af_index
]);
6761 args_ind
[af_index
] = &args
[af_index
];
6766 phc_setup_error (1, "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 68, NULL TSRMLS_CC
);
6768 // save existing parameters, in case of recursion
6769 int param_count_save
= wfsetvar_fci
.param_count
;
6770 zval
*** params_save
= wfsetvar_fci
.params
;
6771 zval
** retval_save
= wfsetvar_fci
.retval_ptr_ptr
;
6776 wfsetvar_fci
.params
= args_ind
;
6777 wfsetvar_fci
.param_count
= 2;
6778 wfsetvar_fci
.retval_ptr_ptr
= &rhs
;
6780 // call the function
6781 int success
= zend_call_function (&wfsetvar_fci
, &wfsetvar_fcic TSRMLS_CC
);
6782 assert(success
== SUCCESS
);
6785 wfsetvar_fci
.params
= params_save
;
6786 wfsetvar_fci
.param_count
= param_count_save
;
6787 wfsetvar_fci
.retval_ptr_ptr
= retval_save
;
6790 phc_setup_error (0, NULL
, 0, NULL TSRMLS_CC
);
6793 for (i
= 0; i
< 2; i
++)
6797 assert (destruct
[i
]);
6798 zval_ptr_dtor (args_ind
[i
]);
6803 // When the Zend engine returns by reference, it allocates a zval into
6804 // retval_ptr_ptr. To return by reference, the callee writes into the
6805 // retval_ptr_ptr, freeing the allocated value as it does. (Note, it may
6806 // not actually return anything). So the zval returned - whether we return
6807 // it, or it is the allocated zval - has a refcount of 1.
6809 // The caller is responsible for cleaning that up (note, this is unaffected
6810 // by whether it is added to some COW set).
6812 // For reasons unknown, the Zend API resets the refcount and is_ref fields
6813 // of the return value after the function returns (unless the callee is
6814 // interpreted). If the function is supposed to return by reference, this
6815 // loses the refcount. This only happens when non-interpreted code is
6816 // called. We work around it, when compiled code is called, by saving the
6817 // refcount into SAVED_REFCOUNT, in the return statement. The downside is
6818 // that we may create an error if our code is called by a callback, and
6819 // returns by reference, and the callback returns by reference. At least
6820 // this is an obscure case.
6821 if(signature
->common
.return_reference
&& signature
->type
!= ZEND_USER_FUNCTION
)
6823 assert (rhs
!= EG(uninitialized_zval_ptr
));
6825 if (saved_refcount
!= 0)
6827 rhs
->refcount
= saved_refcount
;
6831 saved_refcount
= 0; // for 'obscure cases'
6833 if (local_TLE33
== NULL
)
6835 local_TLE33
= EG (uninitialized_zval_ptr
);
6836 local_TLE33
->refcount
++;
6838 zval
** p_lhs
= &local_TLE33
;
6840 write_var (p_lhs
, rhs
);
6843 zval_ptr_dtor (&rhs
);
6844 if(signature
->common
.return_reference
&& signature
->type
!= ZEND_USER_FUNCTION
)
6845 zval_ptr_dtor (&rhs
);
6847 phc_check_invariants (TSRMLS_C
);
6852 if (local_TLE33
== NULL
)
6853 rhs
= EG (uninitialized_zval_ptr
);
6857 // Run-time return by reference has different semantics to compile-time.
6858 // If the function has CTRBR and RTRBR, the the assignment will be
6859 // reference. If one or the other is return-by-copy, the result will be
6860 // by copy. Its a question of whether its separated at return-time (which
6861 // we do here) or at the call-site.
6862 return_value
->value
= rhs
->value
;
6863 return_value
->type
= rhs
->type
;
6864 zval_copy_ctor (return_value
);
6865 goto end_of_function
;
6866 phc_check_invariants (TSRMLS_C
);
6869 end_of_function
:__attribute__((unused
));
6870 if (local_TLE116
!= NULL
)
6872 zval_ptr_dtor (&local_TLE116
);
6874 if (local_TLE33
!= NULL
)
6876 zval_ptr_dtor (&local_TLE33
);
6878 if (local_TMIt115
!= NULL
)
6880 zval_ptr_dtor (&local_TMIt115
);
6882 if (local_toc
!= NULL
)
6884 zval_ptr_dtor (&local_toc
);
6887 // function setindexpolicy($policy)
6889 // $TLE118 = param_is_ref (NULL, "wfsetvar", 0);
6891 // if (TLE118) goto L155 else goto L156;
6893 // $TMIt117 =& $this->mIndexPolicy;
6896 // $TMIt117 = $this->mIndexPolicy;
6899 // $TLE34 = wfsetvar($TMIt117, $policy);
6902 PHP_METHOD(ParserOutput
, setindexpolicy
)
6904 zval
* local_TLE118
= NULL
;
6905 zval
* local_TLE34
= NULL
;
6906 zval
* local_TMIt117
= NULL
;
6907 zval
* local_policy
= NULL
;
6908 zval
* local_this
= getThis();
6909 // Add all parameters as local variables
6911 int num_args
= ZEND_NUM_ARGS ();
6913 zend_get_parameters_array(0, num_args
, params
);
6915 params
[0]->refcount
++;
6916 if (local_policy
!= NULL
)
6918 zval_ptr_dtor (&local_policy
);
6920 local_policy
= params
[0];
6923 // $TLE118 = param_is_ref (NULL, "wfsetvar", 0);
6926 initialize_function_call (&wfsetvar_fci
, &wfsetvar_fcic
, "wfsetvar", "<unknown>", 0 TSRMLS_CC
);
6927 zend_function
* signature
= wfsetvar_fcic
.function_handler
;
6928 zend_arg_info
* arg_info
= signature
->common
.arg_info
;
6930 while (arg_info
&& count
< 0)
6936 if (local_TLE118
== NULL
)
6938 local_TLE118
= EG (uninitialized_zval_ptr
);
6939 local_TLE118
->refcount
++;
6941 zval
** p_lhs
= &local_TLE118
;
6944 ALLOC_INIT_ZVAL (rhs
);
6945 if (arg_info
&& count
== 0)
6947 ZVAL_BOOL (rhs
, arg_info
->pass_by_reference
);
6951 ZVAL_BOOL (rhs
, signature
->common
.pass_rest_by_reference
);
6953 write_var (p_lhs
, rhs
);
6954 zval_ptr_dtor (&rhs
);
6955 phc_check_invariants (TSRMLS_C
);
6957 // if (TLE118) goto L155 else goto L156;
6960 if (local_TLE118
== NULL
)
6961 p_cond
= EG (uninitialized_zval_ptr
);
6963 p_cond
= local_TLE118
;
6965 zend_bool bcond
= zend_is_true (p_cond
);
6970 phc_check_invariants (TSRMLS_C
);
6974 // $TMIt117 =& $this->mIndexPolicy;
6976 if (local_this
== NULL
)
6978 local_this
= EG (uninitialized_zval_ptr
);
6979 local_this
->refcount
++;
6981 zval
** p_obj
= &local_this
;
6984 INIT_ZVAL (field_name
);
6985 ZVAL_STRING (&field_name
, "mIndexPolicy", 0);
6987 zval
** field
= Z_OBJ_HT_PP(p_obj
)->get_property_ptr_ptr(*p_obj
, &field_name TSRMLS_CC
);
6988 sep_copy_on_write (field
);
6989 if (local_TMIt117
== NULL
)
6991 local_TMIt117
= EG (uninitialized_zval_ptr
);
6992 local_TMIt117
->refcount
++;
6994 zval
** p_lhs
= &local_TMIt117
;
6996 copy_into_ref (p_lhs
, field
);
6997 phc_check_invariants (TSRMLS_C
);
7002 phc_check_invariants (TSRMLS_C
);
7006 // $TMIt117 = $this->mIndexPolicy;
7008 if (local_this
== NULL
)
7010 local_this
= EG (uninitialized_zval_ptr
);
7011 local_this
->refcount
++;
7013 zval
** p_obj
= &local_this
;
7016 INIT_ZVAL (field_name
);
7017 ZVAL_STRING (&field_name
, "mIndexPolicy", 0);
7019 // I *think* this is correct, but documentation of the Zend API is scarce :)
7020 zval
* field
= Z_OBJ_HT_PP(p_obj
)->read_property(*p_obj
, &field_name
, BP_VAR_R TSRMLS_CC
);
7021 if (local_TMIt117
== NULL
)
7023 local_TMIt117
= EG (uninitialized_zval_ptr
);
7024 local_TMIt117
->refcount
++;
7026 zval
** p_lhs
= &local_TMIt117
;
7028 write_var (p_lhs
, field
);
7029 phc_check_invariants (TSRMLS_C
);
7034 phc_check_invariants (TSRMLS_C
);
7038 // $TLE34 = wfsetvar($TMIt117, $policy);
7040 initialize_function_call (&wfsetvar_fci
, &wfsetvar_fcic
, "wfsetvar", "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 69 TSRMLS_CC
);
7041 zend_function
* signature
= wfsetvar_fcic
.function_handler
;
7042 zend_arg_info
* arg_info
= signature
->common
.arg_info
; // optional
7046 // TODO: find names to replace index
7049 by_ref
[abr_index
] = arg_info
->pass_by_reference
;
7053 by_ref
[abr_index
] = signature
->common
.pass_rest_by_reference
;
7056 // TODO: find names to replace index
7059 by_ref
[abr_index
] = arg_info
->pass_by_reference
;
7063 by_ref
[abr_index
] = signature
->common
.pass_rest_by_reference
;
7068 // Setup array of arguments
7069 // TODO: i think arrays of size 0 is an error
7072 zval
** args_ind
[2];
7075 destruct
[af_index
] = 0;
7076 if (by_ref
[af_index
])
7078 if (local_TMIt117
== NULL
)
7080 local_TMIt117
= EG (uninitialized_zval_ptr
);
7081 local_TMIt117
->refcount
++;
7083 zval
** p_arg
= &local_TMIt117
;
7085 args_ind
[af_index
] = fetch_var_arg_by_ref (p_arg
);
7086 assert (!in_copy_on_write (*args_ind
[af_index
]));
7087 args
[af_index
] = *args_ind
[af_index
];
7092 if (local_TMIt117
== NULL
)
7093 arg
= EG (uninitialized_zval_ptr
);
7095 arg
= local_TMIt117
;
7097 args
[af_index
] = fetch_var_arg (arg
, &destruct
[af_index
]);
7098 args_ind
[af_index
] = &args
[af_index
];
7101 destruct
[af_index
] = 0;
7102 if (by_ref
[af_index
])
7104 if (local_policy
== NULL
)
7106 local_policy
= EG (uninitialized_zval_ptr
);
7107 local_policy
->refcount
++;
7109 zval
** p_arg
= &local_policy
;
7111 args_ind
[af_index
] = fetch_var_arg_by_ref (p_arg
);
7112 assert (!in_copy_on_write (*args_ind
[af_index
]));
7113 args
[af_index
] = *args_ind
[af_index
];
7118 if (local_policy
== NULL
)
7119 arg
= EG (uninitialized_zval_ptr
);
7123 args
[af_index
] = fetch_var_arg (arg
, &destruct
[af_index
]);
7124 args_ind
[af_index
] = &args
[af_index
];
7129 phc_setup_error (1, "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 69, NULL TSRMLS_CC
);
7131 // save existing parameters, in case of recursion
7132 int param_count_save
= wfsetvar_fci
.param_count
;
7133 zval
*** params_save
= wfsetvar_fci
.params
;
7134 zval
** retval_save
= wfsetvar_fci
.retval_ptr_ptr
;
7139 wfsetvar_fci
.params
= args_ind
;
7140 wfsetvar_fci
.param_count
= 2;
7141 wfsetvar_fci
.retval_ptr_ptr
= &rhs
;
7143 // call the function
7144 int success
= zend_call_function (&wfsetvar_fci
, &wfsetvar_fcic TSRMLS_CC
);
7145 assert(success
== SUCCESS
);
7148 wfsetvar_fci
.params
= params_save
;
7149 wfsetvar_fci
.param_count
= param_count_save
;
7150 wfsetvar_fci
.retval_ptr_ptr
= retval_save
;
7153 phc_setup_error (0, NULL
, 0, NULL TSRMLS_CC
);
7156 for (i
= 0; i
< 2; i
++)
7160 assert (destruct
[i
]);
7161 zval_ptr_dtor (args_ind
[i
]);
7166 // When the Zend engine returns by reference, it allocates a zval into
7167 // retval_ptr_ptr. To return by reference, the callee writes into the
7168 // retval_ptr_ptr, freeing the allocated value as it does. (Note, it may
7169 // not actually return anything). So the zval returned - whether we return
7170 // it, or it is the allocated zval - has a refcount of 1.
7172 // The caller is responsible for cleaning that up (note, this is unaffected
7173 // by whether it is added to some COW set).
7175 // For reasons unknown, the Zend API resets the refcount and is_ref fields
7176 // of the return value after the function returns (unless the callee is
7177 // interpreted). If the function is supposed to return by reference, this
7178 // loses the refcount. This only happens when non-interpreted code is
7179 // called. We work around it, when compiled code is called, by saving the
7180 // refcount into SAVED_REFCOUNT, in the return statement. The downside is
7181 // that we may create an error if our code is called by a callback, and
7182 // returns by reference, and the callback returns by reference. At least
7183 // this is an obscure case.
7184 if(signature
->common
.return_reference
&& signature
->type
!= ZEND_USER_FUNCTION
)
7186 assert (rhs
!= EG(uninitialized_zval_ptr
));
7188 if (saved_refcount
!= 0)
7190 rhs
->refcount
= saved_refcount
;
7194 saved_refcount
= 0; // for 'obscure cases'
7196 if (local_TLE34
== NULL
)
7198 local_TLE34
= EG (uninitialized_zval_ptr
);
7199 local_TLE34
->refcount
++;
7201 zval
** p_lhs
= &local_TLE34
;
7203 write_var (p_lhs
, rhs
);
7206 zval_ptr_dtor (&rhs
);
7207 if(signature
->common
.return_reference
&& signature
->type
!= ZEND_USER_FUNCTION
)
7208 zval_ptr_dtor (&rhs
);
7210 phc_check_invariants (TSRMLS_C
);
7215 if (local_TLE34
== NULL
)
7216 rhs
= EG (uninitialized_zval_ptr
);
7220 // Run-time return by reference has different semantics to compile-time.
7221 // If the function has CTRBR and RTRBR, the the assignment will be
7222 // reference. If one or the other is return-by-copy, the result will be
7223 // by copy. Its a question of whether its separated at return-time (which
7224 // we do here) or at the call-site.
7225 return_value
->value
= rhs
->value
;
7226 return_value
->type
= rhs
->type
;
7227 zval_copy_ctor (return_value
);
7228 goto end_of_function
;
7229 phc_check_invariants (TSRMLS_C
);
7232 end_of_function
:__attribute__((unused
));
7233 if (local_TLE118
!= NULL
)
7235 zval_ptr_dtor (&local_TLE118
);
7237 if (local_TLE34
!= NULL
)
7239 zval_ptr_dtor (&local_TLE34
);
7241 if (local_TMIt117
!= NULL
)
7243 zval_ptr_dtor (&local_TMIt117
);
7245 if (local_policy
!= NULL
)
7247 zval_ptr_dtor (&local_policy
);
7250 // function addcategory($c, $sort)
7252 // $TSt35 =& $this->mCategories;
7253 // $TSt35[$c] = $sort;
7255 PHP_METHOD(ParserOutput
, addcategory
)
7257 zval
* local_TSt35
= NULL
;
7258 zval
* local_c
= NULL
;
7259 zval
* local_sort
= NULL
;
7260 zval
* local_this
= getThis();
7261 // Add all parameters as local variables
7263 int num_args
= ZEND_NUM_ARGS ();
7265 zend_get_parameters_array(0, num_args
, params
);
7267 params
[0]->refcount
++;
7268 if (local_c
!= NULL
)
7270 zval_ptr_dtor (&local_c
);
7272 local_c
= params
[0];
7274 params
[1]->refcount
++;
7275 if (local_sort
!= NULL
)
7277 zval_ptr_dtor (&local_sort
);
7279 local_sort
= params
[1];
7282 // $TSt35 =& $this->mCategories;
7284 if (local_this
== NULL
)
7286 local_this
= EG (uninitialized_zval_ptr
);
7287 local_this
->refcount
++;
7289 zval
** p_obj
= &local_this
;
7292 INIT_ZVAL (field_name
);
7293 ZVAL_STRING (&field_name
, "mCategories", 0);
7295 zval
** field
= Z_OBJ_HT_PP(p_obj
)->get_property_ptr_ptr(*p_obj
, &field_name TSRMLS_CC
);
7296 sep_copy_on_write (field
);
7297 if (local_TSt35
== NULL
)
7299 local_TSt35
= EG (uninitialized_zval_ptr
);
7300 local_TSt35
->refcount
++;
7302 zval
** p_lhs
= &local_TSt35
;
7304 copy_into_ref (p_lhs
, field
);
7305 phc_check_invariants (TSRMLS_C
);
7307 // $TSt35[$c] = $sort;
7309 if (local_TSt35
== NULL
)
7311 local_TSt35
= EG (uninitialized_zval_ptr
);
7312 local_TSt35
->refcount
++;
7314 zval
** p_array
= &local_TSt35
;
7316 check_array_type (p_array TSRMLS_CC
);
7319 if (local_c
== NULL
)
7320 index
= EG (uninitialized_zval_ptr
);
7326 if (Z_TYPE_PP (p_array
) == IS_STRING
&& Z_STRLEN_PP (p_array
) > 0)
7329 if (local_sort
== NULL
)
7330 rhs
= EG (uninitialized_zval_ptr
);
7334 write_string_index (p_array
, index
, rhs TSRMLS_CC
);
7336 else if (Z_TYPE_PP (p_array
) == IS_ARRAY
)
7338 zval
** p_lhs
= get_ht_entry (p_array
, index TSRMLS_CC
);
7340 if (local_sort
== NULL
)
7341 rhs
= EG (uninitialized_zval_ptr
);
7347 write_var (p_lhs
, rhs
);
7350 phc_check_invariants (TSRMLS_C
);
7353 end_of_function
:__attribute__((unused
));
7354 if (local_TSt35
!= NULL
)
7356 zval_ptr_dtor (&local_TSt35
);
7358 if (local_c
!= NULL
)
7360 zval_ptr_dtor (&local_c
);
7362 if (local_sort
!= NULL
)
7364 zval_ptr_dtor (&local_sort
);
7367 // function addlanguagelink($t)
7369 // $TSt36 =& $this->mLanguageLinks;
7372 PHP_METHOD(ParserOutput
, addlanguagelink
)
7374 zval
* local_TSt36
= NULL
;
7375 zval
* local_t
= NULL
;
7376 zval
* local_this
= getThis();
7377 // Add all parameters as local variables
7379 int num_args
= ZEND_NUM_ARGS ();
7381 zend_get_parameters_array(0, num_args
, params
);
7383 params
[0]->refcount
++;
7384 if (local_t
!= NULL
)
7386 zval_ptr_dtor (&local_t
);
7388 local_t
= params
[0];
7391 // $TSt36 =& $this->mLanguageLinks;
7393 if (local_this
== NULL
)
7395 local_this
= EG (uninitialized_zval_ptr
);
7396 local_this
->refcount
++;
7398 zval
** p_obj
= &local_this
;
7401 INIT_ZVAL (field_name
);
7402 ZVAL_STRING (&field_name
, "mLanguageLinks", 0);
7404 zval
** field
= Z_OBJ_HT_PP(p_obj
)->get_property_ptr_ptr(*p_obj
, &field_name TSRMLS_CC
);
7405 sep_copy_on_write (field
);
7406 if (local_TSt36
== NULL
)
7408 local_TSt36
= EG (uninitialized_zval_ptr
);
7409 local_TSt36
->refcount
++;
7411 zval
** p_lhs
= &local_TSt36
;
7413 copy_into_ref (p_lhs
, field
);
7414 phc_check_invariants (TSRMLS_C
);
7418 if (local_TSt36
== NULL
)
7420 local_TSt36
= EG (uninitialized_zval_ptr
);
7421 local_TSt36
->refcount
++;
7423 zval
** p_array
= &local_TSt36
;
7425 // Push EG(uninit) and get a pointer to the symtable entry
7426 zval
** p_lhs
= push_and_index_ht (p_array TSRMLS_CC
);
7430 if (local_t
== NULL
)
7431 rhs
= EG (uninitialized_zval_ptr
);
7436 write_var (p_lhs
, rhs
);
7438 // I think if this is NULL, then the LHS is a bool or similar, and you cant
7440 phc_check_invariants (TSRMLS_C
);
7443 end_of_function
:__attribute__((unused
));
7444 if (local_TSt36
!= NULL
)
7446 zval_ptr_dtor (&local_TSt36
);
7448 if (local_t
!= NULL
)
7450 zval_ptr_dtor (&local_t
);
7453 // function addexternallink($url)
7455 // $TSt37 =& $this->mExternalLinks;
7457 // $TSt37[$url] = $TLE38;
7459 PHP_METHOD(ParserOutput
, addexternallink
)
7461 zval
* local_TLE38
= NULL
;
7462 zval
* local_TSt37
= NULL
;
7463 zval
* local_this
= getThis();
7464 zval
* local_url
= NULL
;
7465 // Add all parameters as local variables
7467 int num_args
= ZEND_NUM_ARGS ();
7469 zend_get_parameters_array(0, num_args
, params
);
7471 params
[0]->refcount
++;
7472 if (local_url
!= NULL
)
7474 zval_ptr_dtor (&local_url
);
7476 local_url
= params
[0];
7479 // $TSt37 =& $this->mExternalLinks;
7481 if (local_this
== NULL
)
7483 local_this
= EG (uninitialized_zval_ptr
);
7484 local_this
->refcount
++;
7486 zval
** p_obj
= &local_this
;
7489 INIT_ZVAL (field_name
);
7490 ZVAL_STRING (&field_name
, "mExternalLinks", 0);
7492 zval
** field
= Z_OBJ_HT_PP(p_obj
)->get_property_ptr_ptr(*p_obj
, &field_name TSRMLS_CC
);
7493 sep_copy_on_write (field
);
7494 if (local_TSt37
== NULL
)
7496 local_TSt37
= EG (uninitialized_zval_ptr
);
7497 local_TSt37
->refcount
++;
7499 zval
** p_lhs
= &local_TSt37
;
7501 copy_into_ref (p_lhs
, field
);
7502 phc_check_invariants (TSRMLS_C
);
7506 if (local_TLE38
== NULL
)
7508 local_TLE38
= EG (uninitialized_zval_ptr
);
7509 local_TLE38
->refcount
++;
7511 zval
** p_lhs
= &local_TLE38
;
7514 if ((*p_lhs
)->is_ref
)
7516 // Always overwrite the current value
7522 ALLOC_INIT_ZVAL (value
);
7523 zval_ptr_dtor (p_lhs
);
7527 ZVAL_LONG (value
, 1);
7529 phc_check_invariants (TSRMLS_C
);
7531 // $TSt37[$url] = $TLE38;
7533 if (local_TSt37
== NULL
)
7535 local_TSt37
= EG (uninitialized_zval_ptr
);
7536 local_TSt37
->refcount
++;
7538 zval
** p_array
= &local_TSt37
;
7540 check_array_type (p_array TSRMLS_CC
);
7543 if (local_url
== NULL
)
7544 index
= EG (uninitialized_zval_ptr
);
7550 if (Z_TYPE_PP (p_array
) == IS_STRING
&& Z_STRLEN_PP (p_array
) > 0)
7553 if (local_TLE38
== NULL
)
7554 rhs
= EG (uninitialized_zval_ptr
);
7558 write_string_index (p_array
, index
, rhs TSRMLS_CC
);
7560 else if (Z_TYPE_PP (p_array
) == IS_ARRAY
)
7562 zval
** p_lhs
= get_ht_entry (p_array
, index TSRMLS_CC
);
7564 if (local_TLE38
== NULL
)
7565 rhs
= EG (uninitialized_zval_ptr
);
7571 write_var (p_lhs
, rhs
);
7574 phc_check_invariants (TSRMLS_C
);
7577 end_of_function
:__attribute__((unused
));
7578 if (local_TLE38
!= NULL
)
7580 zval_ptr_dtor (&local_TLE38
);
7582 if (local_TSt37
!= NULL
)
7584 zval_ptr_dtor (&local_TSt37
);
7586 if (local_url
!= NULL
)
7588 zval_ptr_dtor (&local_url
);
7591 // function addwarning($s)
7593 // $TSt39 =& $this->mWarnings;
7595 // $TSt39[$s] = $TLE40;
7597 PHP_METHOD(ParserOutput
, addwarning
)
7599 zval
* local_TLE40
= NULL
;
7600 zval
* local_TSt39
= NULL
;
7601 zval
* local_s
= NULL
;
7602 zval
* local_this
= getThis();
7603 // Add all parameters as local variables
7605 int num_args
= ZEND_NUM_ARGS ();
7607 zend_get_parameters_array(0, num_args
, params
);
7609 params
[0]->refcount
++;
7610 if (local_s
!= NULL
)
7612 zval_ptr_dtor (&local_s
);
7614 local_s
= params
[0];
7617 // $TSt39 =& $this->mWarnings;
7619 if (local_this
== NULL
)
7621 local_this
= EG (uninitialized_zval_ptr
);
7622 local_this
->refcount
++;
7624 zval
** p_obj
= &local_this
;
7627 INIT_ZVAL (field_name
);
7628 ZVAL_STRING (&field_name
, "mWarnings", 0);
7630 zval
** field
= Z_OBJ_HT_PP(p_obj
)->get_property_ptr_ptr(*p_obj
, &field_name TSRMLS_CC
);
7631 sep_copy_on_write (field
);
7632 if (local_TSt39
== NULL
)
7634 local_TSt39
= EG (uninitialized_zval_ptr
);
7635 local_TSt39
->refcount
++;
7637 zval
** p_lhs
= &local_TSt39
;
7639 copy_into_ref (p_lhs
, field
);
7640 phc_check_invariants (TSRMLS_C
);
7644 if (local_TLE40
== NULL
)
7646 local_TLE40
= EG (uninitialized_zval_ptr
);
7647 local_TLE40
->refcount
++;
7649 zval
** p_lhs
= &local_TLE40
;
7652 if ((*p_lhs
)->is_ref
)
7654 // Always overwrite the current value
7660 ALLOC_INIT_ZVAL (value
);
7661 zval_ptr_dtor (p_lhs
);
7665 ZVAL_LONG (value
, 1);
7667 phc_check_invariants (TSRMLS_C
);
7669 // $TSt39[$s] = $TLE40;
7671 if (local_TSt39
== NULL
)
7673 local_TSt39
= EG (uninitialized_zval_ptr
);
7674 local_TSt39
->refcount
++;
7676 zval
** p_array
= &local_TSt39
;
7678 check_array_type (p_array TSRMLS_CC
);
7681 if (local_s
== NULL
)
7682 index
= EG (uninitialized_zval_ptr
);
7688 if (Z_TYPE_PP (p_array
) == IS_STRING
&& Z_STRLEN_PP (p_array
) > 0)
7691 if (local_TLE40
== NULL
)
7692 rhs
= EG (uninitialized_zval_ptr
);
7696 write_string_index (p_array
, index
, rhs TSRMLS_CC
);
7698 else if (Z_TYPE_PP (p_array
) == IS_ARRAY
)
7700 zval
** p_lhs
= get_ht_entry (p_array
, index TSRMLS_CC
);
7702 if (local_TLE40
== NULL
)
7703 rhs
= EG (uninitialized_zval_ptr
);
7709 write_var (p_lhs
, rhs
);
7712 phc_check_invariants (TSRMLS_C
);
7715 end_of_function
:__attribute__((unused
));
7716 if (local_TLE40
!= NULL
)
7718 zval_ptr_dtor (&local_TLE40
);
7720 if (local_TSt39
!= NULL
)
7722 zval_ptr_dtor (&local_TSt39
);
7724 if (local_s
!= NULL
)
7726 zval_ptr_dtor (&local_s
);
7729 // function addoutputhook($hook, $data = False)
7731 // $TSt41 =& $this->mOutputHooks;
7733 // $TSa42 = (array) $TSa42;
7734 // $TSa42[] = $hook;
7735 // $TSa42[] = $data;
7736 // $TSt41[] = $TSa42;
7738 PHP_METHOD(ParserOutput
, addoutputhook
)
7740 zval
* local_TSa42
= NULL
;
7741 zval
* local_TSt41
= NULL
;
7742 zval
* local_data
= NULL
;
7743 zval
* local_hook
= NULL
;
7744 zval
* local_this
= getThis();
7745 // Add all parameters as local variables
7747 int num_args
= ZEND_NUM_ARGS ();
7749 zend_get_parameters_array(0, num_args
, params
);
7751 params
[0]->refcount
++;
7752 if (local_hook
!= NULL
)
7754 zval_ptr_dtor (&local_hook
);
7756 local_hook
= params
[0];
7760 zval
* default_value
;
7762 zval
* local___static_value__
= NULL
;
7763 // $__static_value__ = False;
7765 if (local___static_value__
== NULL
)
7767 local___static_value__
= EG (uninitialized_zval_ptr
);
7768 local___static_value__
->refcount
++;
7770 zval
** p_lhs
= &local___static_value__
;
7773 if ((*p_lhs
)->is_ref
)
7775 // Always overwrite the current value
7781 ALLOC_INIT_ZVAL (value
);
7782 zval_ptr_dtor (p_lhs
);
7786 ZVAL_BOOL (value
, 0);
7788 phc_check_invariants (TSRMLS_C
);
7790 default_value
= local___static_value__
;
7791 assert(!default_value
->is_ref
);
7792 default_value
->refcount
++;
7793 if (local___static_value__
!= NULL
)
7795 zval_ptr_dtor (&local___static_value__
);
7798 default_value
->refcount
--;
7799 params
[1] = default_value
;
7801 params
[1]->refcount
++;
7802 if (local_data
!= NULL
)
7804 zval_ptr_dtor (&local_data
);
7806 local_data
= params
[1];
7809 // $TSt41 =& $this->mOutputHooks;
7811 if (local_this
== NULL
)
7813 local_this
= EG (uninitialized_zval_ptr
);
7814 local_this
->refcount
++;
7816 zval
** p_obj
= &local_this
;
7819 INIT_ZVAL (field_name
);
7820 ZVAL_STRING (&field_name
, "mOutputHooks", 0);
7822 zval
** field
= Z_OBJ_HT_PP(p_obj
)->get_property_ptr_ptr(*p_obj
, &field_name TSRMLS_CC
);
7823 sep_copy_on_write (field
);
7824 if (local_TSt41
== NULL
)
7826 local_TSt41
= EG (uninitialized_zval_ptr
);
7827 local_TSt41
->refcount
++;
7829 zval
** p_lhs
= &local_TSt41
;
7831 copy_into_ref (p_lhs
, field
);
7832 phc_check_invariants (TSRMLS_C
);
7836 if (local_TSa42
!= NULL
)
7838 zval_ptr_dtor (&local_TSa42
);
7841 phc_check_invariants (TSRMLS_C
);
7843 // $TSa42 = (array) $TSa42;
7845 if (local_TSa42
== NULL
)
7847 local_TSa42
= EG (uninitialized_zval_ptr
);
7848 local_TSa42
->refcount
++;
7850 zval
** p_lhs
= &local_TSa42
;
7853 if (local_TSa42
== NULL
)
7854 rhs
= EG (uninitialized_zval_ptr
);
7860 if ((*p_lhs
)->is_ref
)
7861 overwrite_lhs (*p_lhs
, rhs
);
7864 zval_ptr_dtor (p_lhs
);
7867 // Take a copy of RHS for LHS
7868 *p_lhs
= zvp_clone_ex (rhs
);
7881 assert (IS_ARRAY
>= 0 && IS_ARRAY
<= 6);
7882 if ((*p_lhs
)->type
!= IS_ARRAY
)
7884 sep_copy_on_write (p_lhs
);
7885 convert_to_array (*p_lhs
);
7888 phc_check_invariants (TSRMLS_C
);
7890 // $TSa42[] = $hook;
7892 if (local_TSa42
== NULL
)
7894 local_TSa42
= EG (uninitialized_zval_ptr
);
7895 local_TSa42
->refcount
++;
7897 zval
** p_array
= &local_TSa42
;
7899 // Push EG(uninit) and get a pointer to the symtable entry
7900 zval
** p_lhs
= push_and_index_ht (p_array TSRMLS_CC
);
7904 if (local_hook
== NULL
)
7905 rhs
= EG (uninitialized_zval_ptr
);
7910 write_var (p_lhs
, rhs
);
7912 // I think if this is NULL, then the LHS is a bool or similar, and you cant
7914 phc_check_invariants (TSRMLS_C
);
7916 // $TSa42[] = $data;
7918 if (local_TSa42
== NULL
)
7920 local_TSa42
= EG (uninitialized_zval_ptr
);
7921 local_TSa42
->refcount
++;
7923 zval
** p_array
= &local_TSa42
;
7925 // Push EG(uninit) and get a pointer to the symtable entry
7926 zval
** p_lhs
= push_and_index_ht (p_array TSRMLS_CC
);
7930 if (local_data
== NULL
)
7931 rhs
= EG (uninitialized_zval_ptr
);
7936 write_var (p_lhs
, rhs
);
7938 // I think if this is NULL, then the LHS is a bool or similar, and you cant
7940 phc_check_invariants (TSRMLS_C
);
7942 // $TSt41[] = $TSa42;
7944 if (local_TSt41
== NULL
)
7946 local_TSt41
= EG (uninitialized_zval_ptr
);
7947 local_TSt41
->refcount
++;
7949 zval
** p_array
= &local_TSt41
;
7951 // Push EG(uninit) and get a pointer to the symtable entry
7952 zval
** p_lhs
= push_and_index_ht (p_array TSRMLS_CC
);
7956 if (local_TSa42
== NULL
)
7957 rhs
= EG (uninitialized_zval_ptr
);
7962 write_var (p_lhs
, rhs
);
7964 // I think if this is NULL, then the LHS is a bool or similar, and you cant
7966 phc_check_invariants (TSRMLS_C
);
7969 end_of_function
:__attribute__((unused
));
7970 if (local_TSa42
!= NULL
)
7972 zval_ptr_dtor (&local_TSa42
);
7974 if (local_TSt41
!= NULL
)
7976 zval_ptr_dtor (&local_TSt41
);
7978 if (local_data
!= NULL
)
7980 zval_ptr_dtor (&local_data
);
7982 if (local_hook
!= NULL
)
7984 zval_ptr_dtor (&local_hook
);
7987 // function setnewsection($value)
7989 // $TLE43 = (bool) $value;
7990 // $this->mNewSection = $TLE43;
7992 PHP_METHOD(ParserOutput
, setnewsection
)
7994 zval
* local_TLE43
= NULL
;
7995 zval
* local_this
= getThis();
7996 zval
* local_value
= NULL
;
7997 // Add all parameters as local variables
7999 int num_args
= ZEND_NUM_ARGS ();
8001 zend_get_parameters_array(0, num_args
, params
);
8003 params
[0]->refcount
++;
8004 if (local_value
!= NULL
)
8006 zval_ptr_dtor (&local_value
);
8008 local_value
= params
[0];
8011 // $TLE43 = (bool) $value;
8013 if (local_TLE43
== NULL
)
8015 local_TLE43
= EG (uninitialized_zval_ptr
);
8016 local_TLE43
->refcount
++;
8018 zval
** p_lhs
= &local_TLE43
;
8021 if (local_value
== NULL
)
8022 rhs
= EG (uninitialized_zval_ptr
);
8028 if ((*p_lhs
)->is_ref
)
8029 overwrite_lhs (*p_lhs
, rhs
);
8032 zval_ptr_dtor (p_lhs
);
8035 // Take a copy of RHS for LHS
8036 *p_lhs
= zvp_clone_ex (rhs
);
8049 assert (IS_BOOL
>= 0 && IS_BOOL
<= 6);
8050 if ((*p_lhs
)->type
!= IS_BOOL
)
8052 sep_copy_on_write (p_lhs
);
8053 convert_to_boolean (*p_lhs
);
8056 phc_check_invariants (TSRMLS_C
);
8058 // $this->mNewSection = $TLE43;
8060 if (local_this
== NULL
)
8062 local_this
= EG (uninitialized_zval_ptr
);
8063 local_this
->refcount
++;
8065 zval
** p_obj
= &local_this
;
8068 if (local_TLE43
== NULL
)
8069 rhs
= EG (uninitialized_zval_ptr
);
8074 INIT_ZVAL (field_name
);
8075 ZVAL_STRING (&field_name
, "mNewSection", 0);
8077 Z_OBJ_HT_PP(p_obj
)->write_property(*p_obj
, &field_name
, rhs TSRMLS_CC
);
8078 phc_check_invariants (TSRMLS_C
);
8081 end_of_function
:__attribute__((unused
));
8082 if (local_TLE43
!= NULL
)
8084 zval_ptr_dtor (&local_TLE43
);
8086 if (local_value
!= NULL
)
8088 zval_ptr_dtor (&local_value
);
8091 // function getnewsection()
8093 // $TSt44 = $this->mNewSection;
8094 // $TLE45 = (bool) $TSt44;
8097 PHP_METHOD(ParserOutput
, getnewsection
)
8099 zval
* local_TLE45
= NULL
;
8100 zval
* local_TSt44
= NULL
;
8101 zval
* local_this
= getThis();
8103 // $TSt44 = $this->mNewSection;
8105 if (local_this
== NULL
)
8107 local_this
= EG (uninitialized_zval_ptr
);
8108 local_this
->refcount
++;
8110 zval
** p_obj
= &local_this
;
8113 INIT_ZVAL (field_name
);
8114 ZVAL_STRING (&field_name
, "mNewSection", 0);
8116 // I *think* this is correct, but documentation of the Zend API is scarce :)
8117 zval
* field
= Z_OBJ_HT_PP(p_obj
)->read_property(*p_obj
, &field_name
, BP_VAR_R TSRMLS_CC
);
8118 if (local_TSt44
== NULL
)
8120 local_TSt44
= EG (uninitialized_zval_ptr
);
8121 local_TSt44
->refcount
++;
8123 zval
** p_lhs
= &local_TSt44
;
8125 write_var (p_lhs
, field
);
8126 phc_check_invariants (TSRMLS_C
);
8128 // $TLE45 = (bool) $TSt44;
8130 if (local_TLE45
== NULL
)
8132 local_TLE45
= EG (uninitialized_zval_ptr
);
8133 local_TLE45
->refcount
++;
8135 zval
** p_lhs
= &local_TLE45
;
8138 if (local_TSt44
== NULL
)
8139 rhs
= EG (uninitialized_zval_ptr
);
8145 if ((*p_lhs
)->is_ref
)
8146 overwrite_lhs (*p_lhs
, rhs
);
8149 zval_ptr_dtor (p_lhs
);
8152 // Take a copy of RHS for LHS
8153 *p_lhs
= zvp_clone_ex (rhs
);
8166 assert (IS_BOOL
>= 0 && IS_BOOL
<= 6);
8167 if ((*p_lhs
)->type
!= IS_BOOL
)
8169 sep_copy_on_write (p_lhs
);
8170 convert_to_boolean (*p_lhs
);
8173 phc_check_invariants (TSRMLS_C
);
8178 if (local_TLE45
== NULL
)
8179 rhs
= EG (uninitialized_zval_ptr
);
8183 // Run-time return by reference has different semantics to compile-time.
8184 // If the function has CTRBR and RTRBR, the the assignment will be
8185 // reference. If one or the other is return-by-copy, the result will be
8186 // by copy. Its a question of whether its separated at return-time (which
8187 // we do here) or at the call-site.
8188 return_value
->value
= rhs
->value
;
8189 return_value
->type
= rhs
->type
;
8190 zval_copy_ctor (return_value
);
8191 goto end_of_function
;
8192 phc_check_invariants (TSRMLS_C
);
8195 end_of_function
:__attribute__((unused
));
8196 if (local_TLE45
!= NULL
)
8198 zval_ptr_dtor (&local_TLE45
);
8200 if (local_TSt44
!= NULL
)
8202 zval_ptr_dtor (&local_TSt44
);
8205 // function addlink($title, $id = NULL)
8207 // $ns = $title->getnamespace();
8208 // $dbk = $title->getdbkey();
8209 // $TLE46 = NS_MEDIA;
8210 // $TLE47 = ($ns == $TLE46);
8211 // if (TLE47) goto L164 else goto L165;
8216 // $TLE48 = NS_SPECIAL;
8217 // $TLE49 = ($ns == $TLE48);
8218 // if (TLE49) goto L161 else goto L162;
8225 // $TLE52 = ($dbk === $TLE51);
8226 // if (TLE52) goto L158 else goto L159;
8238 // $TMIt119 = $this->mLinks;
8239 // $TLE54 = isset($TMIt119[$ns]);
8240 // $TLE55 = !$TLE54;
8241 // if (TLE55) goto L167 else goto L168;
8243 // $TSt56 =& $this->mLinks;
8245 // $TSa57 = (array) $TSa57;
8246 // $TSt56[$ns] = $TSa57;
8251 // $TLE58 = is_null($id);
8252 // if (TLE58) goto L170 else goto L171;
8254 // $id = $title->getarticleid();
8259 // $TSt59 =& $this->mLinks;
8260 // $TSi60 =& $TSt59[$ns];
8261 // $TSi60[$dbk] = $id;
8263 PHP_METHOD(ParserOutput
, addlink
)
8265 zval
* local_TLE46
= NULL
;
8266 zval
* local_TLE47
= NULL
;
8267 zval
* local_TLE48
= NULL
;
8268 zval
* local_TLE49
= NULL
;
8269 zval
* local_TLE50
= NULL
;
8270 zval
* local_TLE51
= NULL
;
8271 zval
* local_TLE52
= NULL
;
8272 zval
* local_TLE53
= NULL
;
8273 zval
* local_TLE54
= NULL
;
8274 zval
* local_TLE55
= NULL
;
8275 zval
* local_TLE58
= NULL
;
8276 zval
* local_TMIt119
= NULL
;
8277 zval
* local_TSa57
= NULL
;
8278 zval
* local_TSi60
= NULL
;
8279 zval
* local_TSt56
= NULL
;
8280 zval
* local_TSt59
= NULL
;
8281 zval
* local_dbk
= NULL
;
8282 zval
* local_id
= NULL
;
8283 zval
* local_ns
= NULL
;
8284 zval
* local_this
= getThis();
8285 zval
* local_title
= NULL
;
8286 // Add all parameters as local variables
8288 int num_args
= ZEND_NUM_ARGS ();
8290 zend_get_parameters_array(0, num_args
, params
);
8292 params
[0]->refcount
++;
8293 if (local_title
!= NULL
)
8295 zval_ptr_dtor (&local_title
);
8297 local_title
= params
[0];
8301 zval
* default_value
;
8303 zval
* local___static_value__
= NULL
;
8304 // $__static_value__ = NULL;
8306 if (local___static_value__
== NULL
)
8308 local___static_value__
= EG (uninitialized_zval_ptr
);
8309 local___static_value__
->refcount
++;
8311 zval
** p_lhs
= &local___static_value__
;
8314 if ((*p_lhs
)->is_ref
)
8316 // Always overwrite the current value
8322 ALLOC_INIT_ZVAL (value
);
8323 zval_ptr_dtor (p_lhs
);
8329 phc_check_invariants (TSRMLS_C
);
8331 default_value
= local___static_value__
;
8332 assert(!default_value
->is_ref
);
8333 default_value
->refcount
++;
8334 if (local___static_value__
!= NULL
)
8336 zval_ptr_dtor (&local___static_value__
);
8339 default_value
->refcount
--;
8340 params
[1] = default_value
;
8342 params
[1]->refcount
++;
8343 if (local_id
!= NULL
)
8345 zval_ptr_dtor (&local_id
);
8347 local_id
= params
[1];
8350 // $ns = $title->getnamespace();
8352 if (local_title
== NULL
)
8354 local_title
= EG (uninitialized_zval_ptr
);
8355 local_title
->refcount
++;
8357 zval
** p_obj
= &local_title
;
8359 zend_fcall_info fci_object
;
8360 zend_fcall_info_cache fcic_object
= {0, NULL
, NULL
, NULL
};
8361 initialize_method_call (&fci_object
, &fcic_object
, p_obj
, "getnamespace", "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 88 TSRMLS_CC
);
8362 zend_function
* signature
= fcic_object
.function_handler
;
8363 zend_arg_info
* arg_info
= signature
->common
.arg_info
; // optional
8369 // Setup array of arguments
8370 // TODO: i think arrays of size 0 is an error
8373 zval
** args_ind
[0];
8378 phc_setup_error (1, "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 88, NULL TSRMLS_CC
);
8380 // save existing parameters, in case of recursion
8381 int param_count_save
= fci_object
.param_count
;
8382 zval
*** params_save
= fci_object
.params
;
8383 zval
** retval_save
= fci_object
.retval_ptr_ptr
;
8388 fci_object
.params
= args_ind
;
8389 fci_object
.param_count
= 0;
8390 fci_object
.retval_ptr_ptr
= &rhs
;
8392 // call the function
8393 int success
= zend_call_function (&fci_object
, &fcic_object TSRMLS_CC
);
8394 assert(success
== SUCCESS
);
8397 fci_object
.params
= params_save
;
8398 fci_object
.param_count
= param_count_save
;
8399 fci_object
.retval_ptr_ptr
= retval_save
;
8402 phc_setup_error (0, NULL
, 0, NULL TSRMLS_CC
);
8405 for (i
= 0; i
< 0; i
++)
8409 assert (destruct
[i
]);
8410 zval_ptr_dtor (args_ind
[i
]);
8415 // When the Zend engine returns by reference, it allocates a zval into
8416 // retval_ptr_ptr. To return by reference, the callee writes into the
8417 // retval_ptr_ptr, freeing the allocated value as it does. (Note, it may
8418 // not actually return anything). So the zval returned - whether we return
8419 // it, or it is the allocated zval - has a refcount of 1.
8421 // The caller is responsible for cleaning that up (note, this is unaffected
8422 // by whether it is added to some COW set).
8424 // For reasons unknown, the Zend API resets the refcount and is_ref fields
8425 // of the return value after the function returns (unless the callee is
8426 // interpreted). If the function is supposed to return by reference, this
8427 // loses the refcount. This only happens when non-interpreted code is
8428 // called. We work around it, when compiled code is called, by saving the
8429 // refcount into SAVED_REFCOUNT, in the return statement. The downside is
8430 // that we may create an error if our code is called by a callback, and
8431 // returns by reference, and the callback returns by reference. At least
8432 // this is an obscure case.
8433 if(signature
->common
.return_reference
&& signature
->type
!= ZEND_USER_FUNCTION
)
8435 assert (rhs
!= EG(uninitialized_zval_ptr
));
8437 if (saved_refcount
!= 0)
8439 rhs
->refcount
= saved_refcount
;
8443 saved_refcount
= 0; // for 'obscure cases'
8445 if (local_ns
== NULL
)
8447 local_ns
= EG (uninitialized_zval_ptr
);
8448 local_ns
->refcount
++;
8450 zval
** p_lhs
= &local_ns
;
8452 write_var (p_lhs
, rhs
);
8455 zval_ptr_dtor (&rhs
);
8456 if(signature
->common
.return_reference
&& signature
->type
!= ZEND_USER_FUNCTION
)
8457 zval_ptr_dtor (&rhs
);
8459 phc_check_invariants (TSRMLS_C
);
8461 // $dbk = $title->getdbkey();
8463 if (local_title
== NULL
)
8465 local_title
= EG (uninitialized_zval_ptr
);
8466 local_title
->refcount
++;
8468 zval
** p_obj
= &local_title
;
8470 zend_fcall_info fci_object
;
8471 zend_fcall_info_cache fcic_object
= {0, NULL
, NULL
, NULL
};
8472 initialize_method_call (&fci_object
, &fcic_object
, p_obj
, "getdbkey", "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 89 TSRMLS_CC
);
8473 zend_function
* signature
= fcic_object
.function_handler
;
8474 zend_arg_info
* arg_info
= signature
->common
.arg_info
; // optional
8480 // Setup array of arguments
8481 // TODO: i think arrays of size 0 is an error
8484 zval
** args_ind
[0];
8489 phc_setup_error (1, "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 89, NULL TSRMLS_CC
);
8491 // save existing parameters, in case of recursion
8492 int param_count_save
= fci_object
.param_count
;
8493 zval
*** params_save
= fci_object
.params
;
8494 zval
** retval_save
= fci_object
.retval_ptr_ptr
;
8499 fci_object
.params
= args_ind
;
8500 fci_object
.param_count
= 0;
8501 fci_object
.retval_ptr_ptr
= &rhs
;
8503 // call the function
8504 int success
= zend_call_function (&fci_object
, &fcic_object TSRMLS_CC
);
8505 assert(success
== SUCCESS
);
8508 fci_object
.params
= params_save
;
8509 fci_object
.param_count
= param_count_save
;
8510 fci_object
.retval_ptr_ptr
= retval_save
;
8513 phc_setup_error (0, NULL
, 0, NULL TSRMLS_CC
);
8516 for (i
= 0; i
< 0; i
++)
8520 assert (destruct
[i
]);
8521 zval_ptr_dtor (args_ind
[i
]);
8526 // When the Zend engine returns by reference, it allocates a zval into
8527 // retval_ptr_ptr. To return by reference, the callee writes into the
8528 // retval_ptr_ptr, freeing the allocated value as it does. (Note, it may
8529 // not actually return anything). So the zval returned - whether we return
8530 // it, or it is the allocated zval - has a refcount of 1.
8532 // The caller is responsible for cleaning that up (note, this is unaffected
8533 // by whether it is added to some COW set).
8535 // For reasons unknown, the Zend API resets the refcount and is_ref fields
8536 // of the return value after the function returns (unless the callee is
8537 // interpreted). If the function is supposed to return by reference, this
8538 // loses the refcount. This only happens when non-interpreted code is
8539 // called. We work around it, when compiled code is called, by saving the
8540 // refcount into SAVED_REFCOUNT, in the return statement. The downside is
8541 // that we may create an error if our code is called by a callback, and
8542 // returns by reference, and the callback returns by reference. At least
8543 // this is an obscure case.
8544 if(signature
->common
.return_reference
&& signature
->type
!= ZEND_USER_FUNCTION
)
8546 assert (rhs
!= EG(uninitialized_zval_ptr
));
8548 if (saved_refcount
!= 0)
8550 rhs
->refcount
= saved_refcount
;
8554 saved_refcount
= 0; // for 'obscure cases'
8556 if (local_dbk
== NULL
)
8558 local_dbk
= EG (uninitialized_zval_ptr
);
8559 local_dbk
->refcount
++;
8561 zval
** p_lhs
= &local_dbk
;
8563 write_var (p_lhs
, rhs
);
8566 zval_ptr_dtor (&rhs
);
8567 if(signature
->common
.return_reference
&& signature
->type
!= ZEND_USER_FUNCTION
)
8568 zval_ptr_dtor (&rhs
);
8570 phc_check_invariants (TSRMLS_C
);
8572 // $TLE46 = NS_MEDIA;
8574 // No null-terminator in length for get_constant.
8575 // zend_get_constant always returns a copy of the constant.
8576 if (local_TLE46
== NULL
)
8578 local_TLE46
= EG (uninitialized_zval_ptr
);
8579 local_TLE46
->refcount
++;
8581 zval
** p_lhs
= &local_TLE46
;
8583 if (!(*p_lhs
)->is_ref
)
8585 zval_ptr_dtor (p_lhs
);
8586 get_constant ("NS_MEDIA", 8, p_lhs TSRMLS_CC
);
8592 get_constant ("NS_MEDIA", 8, p_lhs TSRMLS_CC
);
8593 overwrite_lhs_no_copy (*p_lhs
, constant
);
8594 safe_free_zval_ptr (constant
);
8597 phc_check_invariants (TSRMLS_C
);
8599 // $TLE47 = ($ns == $TLE46);
8601 if (local_TLE47
== NULL
)
8603 local_TLE47
= EG (uninitialized_zval_ptr
);
8604 local_TLE47
->refcount
++;
8606 zval
** p_lhs
= &local_TLE47
;
8609 if (local_ns
== NULL
)
8610 left
= EG (uninitialized_zval_ptr
);
8615 if (local_TLE46
== NULL
)
8616 right
= EG (uninitialized_zval_ptr
);
8618 right
= local_TLE46
;
8620 if (in_copy_on_write (*p_lhs
))
8622 zval_ptr_dtor (p_lhs
);
8623 ALLOC_INIT_ZVAL (*p_lhs
);
8627 int result_is_operand
= (*p_lhs
== left
|| *p_lhs
== right
);
8628 is_equal_function (*p_lhs
, left
, right TSRMLS_CC
);
8630 // If the result is one of the operands, the operator function
8631 // will already have cleaned up the result
8632 if (!result_is_operand
)
8634 phc_check_invariants (TSRMLS_C
);
8636 // if (TLE47) goto L164 else goto L165;
8639 if (local_TLE47
== NULL
)
8640 p_cond
= EG (uninitialized_zval_ptr
);
8642 p_cond
= local_TLE47
;
8644 zend_bool bcond
= zend_is_true (p_cond
);
8649 phc_check_invariants (TSRMLS_C
);
8655 // No null-terminator in length for get_constant.
8656 // zend_get_constant always returns a copy of the constant.
8657 if (local_ns
== NULL
)
8659 local_ns
= EG (uninitialized_zval_ptr
);
8660 local_ns
->refcount
++;
8662 zval
** p_lhs
= &local_ns
;
8664 if (!(*p_lhs
)->is_ref
)
8666 zval_ptr_dtor (p_lhs
);
8667 get_constant ("NS_FILE", 7, p_lhs TSRMLS_CC
);
8673 get_constant ("NS_FILE", 7, p_lhs TSRMLS_CC
);
8674 overwrite_lhs_no_copy (*p_lhs
, constant
);
8675 safe_free_zval_ptr (constant
);
8678 phc_check_invariants (TSRMLS_C
);
8683 phc_check_invariants (TSRMLS_C
);
8687 // $TLE48 = NS_SPECIAL;
8689 // No null-terminator in length for get_constant.
8690 // zend_get_constant always returns a copy of the constant.
8691 if (local_TLE48
== NULL
)
8693 local_TLE48
= EG (uninitialized_zval_ptr
);
8694 local_TLE48
->refcount
++;
8696 zval
** p_lhs
= &local_TLE48
;
8698 if (!(*p_lhs
)->is_ref
)
8700 zval_ptr_dtor (p_lhs
);
8701 get_constant ("NS_SPECIAL", 10, p_lhs TSRMLS_CC
);
8707 get_constant ("NS_SPECIAL", 10, p_lhs TSRMLS_CC
);
8708 overwrite_lhs_no_copy (*p_lhs
, constant
);
8709 safe_free_zval_ptr (constant
);
8712 phc_check_invariants (TSRMLS_C
);
8714 // $TLE49 = ($ns == $TLE48);
8716 if (local_TLE49
== NULL
)
8718 local_TLE49
= EG (uninitialized_zval_ptr
);
8719 local_TLE49
->refcount
++;
8721 zval
** p_lhs
= &local_TLE49
;
8724 if (local_ns
== NULL
)
8725 left
= EG (uninitialized_zval_ptr
);
8730 if (local_TLE48
== NULL
)
8731 right
= EG (uninitialized_zval_ptr
);
8733 right
= local_TLE48
;
8735 if (in_copy_on_write (*p_lhs
))
8737 zval_ptr_dtor (p_lhs
);
8738 ALLOC_INIT_ZVAL (*p_lhs
);
8742 int result_is_operand
= (*p_lhs
== left
|| *p_lhs
== right
);
8743 is_equal_function (*p_lhs
, left
, right TSRMLS_CC
);
8745 // If the result is one of the operands, the operator function
8746 // will already have cleaned up the result
8747 if (!result_is_operand
)
8749 phc_check_invariants (TSRMLS_C
);
8751 // if (TLE49) goto L161 else goto L162;
8754 if (local_TLE49
== NULL
)
8755 p_cond
= EG (uninitialized_zval_ptr
);
8757 p_cond
= local_TLE49
;
8759 zend_bool bcond
= zend_is_true (p_cond
);
8764 phc_check_invariants (TSRMLS_C
);
8770 if (local_TLE50
== NULL
)
8772 local_TLE50
= EG (uninitialized_zval_ptr
);
8773 local_TLE50
->refcount
++;
8775 zval
** p_lhs
= &local_TLE50
;
8778 if ((*p_lhs
)->is_ref
)
8780 // Always overwrite the current value
8786 ALLOC_INIT_ZVAL (value
);
8787 zval_ptr_dtor (p_lhs
);
8793 phc_check_invariants (TSRMLS_C
);
8798 if (local_TLE50
== NULL
)
8799 rhs
= EG (uninitialized_zval_ptr
);
8803 // Run-time return by reference has different semantics to compile-time.
8804 // If the function has CTRBR and RTRBR, the the assignment will be
8805 // reference. If one or the other is return-by-copy, the result will be
8806 // by copy. Its a question of whether its separated at return-time (which
8807 // we do here) or at the call-site.
8808 return_value
->value
= rhs
->value
;
8809 return_value
->type
= rhs
->type
;
8810 zval_copy_ctor (return_value
);
8811 goto end_of_function
;
8812 phc_check_invariants (TSRMLS_C
);
8817 phc_check_invariants (TSRMLS_C
);
8823 if (local_TLE51
== NULL
)
8825 local_TLE51
= EG (uninitialized_zval_ptr
);
8826 local_TLE51
->refcount
++;
8828 zval
** p_lhs
= &local_TLE51
;
8831 if ((*p_lhs
)->is_ref
)
8833 // Always overwrite the current value
8839 ALLOC_INIT_ZVAL (value
);
8840 zval_ptr_dtor (p_lhs
);
8844 ZVAL_STRINGL(value
, "", 0, 1);
8846 phc_check_invariants (TSRMLS_C
);
8848 // $TLE52 = ($dbk === $TLE51);
8850 if (local_TLE52
== NULL
)
8852 local_TLE52
= EG (uninitialized_zval_ptr
);
8853 local_TLE52
->refcount
++;
8855 zval
** p_lhs
= &local_TLE52
;
8858 if (local_dbk
== NULL
)
8859 left
= EG (uninitialized_zval_ptr
);
8864 if (local_TLE51
== NULL
)
8865 right
= EG (uninitialized_zval_ptr
);
8867 right
= local_TLE51
;
8869 if (in_copy_on_write (*p_lhs
))
8871 zval_ptr_dtor (p_lhs
);
8872 ALLOC_INIT_ZVAL (*p_lhs
);
8876 int result_is_operand
= (*p_lhs
== left
|| *p_lhs
== right
);
8877 is_identical_function (*p_lhs
, left
, right TSRMLS_CC
);
8879 // If the result is one of the operands, the operator function
8880 // will already have cleaned up the result
8881 if (!result_is_operand
)
8883 phc_check_invariants (TSRMLS_C
);
8885 // if (TLE52) goto L158 else goto L159;
8888 if (local_TLE52
== NULL
)
8889 p_cond
= EG (uninitialized_zval_ptr
);
8891 p_cond
= local_TLE52
;
8893 zend_bool bcond
= zend_is_true (p_cond
);
8898 phc_check_invariants (TSRMLS_C
);
8904 if (local_TLE53
== NULL
)
8906 local_TLE53
= EG (uninitialized_zval_ptr
);
8907 local_TLE53
->refcount
++;
8909 zval
** p_lhs
= &local_TLE53
;
8912 if ((*p_lhs
)->is_ref
)
8914 // Always overwrite the current value
8920 ALLOC_INIT_ZVAL (value
);
8921 zval_ptr_dtor (p_lhs
);
8927 phc_check_invariants (TSRMLS_C
);
8932 if (local_TLE53
== NULL
)
8933 rhs
= EG (uninitialized_zval_ptr
);
8937 // Run-time return by reference has different semantics to compile-time.
8938 // If the function has CTRBR and RTRBR, the the assignment will be
8939 // reference. If one or the other is return-by-copy, the result will be
8940 // by copy. Its a question of whether its separated at return-time (which
8941 // we do here) or at the call-site.
8942 return_value
->value
= rhs
->value
;
8943 return_value
->type
= rhs
->type
;
8944 zval_copy_ctor (return_value
);
8945 goto end_of_function
;
8946 phc_check_invariants (TSRMLS_C
);
8951 phc_check_invariants (TSRMLS_C
);
8958 phc_check_invariants (TSRMLS_C
);
8965 phc_check_invariants (TSRMLS_C
);
8972 phc_check_invariants (TSRMLS_C
);
8976 // $TMIt119 = $this->mLinks;
8978 if (local_this
== NULL
)
8980 local_this
= EG (uninitialized_zval_ptr
);
8981 local_this
->refcount
++;
8983 zval
** p_obj
= &local_this
;
8986 INIT_ZVAL (field_name
);
8987 ZVAL_STRING (&field_name
, "mLinks", 0);
8989 // I *think* this is correct, but documentation of the Zend API is scarce :)
8990 zval
* field
= Z_OBJ_HT_PP(p_obj
)->read_property(*p_obj
, &field_name
, BP_VAR_R TSRMLS_CC
);
8991 if (local_TMIt119
== NULL
)
8993 local_TMIt119
= EG (uninitialized_zval_ptr
);
8994 local_TMIt119
->refcount
++;
8996 zval
** p_lhs
= &local_TMIt119
;
8998 write_var (p_lhs
, field
);
8999 phc_check_invariants (TSRMLS_C
);
9001 // $TLE54 = isset($TMIt119[$ns]);
9003 if (local_TLE54
== NULL
)
9005 local_TLE54
= EG (uninitialized_zval_ptr
);
9006 local_TLE54
->refcount
++;
9008 zval
** p_lhs
= &local_TLE54
;
9010 if ((*p_lhs
)->is_ref
)
9012 // Always overwrite the current value
9018 ALLOC_INIT_ZVAL (value
);
9019 zval_ptr_dtor (p_lhs
);
9022 if (local_TMIt119
== NULL
)
9024 local_TMIt119
= EG (uninitialized_zval_ptr
);
9025 local_TMIt119
->refcount
++;
9027 zval
** u_array
= &local_TMIt119
;
9029 if (local_ns
== NULL
)
9031 u_index
= EG (uninitialized_zval_ptr
);
9037 ZVAL_BOOL(value
, isset_array (u_array
, u_index
));
9038 phc_check_invariants (TSRMLS_C
);
9040 // $TLE55 = !$TLE54;
9042 if (local_TLE55
== NULL
)
9044 local_TLE55
= EG (uninitialized_zval_ptr
);
9045 local_TLE55
->refcount
++;
9047 zval
** p_lhs
= &local_TLE55
;
9050 if (local_TLE54
== NULL
)
9051 rhs
= EG (uninitialized_zval_ptr
);
9055 if (in_copy_on_write (*p_lhs
))
9057 zval_ptr_dtor (p_lhs
);
9058 ALLOC_INIT_ZVAL (*p_lhs
);
9062 int result_is_operand
= (*p_lhs
== rhs
);
9063 boolean_not_function (*p_lhs
, rhs TSRMLS_CC
);
9064 if (!result_is_operand
)
9066 phc_check_invariants (TSRMLS_C
);
9068 // if (TLE55) goto L167 else goto L168;
9071 if (local_TLE55
== NULL
)
9072 p_cond
= EG (uninitialized_zval_ptr
);
9074 p_cond
= local_TLE55
;
9076 zend_bool bcond
= zend_is_true (p_cond
);
9081 phc_check_invariants (TSRMLS_C
);
9085 // $TSt56 =& $this->mLinks;
9087 if (local_this
== NULL
)
9089 local_this
= EG (uninitialized_zval_ptr
);
9090 local_this
->refcount
++;
9092 zval
** p_obj
= &local_this
;
9095 INIT_ZVAL (field_name
);
9096 ZVAL_STRING (&field_name
, "mLinks", 0);
9098 zval
** field
= Z_OBJ_HT_PP(p_obj
)->get_property_ptr_ptr(*p_obj
, &field_name TSRMLS_CC
);
9099 sep_copy_on_write (field
);
9100 if (local_TSt56
== NULL
)
9102 local_TSt56
= EG (uninitialized_zval_ptr
);
9103 local_TSt56
->refcount
++;
9105 zval
** p_lhs
= &local_TSt56
;
9107 copy_into_ref (p_lhs
, field
);
9108 phc_check_invariants (TSRMLS_C
);
9112 if (local_TSa57
!= NULL
)
9114 zval_ptr_dtor (&local_TSa57
);
9117 phc_check_invariants (TSRMLS_C
);
9119 // $TSa57 = (array) $TSa57;
9121 if (local_TSa57
== NULL
)
9123 local_TSa57
= EG (uninitialized_zval_ptr
);
9124 local_TSa57
->refcount
++;
9126 zval
** p_lhs
= &local_TSa57
;
9129 if (local_TSa57
== NULL
)
9130 rhs
= EG (uninitialized_zval_ptr
);
9136 if ((*p_lhs
)->is_ref
)
9137 overwrite_lhs (*p_lhs
, rhs
);
9140 zval_ptr_dtor (p_lhs
);
9143 // Take a copy of RHS for LHS
9144 *p_lhs
= zvp_clone_ex (rhs
);
9157 assert (IS_ARRAY
>= 0 && IS_ARRAY
<= 6);
9158 if ((*p_lhs
)->type
!= IS_ARRAY
)
9160 sep_copy_on_write (p_lhs
);
9161 convert_to_array (*p_lhs
);
9164 phc_check_invariants (TSRMLS_C
);
9166 // $TSt56[$ns] = $TSa57;
9168 if (local_TSt56
== NULL
)
9170 local_TSt56
= EG (uninitialized_zval_ptr
);
9171 local_TSt56
->refcount
++;
9173 zval
** p_array
= &local_TSt56
;
9175 check_array_type (p_array TSRMLS_CC
);
9178 if (local_ns
== NULL
)
9179 index
= EG (uninitialized_zval_ptr
);
9185 if (Z_TYPE_PP (p_array
) == IS_STRING
&& Z_STRLEN_PP (p_array
) > 0)
9188 if (local_TSa57
== NULL
)
9189 rhs
= EG (uninitialized_zval_ptr
);
9193 write_string_index (p_array
, index
, rhs TSRMLS_CC
);
9195 else if (Z_TYPE_PP (p_array
) == IS_ARRAY
)
9197 zval
** p_lhs
= get_ht_entry (p_array
, index TSRMLS_CC
);
9199 if (local_TSa57
== NULL
)
9200 rhs
= EG (uninitialized_zval_ptr
);
9206 write_var (p_lhs
, rhs
);
9209 phc_check_invariants (TSRMLS_C
);
9214 phc_check_invariants (TSRMLS_C
);
9221 phc_check_invariants (TSRMLS_C
);
9225 // $TLE58 = is_null($id);
9227 initialize_function_call (&is_null_fci
, &is_null_fcic
, "is_null", "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 104 TSRMLS_CC
);
9228 zend_function
* signature
= is_null_fcic
.function_handler
;
9229 zend_arg_info
* arg_info
= signature
->common
.arg_info
; // optional
9233 // TODO: find names to replace index
9236 by_ref
[abr_index
] = arg_info
->pass_by_reference
;
9240 by_ref
[abr_index
] = signature
->common
.pass_rest_by_reference
;
9245 // Setup array of arguments
9246 // TODO: i think arrays of size 0 is an error
9249 zval
** args_ind
[1];
9252 destruct
[af_index
] = 0;
9253 if (by_ref
[af_index
])
9255 if (local_id
== NULL
)
9257 local_id
= EG (uninitialized_zval_ptr
);
9258 local_id
->refcount
++;
9260 zval
** p_arg
= &local_id
;
9262 args_ind
[af_index
] = fetch_var_arg_by_ref (p_arg
);
9263 assert (!in_copy_on_write (*args_ind
[af_index
]));
9264 args
[af_index
] = *args_ind
[af_index
];
9269 if (local_id
== NULL
)
9270 arg
= EG (uninitialized_zval_ptr
);
9274 args
[af_index
] = fetch_var_arg (arg
, &destruct
[af_index
]);
9275 args_ind
[af_index
] = &args
[af_index
];
9280 phc_setup_error (1, "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 104, NULL TSRMLS_CC
);
9282 // save existing parameters, in case of recursion
9283 int param_count_save
= is_null_fci
.param_count
;
9284 zval
*** params_save
= is_null_fci
.params
;
9285 zval
** retval_save
= is_null_fci
.retval_ptr_ptr
;
9290 is_null_fci
.params
= args_ind
;
9291 is_null_fci
.param_count
= 1;
9292 is_null_fci
.retval_ptr_ptr
= &rhs
;
9294 // call the function
9295 int success
= zend_call_function (&is_null_fci
, &is_null_fcic TSRMLS_CC
);
9296 assert(success
== SUCCESS
);
9299 is_null_fci
.params
= params_save
;
9300 is_null_fci
.param_count
= param_count_save
;
9301 is_null_fci
.retval_ptr_ptr
= retval_save
;
9304 phc_setup_error (0, NULL
, 0, NULL TSRMLS_CC
);
9307 for (i
= 0; i
< 1; i
++)
9311 assert (destruct
[i
]);
9312 zval_ptr_dtor (args_ind
[i
]);
9317 // When the Zend engine returns by reference, it allocates a zval into
9318 // retval_ptr_ptr. To return by reference, the callee writes into the
9319 // retval_ptr_ptr, freeing the allocated value as it does. (Note, it may
9320 // not actually return anything). So the zval returned - whether we return
9321 // it, or it is the allocated zval - has a refcount of 1.
9323 // The caller is responsible for cleaning that up (note, this is unaffected
9324 // by whether it is added to some COW set).
9326 // For reasons unknown, the Zend API resets the refcount and is_ref fields
9327 // of the return value after the function returns (unless the callee is
9328 // interpreted). If the function is supposed to return by reference, this
9329 // loses the refcount. This only happens when non-interpreted code is
9330 // called. We work around it, when compiled code is called, by saving the
9331 // refcount into SAVED_REFCOUNT, in the return statement. The downside is
9332 // that we may create an error if our code is called by a callback, and
9333 // returns by reference, and the callback returns by reference. At least
9334 // this is an obscure case.
9335 if(signature
->common
.return_reference
&& signature
->type
!= ZEND_USER_FUNCTION
)
9337 assert (rhs
!= EG(uninitialized_zval_ptr
));
9339 if (saved_refcount
!= 0)
9341 rhs
->refcount
= saved_refcount
;
9345 saved_refcount
= 0; // for 'obscure cases'
9347 if (local_TLE58
== NULL
)
9349 local_TLE58
= EG (uninitialized_zval_ptr
);
9350 local_TLE58
->refcount
++;
9352 zval
** p_lhs
= &local_TLE58
;
9354 write_var (p_lhs
, rhs
);
9357 zval_ptr_dtor (&rhs
);
9358 if(signature
->common
.return_reference
&& signature
->type
!= ZEND_USER_FUNCTION
)
9359 zval_ptr_dtor (&rhs
);
9361 phc_check_invariants (TSRMLS_C
);
9363 // if (TLE58) goto L170 else goto L171;
9366 if (local_TLE58
== NULL
)
9367 p_cond
= EG (uninitialized_zval_ptr
);
9369 p_cond
= local_TLE58
;
9371 zend_bool bcond
= zend_is_true (p_cond
);
9376 phc_check_invariants (TSRMLS_C
);
9380 // $id = $title->getarticleid();
9382 if (local_title
== NULL
)
9384 local_title
= EG (uninitialized_zval_ptr
);
9385 local_title
->refcount
++;
9387 zval
** p_obj
= &local_title
;
9389 zend_fcall_info fci_object
;
9390 zend_fcall_info_cache fcic_object
= {0, NULL
, NULL
, NULL
};
9391 initialize_method_call (&fci_object
, &fcic_object
, p_obj
, "getarticleid", "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 105 TSRMLS_CC
);
9392 zend_function
* signature
= fcic_object
.function_handler
;
9393 zend_arg_info
* arg_info
= signature
->common
.arg_info
; // optional
9399 // Setup array of arguments
9400 // TODO: i think arrays of size 0 is an error
9403 zval
** args_ind
[0];
9408 phc_setup_error (1, "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 105, NULL TSRMLS_CC
);
9410 // save existing parameters, in case of recursion
9411 int param_count_save
= fci_object
.param_count
;
9412 zval
*** params_save
= fci_object
.params
;
9413 zval
** retval_save
= fci_object
.retval_ptr_ptr
;
9418 fci_object
.params
= args_ind
;
9419 fci_object
.param_count
= 0;
9420 fci_object
.retval_ptr_ptr
= &rhs
;
9422 // call the function
9423 int success
= zend_call_function (&fci_object
, &fcic_object TSRMLS_CC
);
9424 assert(success
== SUCCESS
);
9427 fci_object
.params
= params_save
;
9428 fci_object
.param_count
= param_count_save
;
9429 fci_object
.retval_ptr_ptr
= retval_save
;
9432 phc_setup_error (0, NULL
, 0, NULL TSRMLS_CC
);
9435 for (i
= 0; i
< 0; i
++)
9439 assert (destruct
[i
]);
9440 zval_ptr_dtor (args_ind
[i
]);
9445 // When the Zend engine returns by reference, it allocates a zval into
9446 // retval_ptr_ptr. To return by reference, the callee writes into the
9447 // retval_ptr_ptr, freeing the allocated value as it does. (Note, it may
9448 // not actually return anything). So the zval returned - whether we return
9449 // it, or it is the allocated zval - has a refcount of 1.
9451 // The caller is responsible for cleaning that up (note, this is unaffected
9452 // by whether it is added to some COW set).
9454 // For reasons unknown, the Zend API resets the refcount and is_ref fields
9455 // of the return value after the function returns (unless the callee is
9456 // interpreted). If the function is supposed to return by reference, this
9457 // loses the refcount. This only happens when non-interpreted code is
9458 // called. We work around it, when compiled code is called, by saving the
9459 // refcount into SAVED_REFCOUNT, in the return statement. The downside is
9460 // that we may create an error if our code is called by a callback, and
9461 // returns by reference, and the callback returns by reference. At least
9462 // this is an obscure case.
9463 if(signature
->common
.return_reference
&& signature
->type
!= ZEND_USER_FUNCTION
)
9465 assert (rhs
!= EG(uninitialized_zval_ptr
));
9467 if (saved_refcount
!= 0)
9469 rhs
->refcount
= saved_refcount
;
9473 saved_refcount
= 0; // for 'obscure cases'
9475 if (local_id
== NULL
)
9477 local_id
= EG (uninitialized_zval_ptr
);
9478 local_id
->refcount
++;
9480 zval
** p_lhs
= &local_id
;
9482 write_var (p_lhs
, rhs
);
9485 zval_ptr_dtor (&rhs
);
9486 if(signature
->common
.return_reference
&& signature
->type
!= ZEND_USER_FUNCTION
)
9487 zval_ptr_dtor (&rhs
);
9489 phc_check_invariants (TSRMLS_C
);
9494 phc_check_invariants (TSRMLS_C
);
9501 phc_check_invariants (TSRMLS_C
);
9505 // $TSt59 =& $this->mLinks;
9507 if (local_this
== NULL
)
9509 local_this
= EG (uninitialized_zval_ptr
);
9510 local_this
->refcount
++;
9512 zval
** p_obj
= &local_this
;
9515 INIT_ZVAL (field_name
);
9516 ZVAL_STRING (&field_name
, "mLinks", 0);
9518 zval
** field
= Z_OBJ_HT_PP(p_obj
)->get_property_ptr_ptr(*p_obj
, &field_name TSRMLS_CC
);
9519 sep_copy_on_write (field
);
9520 if (local_TSt59
== NULL
)
9522 local_TSt59
= EG (uninitialized_zval_ptr
);
9523 local_TSt59
->refcount
++;
9525 zval
** p_lhs
= &local_TSt59
;
9527 copy_into_ref (p_lhs
, field
);
9528 phc_check_invariants (TSRMLS_C
);
9530 // $TSi60 =& $TSt59[$ns];
9532 if (local_TSi60
== NULL
)
9534 local_TSi60
= EG (uninitialized_zval_ptr
);
9535 local_TSi60
->refcount
++;
9537 zval
** p_lhs
= &local_TSi60
;
9539 if (local_TSt59
== NULL
)
9541 local_TSt59
= EG (uninitialized_zval_ptr
);
9542 local_TSt59
->refcount
++;
9544 zval
** p_r_array
= &local_TSt59
;
9547 if (local_ns
== NULL
)
9548 r_index
= EG (uninitialized_zval_ptr
);
9552 check_array_type (p_r_array TSRMLS_CC
);
9553 zval
** p_rhs
= get_ht_entry (p_r_array
, r_index TSRMLS_CC
);
9554 sep_copy_on_write (p_rhs
);
9555 copy_into_ref (p_lhs
, p_rhs
);
9556 phc_check_invariants (TSRMLS_C
);
9558 // $TSi60[$dbk] = $id;
9560 if (local_TSi60
== NULL
)
9562 local_TSi60
= EG (uninitialized_zval_ptr
);
9563 local_TSi60
->refcount
++;
9565 zval
** p_array
= &local_TSi60
;
9567 check_array_type (p_array TSRMLS_CC
);
9570 if (local_dbk
== NULL
)
9571 index
= EG (uninitialized_zval_ptr
);
9577 if (Z_TYPE_PP (p_array
) == IS_STRING
&& Z_STRLEN_PP (p_array
) > 0)
9580 if (local_id
== NULL
)
9581 rhs
= EG (uninitialized_zval_ptr
);
9585 write_string_index (p_array
, index
, rhs TSRMLS_CC
);
9587 else if (Z_TYPE_PP (p_array
) == IS_ARRAY
)
9589 zval
** p_lhs
= get_ht_entry (p_array
, index TSRMLS_CC
);
9591 if (local_id
== NULL
)
9592 rhs
= EG (uninitialized_zval_ptr
);
9598 write_var (p_lhs
, rhs
);
9601 phc_check_invariants (TSRMLS_C
);
9604 end_of_function
:__attribute__((unused
));
9605 if (local_TLE46
!= NULL
)
9607 zval_ptr_dtor (&local_TLE46
);
9609 if (local_TLE47
!= NULL
)
9611 zval_ptr_dtor (&local_TLE47
);
9613 if (local_TLE48
!= NULL
)
9615 zval_ptr_dtor (&local_TLE48
);
9617 if (local_TLE49
!= NULL
)
9619 zval_ptr_dtor (&local_TLE49
);
9621 if (local_TLE50
!= NULL
)
9623 zval_ptr_dtor (&local_TLE50
);
9625 if (local_TLE51
!= NULL
)
9627 zval_ptr_dtor (&local_TLE51
);
9629 if (local_TLE52
!= NULL
)
9631 zval_ptr_dtor (&local_TLE52
);
9633 if (local_TLE53
!= NULL
)
9635 zval_ptr_dtor (&local_TLE53
);
9637 if (local_TLE54
!= NULL
)
9639 zval_ptr_dtor (&local_TLE54
);
9641 if (local_TLE55
!= NULL
)
9643 zval_ptr_dtor (&local_TLE55
);
9645 if (local_TLE58
!= NULL
)
9647 zval_ptr_dtor (&local_TLE58
);
9649 if (local_TMIt119
!= NULL
)
9651 zval_ptr_dtor (&local_TMIt119
);
9653 if (local_TSa57
!= NULL
)
9655 zval_ptr_dtor (&local_TSa57
);
9657 if (local_TSi60
!= NULL
)
9659 zval_ptr_dtor (&local_TSi60
);
9661 if (local_TSt56
!= NULL
)
9663 zval_ptr_dtor (&local_TSt56
);
9665 if (local_TSt59
!= NULL
)
9667 zval_ptr_dtor (&local_TSt59
);
9669 if (local_dbk
!= NULL
)
9671 zval_ptr_dtor (&local_dbk
);
9673 if (local_id
!= NULL
)
9675 zval_ptr_dtor (&local_id
);
9677 if (local_ns
!= NULL
)
9679 zval_ptr_dtor (&local_ns
);
9681 if (local_title
!= NULL
)
9683 zval_ptr_dtor (&local_title
);
9686 // function addimage($name)
9688 // $TSt61 =& $this->mImages;
9690 // $TSt61[$name] = $TLE62;
9692 PHP_METHOD(ParserOutput
, addimage
)
9694 zval
* local_TLE62
= NULL
;
9695 zval
* local_TSt61
= NULL
;
9696 zval
* local_name
= NULL
;
9697 zval
* local_this
= getThis();
9698 // Add all parameters as local variables
9700 int num_args
= ZEND_NUM_ARGS ();
9702 zend_get_parameters_array(0, num_args
, params
);
9704 params
[0]->refcount
++;
9705 if (local_name
!= NULL
)
9707 zval_ptr_dtor (&local_name
);
9709 local_name
= params
[0];
9712 // $TSt61 =& $this->mImages;
9714 if (local_this
== NULL
)
9716 local_this
= EG (uninitialized_zval_ptr
);
9717 local_this
->refcount
++;
9719 zval
** p_obj
= &local_this
;
9722 INIT_ZVAL (field_name
);
9723 ZVAL_STRING (&field_name
, "mImages", 0);
9725 zval
** field
= Z_OBJ_HT_PP(p_obj
)->get_property_ptr_ptr(*p_obj
, &field_name TSRMLS_CC
);
9726 sep_copy_on_write (field
);
9727 if (local_TSt61
== NULL
)
9729 local_TSt61
= EG (uninitialized_zval_ptr
);
9730 local_TSt61
->refcount
++;
9732 zval
** p_lhs
= &local_TSt61
;
9734 copy_into_ref (p_lhs
, field
);
9735 phc_check_invariants (TSRMLS_C
);
9739 if (local_TLE62
== NULL
)
9741 local_TLE62
= EG (uninitialized_zval_ptr
);
9742 local_TLE62
->refcount
++;
9744 zval
** p_lhs
= &local_TLE62
;
9747 if ((*p_lhs
)->is_ref
)
9749 // Always overwrite the current value
9755 ALLOC_INIT_ZVAL (value
);
9756 zval_ptr_dtor (p_lhs
);
9760 ZVAL_LONG (value
, 1);
9762 phc_check_invariants (TSRMLS_C
);
9764 // $TSt61[$name] = $TLE62;
9766 if (local_TSt61
== NULL
)
9768 local_TSt61
= EG (uninitialized_zval_ptr
);
9769 local_TSt61
->refcount
++;
9771 zval
** p_array
= &local_TSt61
;
9773 check_array_type (p_array TSRMLS_CC
);
9776 if (local_name
== NULL
)
9777 index
= EG (uninitialized_zval_ptr
);
9783 if (Z_TYPE_PP (p_array
) == IS_STRING
&& Z_STRLEN_PP (p_array
) > 0)
9786 if (local_TLE62
== NULL
)
9787 rhs
= EG (uninitialized_zval_ptr
);
9791 write_string_index (p_array
, index
, rhs TSRMLS_CC
);
9793 else if (Z_TYPE_PP (p_array
) == IS_ARRAY
)
9795 zval
** p_lhs
= get_ht_entry (p_array
, index TSRMLS_CC
);
9797 if (local_TLE62
== NULL
)
9798 rhs
= EG (uninitialized_zval_ptr
);
9804 write_var (p_lhs
, rhs
);
9807 phc_check_invariants (TSRMLS_C
);
9810 end_of_function
:__attribute__((unused
));
9811 if (local_TLE62
!= NULL
)
9813 zval_ptr_dtor (&local_TLE62
);
9815 if (local_TSt61
!= NULL
)
9817 zval_ptr_dtor (&local_TSt61
);
9819 if (local_name
!= NULL
)
9821 zval_ptr_dtor (&local_name
);
9824 // function addtemplate($title, $page_id, $rev_id)
9826 // $ns = $title->getnamespace();
9827 // $dbk = $title->getdbkey();
9828 // $TMIt120 = $this->mTemplates;
9829 // $TLE63 = isset($TMIt120[$ns]);
9830 // $TLE64 = !$TLE63;
9831 // if (TLE64) goto L173 else goto L174;
9833 // $TSt65 =& $this->mTemplates;
9835 // $TSa66 = (array) $TSa66;
9836 // $TSt65[$ns] = $TSa66;
9841 // $TSt67 =& $this->mTemplates;
9842 // $TSi68 =& $TSt67[$ns];
9843 // $TSi68[$dbk] = $page_id;
9844 // $TMIt121 = $this->mTemplateIds;
9845 // $TLE69 = isset($TMIt121[$ns]);
9846 // $TLE70 = !$TLE69;
9847 // if (TLE70) goto L176 else goto L177;
9849 // $TSt71 =& $this->mTemplateIds;
9851 // $TSa72 = (array) $TSa72;
9852 // $TSt71[$ns] = $TSa72;
9857 // $TSt73 =& $this->mTemplateIds;
9858 // $TSi74 =& $TSt73[$ns];
9859 // $TSi74[$dbk] = $rev_id;
9861 PHP_METHOD(ParserOutput
, addtemplate
)
9863 zval
* local_TLE63
= NULL
;
9864 zval
* local_TLE64
= NULL
;
9865 zval
* local_TLE69
= NULL
;
9866 zval
* local_TLE70
= NULL
;
9867 zval
* local_TMIt120
= NULL
;
9868 zval
* local_TMIt121
= NULL
;
9869 zval
* local_TSa66
= NULL
;
9870 zval
* local_TSa72
= NULL
;
9871 zval
* local_TSi68
= NULL
;
9872 zval
* local_TSi74
= NULL
;
9873 zval
* local_TSt65
= NULL
;
9874 zval
* local_TSt67
= NULL
;
9875 zval
* local_TSt71
= NULL
;
9876 zval
* local_TSt73
= NULL
;
9877 zval
* local_dbk
= NULL
;
9878 zval
* local_ns
= NULL
;
9879 zval
* local_page_id
= NULL
;
9880 zval
* local_rev_id
= NULL
;
9881 zval
* local_this
= getThis();
9882 zval
* local_title
= NULL
;
9883 // Add all parameters as local variables
9885 int num_args
= ZEND_NUM_ARGS ();
9887 zend_get_parameters_array(0, num_args
, params
);
9889 params
[0]->refcount
++;
9890 if (local_title
!= NULL
)
9892 zval_ptr_dtor (&local_title
);
9894 local_title
= params
[0];
9896 params
[1]->refcount
++;
9897 if (local_page_id
!= NULL
)
9899 zval_ptr_dtor (&local_page_id
);
9901 local_page_id
= params
[1];
9903 params
[2]->refcount
++;
9904 if (local_rev_id
!= NULL
)
9906 zval_ptr_dtor (&local_rev_id
);
9908 local_rev_id
= params
[2];
9911 // $ns = $title->getnamespace();
9913 if (local_title
== NULL
)
9915 local_title
= EG (uninitialized_zval_ptr
);
9916 local_title
->refcount
++;
9918 zval
** p_obj
= &local_title
;
9920 zend_fcall_info fci_object
;
9921 zend_fcall_info_cache fcic_object
= {0, NULL
, NULL
, NULL
};
9922 initialize_method_call (&fci_object
, &fcic_object
, p_obj
, "getnamespace", "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 115 TSRMLS_CC
);
9923 zend_function
* signature
= fcic_object
.function_handler
;
9924 zend_arg_info
* arg_info
= signature
->common
.arg_info
; // optional
9930 // Setup array of arguments
9931 // TODO: i think arrays of size 0 is an error
9934 zval
** args_ind
[0];
9939 phc_setup_error (1, "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 115, NULL TSRMLS_CC
);
9941 // save existing parameters, in case of recursion
9942 int param_count_save
= fci_object
.param_count
;
9943 zval
*** params_save
= fci_object
.params
;
9944 zval
** retval_save
= fci_object
.retval_ptr_ptr
;
9949 fci_object
.params
= args_ind
;
9950 fci_object
.param_count
= 0;
9951 fci_object
.retval_ptr_ptr
= &rhs
;
9953 // call the function
9954 int success
= zend_call_function (&fci_object
, &fcic_object TSRMLS_CC
);
9955 assert(success
== SUCCESS
);
9958 fci_object
.params
= params_save
;
9959 fci_object
.param_count
= param_count_save
;
9960 fci_object
.retval_ptr_ptr
= retval_save
;
9963 phc_setup_error (0, NULL
, 0, NULL TSRMLS_CC
);
9966 for (i
= 0; i
< 0; i
++)
9970 assert (destruct
[i
]);
9971 zval_ptr_dtor (args_ind
[i
]);
9976 // When the Zend engine returns by reference, it allocates a zval into
9977 // retval_ptr_ptr. To return by reference, the callee writes into the
9978 // retval_ptr_ptr, freeing the allocated value as it does. (Note, it may
9979 // not actually return anything). So the zval returned - whether we return
9980 // it, or it is the allocated zval - has a refcount of 1.
9982 // The caller is responsible for cleaning that up (note, this is unaffected
9983 // by whether it is added to some COW set).
9985 // For reasons unknown, the Zend API resets the refcount and is_ref fields
9986 // of the return value after the function returns (unless the callee is
9987 // interpreted). If the function is supposed to return by reference, this
9988 // loses the refcount. This only happens when non-interpreted code is
9989 // called. We work around it, when compiled code is called, by saving the
9990 // refcount into SAVED_REFCOUNT, in the return statement. The downside is
9991 // that we may create an error if our code is called by a callback, and
9992 // returns by reference, and the callback returns by reference. At least
9993 // this is an obscure case.
9994 if(signature
->common
.return_reference
&& signature
->type
!= ZEND_USER_FUNCTION
)
9996 assert (rhs
!= EG(uninitialized_zval_ptr
));
9998 if (saved_refcount
!= 0)
10000 rhs
->refcount
= saved_refcount
;
10004 saved_refcount
= 0; // for 'obscure cases'
10006 if (local_ns
== NULL
)
10008 local_ns
= EG (uninitialized_zval_ptr
);
10009 local_ns
->refcount
++;
10011 zval
** p_lhs
= &local_ns
;
10013 write_var (p_lhs
, rhs
);
10016 zval_ptr_dtor (&rhs
);
10017 if(signature
->common
.return_reference
&& signature
->type
!= ZEND_USER_FUNCTION
)
10018 zval_ptr_dtor (&rhs
);
10020 phc_check_invariants (TSRMLS_C
);
10022 // $dbk = $title->getdbkey();
10024 if (local_title
== NULL
)
10026 local_title
= EG (uninitialized_zval_ptr
);
10027 local_title
->refcount
++;
10029 zval
** p_obj
= &local_title
;
10031 zend_fcall_info fci_object
;
10032 zend_fcall_info_cache fcic_object
= {0, NULL
, NULL
, NULL
};
10033 initialize_method_call (&fci_object
, &fcic_object
, p_obj
, "getdbkey", "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 116 TSRMLS_CC
);
10034 zend_function
* signature
= fcic_object
.function_handler
;
10035 zend_arg_info
* arg_info
= signature
->common
.arg_info
; // optional
10041 // Setup array of arguments
10042 // TODO: i think arrays of size 0 is an error
10045 zval
** args_ind
[0];
10050 phc_setup_error (1, "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 116, NULL TSRMLS_CC
);
10052 // save existing parameters, in case of recursion
10053 int param_count_save
= fci_object
.param_count
;
10054 zval
*** params_save
= fci_object
.params
;
10055 zval
** retval_save
= fci_object
.retval_ptr_ptr
;
10060 fci_object
.params
= args_ind
;
10061 fci_object
.param_count
= 0;
10062 fci_object
.retval_ptr_ptr
= &rhs
;
10064 // call the function
10065 int success
= zend_call_function (&fci_object
, &fcic_object TSRMLS_CC
);
10066 assert(success
== SUCCESS
);
10069 fci_object
.params
= params_save
;
10070 fci_object
.param_count
= param_count_save
;
10071 fci_object
.retval_ptr_ptr
= retval_save
;
10073 // unset the errors
10074 phc_setup_error (0, NULL
, 0, NULL TSRMLS_CC
);
10077 for (i
= 0; i
< 0; i
++)
10081 assert (destruct
[i
]);
10082 zval_ptr_dtor (args_ind
[i
]);
10087 // When the Zend engine returns by reference, it allocates a zval into
10088 // retval_ptr_ptr. To return by reference, the callee writes into the
10089 // retval_ptr_ptr, freeing the allocated value as it does. (Note, it may
10090 // not actually return anything). So the zval returned - whether we return
10091 // it, or it is the allocated zval - has a refcount of 1.
10093 // The caller is responsible for cleaning that up (note, this is unaffected
10094 // by whether it is added to some COW set).
10096 // For reasons unknown, the Zend API resets the refcount and is_ref fields
10097 // of the return value after the function returns (unless the callee is
10098 // interpreted). If the function is supposed to return by reference, this
10099 // loses the refcount. This only happens when non-interpreted code is
10100 // called. We work around it, when compiled code is called, by saving the
10101 // refcount into SAVED_REFCOUNT, in the return statement. The downside is
10102 // that we may create an error if our code is called by a callback, and
10103 // returns by reference, and the callback returns by reference. At least
10104 // this is an obscure case.
10105 if(signature
->common
.return_reference
&& signature
->type
!= ZEND_USER_FUNCTION
)
10107 assert (rhs
!= EG(uninitialized_zval_ptr
));
10109 if (saved_refcount
!= 0)
10111 rhs
->refcount
= saved_refcount
;
10115 saved_refcount
= 0; // for 'obscure cases'
10117 if (local_dbk
== NULL
)
10119 local_dbk
= EG (uninitialized_zval_ptr
);
10120 local_dbk
->refcount
++;
10122 zval
** p_lhs
= &local_dbk
;
10124 write_var (p_lhs
, rhs
);
10127 zval_ptr_dtor (&rhs
);
10128 if(signature
->common
.return_reference
&& signature
->type
!= ZEND_USER_FUNCTION
)
10129 zval_ptr_dtor (&rhs
);
10131 phc_check_invariants (TSRMLS_C
);
10133 // $TMIt120 = $this->mTemplates;
10135 if (local_this
== NULL
)
10137 local_this
= EG (uninitialized_zval_ptr
);
10138 local_this
->refcount
++;
10140 zval
** p_obj
= &local_this
;
10143 INIT_ZVAL (field_name
);
10144 ZVAL_STRING (&field_name
, "mTemplates", 0);
10146 // I *think* this is correct, but documentation of the Zend API is scarce :)
10147 zval
* field
= Z_OBJ_HT_PP(p_obj
)->read_property(*p_obj
, &field_name
, BP_VAR_R TSRMLS_CC
);
10148 if (local_TMIt120
== NULL
)
10150 local_TMIt120
= EG (uninitialized_zval_ptr
);
10151 local_TMIt120
->refcount
++;
10153 zval
** p_lhs
= &local_TMIt120
;
10155 write_var (p_lhs
, field
);
10156 phc_check_invariants (TSRMLS_C
);
10158 // $TLE63 = isset($TMIt120[$ns]);
10160 if (local_TLE63
== NULL
)
10162 local_TLE63
= EG (uninitialized_zval_ptr
);
10163 local_TLE63
->refcount
++;
10165 zval
** p_lhs
= &local_TLE63
;
10167 if ((*p_lhs
)->is_ref
)
10169 // Always overwrite the current value
10175 ALLOC_INIT_ZVAL (value
);
10176 zval_ptr_dtor (p_lhs
);
10179 if (local_TMIt120
== NULL
)
10181 local_TMIt120
= EG (uninitialized_zval_ptr
);
10182 local_TMIt120
->refcount
++;
10184 zval
** u_array
= &local_TMIt120
;
10186 if (local_ns
== NULL
)
10188 u_index
= EG (uninitialized_zval_ptr
);
10192 u_index
= local_ns
;
10194 ZVAL_BOOL(value
, isset_array (u_array
, u_index
));
10195 phc_check_invariants (TSRMLS_C
);
10197 // $TLE64 = !$TLE63;
10199 if (local_TLE64
== NULL
)
10201 local_TLE64
= EG (uninitialized_zval_ptr
);
10202 local_TLE64
->refcount
++;
10204 zval
** p_lhs
= &local_TLE64
;
10207 if (local_TLE63
== NULL
)
10208 rhs
= EG (uninitialized_zval_ptr
);
10212 if (in_copy_on_write (*p_lhs
))
10214 zval_ptr_dtor (p_lhs
);
10215 ALLOC_INIT_ZVAL (*p_lhs
);
10218 zval old
= **p_lhs
;
10219 int result_is_operand
= (*p_lhs
== rhs
);
10220 boolean_not_function (*p_lhs
, rhs TSRMLS_CC
);
10221 if (!result_is_operand
)
10223 phc_check_invariants (TSRMLS_C
);
10225 // if (TLE64) goto L173 else goto L174;
10228 if (local_TLE64
== NULL
)
10229 p_cond
= EG (uninitialized_zval_ptr
);
10231 p_cond
= local_TLE64
;
10233 zend_bool bcond
= zend_is_true (p_cond
);
10238 phc_check_invariants (TSRMLS_C
);
10242 // $TSt65 =& $this->mTemplates;
10244 if (local_this
== NULL
)
10246 local_this
= EG (uninitialized_zval_ptr
);
10247 local_this
->refcount
++;
10249 zval
** p_obj
= &local_this
;
10252 INIT_ZVAL (field_name
);
10253 ZVAL_STRING (&field_name
, "mTemplates", 0);
10255 zval
** field
= Z_OBJ_HT_PP(p_obj
)->get_property_ptr_ptr(*p_obj
, &field_name TSRMLS_CC
);
10256 sep_copy_on_write (field
);
10257 if (local_TSt65
== NULL
)
10259 local_TSt65
= EG (uninitialized_zval_ptr
);
10260 local_TSt65
->refcount
++;
10262 zval
** p_lhs
= &local_TSt65
;
10264 copy_into_ref (p_lhs
, field
);
10265 phc_check_invariants (TSRMLS_C
);
10269 if (local_TSa66
!= NULL
)
10271 zval_ptr_dtor (&local_TSa66
);
10272 local_TSa66
= NULL
;
10274 phc_check_invariants (TSRMLS_C
);
10276 // $TSa66 = (array) $TSa66;
10278 if (local_TSa66
== NULL
)
10280 local_TSa66
= EG (uninitialized_zval_ptr
);
10281 local_TSa66
->refcount
++;
10283 zval
** p_lhs
= &local_TSa66
;
10286 if (local_TSa66
== NULL
)
10287 rhs
= EG (uninitialized_zval_ptr
);
10293 if ((*p_lhs
)->is_ref
)
10294 overwrite_lhs (*p_lhs
, rhs
);
10297 zval_ptr_dtor (p_lhs
);
10300 // Take a copy of RHS for LHS
10301 *p_lhs
= zvp_clone_ex (rhs
);
10314 assert (IS_ARRAY
>= 0 && IS_ARRAY
<= 6);
10315 if ((*p_lhs
)->type
!= IS_ARRAY
)
10317 sep_copy_on_write (p_lhs
);
10318 convert_to_array (*p_lhs
);
10321 phc_check_invariants (TSRMLS_C
);
10323 // $TSt65[$ns] = $TSa66;
10325 if (local_TSt65
== NULL
)
10327 local_TSt65
= EG (uninitialized_zval_ptr
);
10328 local_TSt65
->refcount
++;
10330 zval
** p_array
= &local_TSt65
;
10332 check_array_type (p_array TSRMLS_CC
);
10335 if (local_ns
== NULL
)
10336 index
= EG (uninitialized_zval_ptr
);
10342 if (Z_TYPE_PP (p_array
) == IS_STRING
&& Z_STRLEN_PP (p_array
) > 0)
10345 if (local_TSa66
== NULL
)
10346 rhs
= EG (uninitialized_zval_ptr
);
10350 write_string_index (p_array
, index
, rhs TSRMLS_CC
);
10352 else if (Z_TYPE_PP (p_array
) == IS_ARRAY
)
10354 zval
** p_lhs
= get_ht_entry (p_array
, index TSRMLS_CC
);
10356 if (local_TSa66
== NULL
)
10357 rhs
= EG (uninitialized_zval_ptr
);
10363 write_var (p_lhs
, rhs
);
10366 phc_check_invariants (TSRMLS_C
);
10371 phc_check_invariants (TSRMLS_C
);
10378 phc_check_invariants (TSRMLS_C
);
10382 // $TSt67 =& $this->mTemplates;
10384 if (local_this
== NULL
)
10386 local_this
= EG (uninitialized_zval_ptr
);
10387 local_this
->refcount
++;
10389 zval
** p_obj
= &local_this
;
10392 INIT_ZVAL (field_name
);
10393 ZVAL_STRING (&field_name
, "mTemplates", 0);
10395 zval
** field
= Z_OBJ_HT_PP(p_obj
)->get_property_ptr_ptr(*p_obj
, &field_name TSRMLS_CC
);
10396 sep_copy_on_write (field
);
10397 if (local_TSt67
== NULL
)
10399 local_TSt67
= EG (uninitialized_zval_ptr
);
10400 local_TSt67
->refcount
++;
10402 zval
** p_lhs
= &local_TSt67
;
10404 copy_into_ref (p_lhs
, field
);
10405 phc_check_invariants (TSRMLS_C
);
10407 // $TSi68 =& $TSt67[$ns];
10409 if (local_TSi68
== NULL
)
10411 local_TSi68
= EG (uninitialized_zval_ptr
);
10412 local_TSi68
->refcount
++;
10414 zval
** p_lhs
= &local_TSi68
;
10416 if (local_TSt67
== NULL
)
10418 local_TSt67
= EG (uninitialized_zval_ptr
);
10419 local_TSt67
->refcount
++;
10421 zval
** p_r_array
= &local_TSt67
;
10424 if (local_ns
== NULL
)
10425 r_index
= EG (uninitialized_zval_ptr
);
10427 r_index
= local_ns
;
10429 check_array_type (p_r_array TSRMLS_CC
);
10430 zval
** p_rhs
= get_ht_entry (p_r_array
, r_index TSRMLS_CC
);
10431 sep_copy_on_write (p_rhs
);
10432 copy_into_ref (p_lhs
, p_rhs
);
10433 phc_check_invariants (TSRMLS_C
);
10435 // $TSi68[$dbk] = $page_id;
10437 if (local_TSi68
== NULL
)
10439 local_TSi68
= EG (uninitialized_zval_ptr
);
10440 local_TSi68
->refcount
++;
10442 zval
** p_array
= &local_TSi68
;
10444 check_array_type (p_array TSRMLS_CC
);
10447 if (local_dbk
== NULL
)
10448 index
= EG (uninitialized_zval_ptr
);
10454 if (Z_TYPE_PP (p_array
) == IS_STRING
&& Z_STRLEN_PP (p_array
) > 0)
10457 if (local_page_id
== NULL
)
10458 rhs
= EG (uninitialized_zval_ptr
);
10460 rhs
= local_page_id
;
10462 write_string_index (p_array
, index
, rhs TSRMLS_CC
);
10464 else if (Z_TYPE_PP (p_array
) == IS_ARRAY
)
10466 zval
** p_lhs
= get_ht_entry (p_array
, index TSRMLS_CC
);
10468 if (local_page_id
== NULL
)
10469 rhs
= EG (uninitialized_zval_ptr
);
10471 rhs
= local_page_id
;
10475 write_var (p_lhs
, rhs
);
10478 phc_check_invariants (TSRMLS_C
);
10480 // $TMIt121 = $this->mTemplateIds;
10482 if (local_this
== NULL
)
10484 local_this
= EG (uninitialized_zval_ptr
);
10485 local_this
->refcount
++;
10487 zval
** p_obj
= &local_this
;
10490 INIT_ZVAL (field_name
);
10491 ZVAL_STRING (&field_name
, "mTemplateIds", 0);
10493 // I *think* this is correct, but documentation of the Zend API is scarce :)
10494 zval
* field
= Z_OBJ_HT_PP(p_obj
)->read_property(*p_obj
, &field_name
, BP_VAR_R TSRMLS_CC
);
10495 if (local_TMIt121
== NULL
)
10497 local_TMIt121
= EG (uninitialized_zval_ptr
);
10498 local_TMIt121
->refcount
++;
10500 zval
** p_lhs
= &local_TMIt121
;
10502 write_var (p_lhs
, field
);
10503 phc_check_invariants (TSRMLS_C
);
10505 // $TLE69 = isset($TMIt121[$ns]);
10507 if (local_TLE69
== NULL
)
10509 local_TLE69
= EG (uninitialized_zval_ptr
);
10510 local_TLE69
->refcount
++;
10512 zval
** p_lhs
= &local_TLE69
;
10514 if ((*p_lhs
)->is_ref
)
10516 // Always overwrite the current value
10522 ALLOC_INIT_ZVAL (value
);
10523 zval_ptr_dtor (p_lhs
);
10526 if (local_TMIt121
== NULL
)
10528 local_TMIt121
= EG (uninitialized_zval_ptr
);
10529 local_TMIt121
->refcount
++;
10531 zval
** u_array
= &local_TMIt121
;
10533 if (local_ns
== NULL
)
10535 u_index
= EG (uninitialized_zval_ptr
);
10539 u_index
= local_ns
;
10541 ZVAL_BOOL(value
, isset_array (u_array
, u_index
));
10542 phc_check_invariants (TSRMLS_C
);
10544 // $TLE70 = !$TLE69;
10546 if (local_TLE70
== NULL
)
10548 local_TLE70
= EG (uninitialized_zval_ptr
);
10549 local_TLE70
->refcount
++;
10551 zval
** p_lhs
= &local_TLE70
;
10554 if (local_TLE69
== NULL
)
10555 rhs
= EG (uninitialized_zval_ptr
);
10559 if (in_copy_on_write (*p_lhs
))
10561 zval_ptr_dtor (p_lhs
);
10562 ALLOC_INIT_ZVAL (*p_lhs
);
10565 zval old
= **p_lhs
;
10566 int result_is_operand
= (*p_lhs
== rhs
);
10567 boolean_not_function (*p_lhs
, rhs TSRMLS_CC
);
10568 if (!result_is_operand
)
10570 phc_check_invariants (TSRMLS_C
);
10572 // if (TLE70) goto L176 else goto L177;
10575 if (local_TLE70
== NULL
)
10576 p_cond
= EG (uninitialized_zval_ptr
);
10578 p_cond
= local_TLE70
;
10580 zend_bool bcond
= zend_is_true (p_cond
);
10585 phc_check_invariants (TSRMLS_C
);
10589 // $TSt71 =& $this->mTemplateIds;
10591 if (local_this
== NULL
)
10593 local_this
= EG (uninitialized_zval_ptr
);
10594 local_this
->refcount
++;
10596 zval
** p_obj
= &local_this
;
10599 INIT_ZVAL (field_name
);
10600 ZVAL_STRING (&field_name
, "mTemplateIds", 0);
10602 zval
** field
= Z_OBJ_HT_PP(p_obj
)->get_property_ptr_ptr(*p_obj
, &field_name TSRMLS_CC
);
10603 sep_copy_on_write (field
);
10604 if (local_TSt71
== NULL
)
10606 local_TSt71
= EG (uninitialized_zval_ptr
);
10607 local_TSt71
->refcount
++;
10609 zval
** p_lhs
= &local_TSt71
;
10611 copy_into_ref (p_lhs
, field
);
10612 phc_check_invariants (TSRMLS_C
);
10616 if (local_TSa72
!= NULL
)
10618 zval_ptr_dtor (&local_TSa72
);
10619 local_TSa72
= NULL
;
10621 phc_check_invariants (TSRMLS_C
);
10623 // $TSa72 = (array) $TSa72;
10625 if (local_TSa72
== NULL
)
10627 local_TSa72
= EG (uninitialized_zval_ptr
);
10628 local_TSa72
->refcount
++;
10630 zval
** p_lhs
= &local_TSa72
;
10633 if (local_TSa72
== NULL
)
10634 rhs
= EG (uninitialized_zval_ptr
);
10640 if ((*p_lhs
)->is_ref
)
10641 overwrite_lhs (*p_lhs
, rhs
);
10644 zval_ptr_dtor (p_lhs
);
10647 // Take a copy of RHS for LHS
10648 *p_lhs
= zvp_clone_ex (rhs
);
10661 assert (IS_ARRAY
>= 0 && IS_ARRAY
<= 6);
10662 if ((*p_lhs
)->type
!= IS_ARRAY
)
10664 sep_copy_on_write (p_lhs
);
10665 convert_to_array (*p_lhs
);
10668 phc_check_invariants (TSRMLS_C
);
10670 // $TSt71[$ns] = $TSa72;
10672 if (local_TSt71
== NULL
)
10674 local_TSt71
= EG (uninitialized_zval_ptr
);
10675 local_TSt71
->refcount
++;
10677 zval
** p_array
= &local_TSt71
;
10679 check_array_type (p_array TSRMLS_CC
);
10682 if (local_ns
== NULL
)
10683 index
= EG (uninitialized_zval_ptr
);
10689 if (Z_TYPE_PP (p_array
) == IS_STRING
&& Z_STRLEN_PP (p_array
) > 0)
10692 if (local_TSa72
== NULL
)
10693 rhs
= EG (uninitialized_zval_ptr
);
10697 write_string_index (p_array
, index
, rhs TSRMLS_CC
);
10699 else if (Z_TYPE_PP (p_array
) == IS_ARRAY
)
10701 zval
** p_lhs
= get_ht_entry (p_array
, index TSRMLS_CC
);
10703 if (local_TSa72
== NULL
)
10704 rhs
= EG (uninitialized_zval_ptr
);
10710 write_var (p_lhs
, rhs
);
10713 phc_check_invariants (TSRMLS_C
);
10718 phc_check_invariants (TSRMLS_C
);
10725 phc_check_invariants (TSRMLS_C
);
10729 // $TSt73 =& $this->mTemplateIds;
10731 if (local_this
== NULL
)
10733 local_this
= EG (uninitialized_zval_ptr
);
10734 local_this
->refcount
++;
10736 zval
** p_obj
= &local_this
;
10739 INIT_ZVAL (field_name
);
10740 ZVAL_STRING (&field_name
, "mTemplateIds", 0);
10742 zval
** field
= Z_OBJ_HT_PP(p_obj
)->get_property_ptr_ptr(*p_obj
, &field_name TSRMLS_CC
);
10743 sep_copy_on_write (field
);
10744 if (local_TSt73
== NULL
)
10746 local_TSt73
= EG (uninitialized_zval_ptr
);
10747 local_TSt73
->refcount
++;
10749 zval
** p_lhs
= &local_TSt73
;
10751 copy_into_ref (p_lhs
, field
);
10752 phc_check_invariants (TSRMLS_C
);
10754 // $TSi74 =& $TSt73[$ns];
10756 if (local_TSi74
== NULL
)
10758 local_TSi74
= EG (uninitialized_zval_ptr
);
10759 local_TSi74
->refcount
++;
10761 zval
** p_lhs
= &local_TSi74
;
10763 if (local_TSt73
== NULL
)
10765 local_TSt73
= EG (uninitialized_zval_ptr
);
10766 local_TSt73
->refcount
++;
10768 zval
** p_r_array
= &local_TSt73
;
10771 if (local_ns
== NULL
)
10772 r_index
= EG (uninitialized_zval_ptr
);
10774 r_index
= local_ns
;
10776 check_array_type (p_r_array TSRMLS_CC
);
10777 zval
** p_rhs
= get_ht_entry (p_r_array
, r_index TSRMLS_CC
);
10778 sep_copy_on_write (p_rhs
);
10779 copy_into_ref (p_lhs
, p_rhs
);
10780 phc_check_invariants (TSRMLS_C
);
10782 // $TSi74[$dbk] = $rev_id;
10784 if (local_TSi74
== NULL
)
10786 local_TSi74
= EG (uninitialized_zval_ptr
);
10787 local_TSi74
->refcount
++;
10789 zval
** p_array
= &local_TSi74
;
10791 check_array_type (p_array TSRMLS_CC
);
10794 if (local_dbk
== NULL
)
10795 index
= EG (uninitialized_zval_ptr
);
10801 if (Z_TYPE_PP (p_array
) == IS_STRING
&& Z_STRLEN_PP (p_array
) > 0)
10804 if (local_rev_id
== NULL
)
10805 rhs
= EG (uninitialized_zval_ptr
);
10807 rhs
= local_rev_id
;
10809 write_string_index (p_array
, index
, rhs TSRMLS_CC
);
10811 else if (Z_TYPE_PP (p_array
) == IS_ARRAY
)
10813 zval
** p_lhs
= get_ht_entry (p_array
, index TSRMLS_CC
);
10815 if (local_rev_id
== NULL
)
10816 rhs
= EG (uninitialized_zval_ptr
);
10818 rhs
= local_rev_id
;
10822 write_var (p_lhs
, rhs
);
10825 phc_check_invariants (TSRMLS_C
);
10828 end_of_function
:__attribute__((unused
));
10829 if (local_TLE63
!= NULL
)
10831 zval_ptr_dtor (&local_TLE63
);
10833 if (local_TLE64
!= NULL
)
10835 zval_ptr_dtor (&local_TLE64
);
10837 if (local_TLE69
!= NULL
)
10839 zval_ptr_dtor (&local_TLE69
);
10841 if (local_TLE70
!= NULL
)
10843 zval_ptr_dtor (&local_TLE70
);
10845 if (local_TMIt120
!= NULL
)
10847 zval_ptr_dtor (&local_TMIt120
);
10849 if (local_TMIt121
!= NULL
)
10851 zval_ptr_dtor (&local_TMIt121
);
10853 if (local_TSa66
!= NULL
)
10855 zval_ptr_dtor (&local_TSa66
);
10857 if (local_TSa72
!= NULL
)
10859 zval_ptr_dtor (&local_TSa72
);
10861 if (local_TSi68
!= NULL
)
10863 zval_ptr_dtor (&local_TSi68
);
10865 if (local_TSi74
!= NULL
)
10867 zval_ptr_dtor (&local_TSi74
);
10869 if (local_TSt65
!= NULL
)
10871 zval_ptr_dtor (&local_TSt65
);
10873 if (local_TSt67
!= NULL
)
10875 zval_ptr_dtor (&local_TSt67
);
10877 if (local_TSt71
!= NULL
)
10879 zval_ptr_dtor (&local_TSt71
);
10881 if (local_TSt73
!= NULL
)
10883 zval_ptr_dtor (&local_TSt73
);
10885 if (local_dbk
!= NULL
)
10887 zval_ptr_dtor (&local_dbk
);
10889 if (local_ns
!= NULL
)
10891 zval_ptr_dtor (&local_ns
);
10893 if (local_page_id
!= NULL
)
10895 zval_ptr_dtor (&local_page_id
);
10897 if (local_rev_id
!= NULL
)
10899 zval_ptr_dtor (&local_rev_id
);
10901 if (local_title
!= NULL
)
10903 zval_ptr_dtor (&local_title
);
10906 // function expired($touched)
10908 // global $wgCacheEpoch;
10909 // $TLE75 = $this->getcachetime();
10911 // $TLE0 = ($TLE75 == $TLE76);
10912 // if (TLE0) goto L179 else goto L180;
10917 // $TLE77 = $this->getcachetime();
10918 // $TEF1 = ($TLE77 < $touched);
10921 // $TLE2 = (bool) $TEF1;
10922 // if (TLE2) goto L182 else goto L183;
10927 // $TLE78 = $this->getcachetime();
10928 // $TEF3 = ($TLE78 <= $wgCacheEpoch);
10931 // $TLE4 = (bool) $TEF3;
10932 // if (TLE4) goto L185 else goto L186;
10937 // $TMIt122 = $this->mVersion;
10938 // $TLE79 = isset($TMIt122);
10939 // $TEF5 = !$TLE79;
10942 // $TLE6 = (bool) $TEF5;
10943 // if (TLE6) goto L191 else goto L192;
10948 // $TLE80 = Parser::VERSION;
10950 // $TLE124 = param_is_ref (NULL, "version_compare", 0);
10952 // if (TLE124) goto L188 else goto L189;
10954 // $TMIt123 =& $this->mVersion;
10957 // $TMIt123 = $this->mVersion;
10960 // $TEF7 = version_compare($TMIt123, $TLE80, $TLE81);
10963 // $TLE82 = (bool) $TEF7;
10966 PHP_METHOD(ParserOutput
, expired
)
10968 zval
* local_TEF1
= NULL
;
10969 zval
* local_TEF3
= NULL
;
10970 zval
* local_TEF5
= NULL
;
10971 zval
* local_TEF7
= NULL
;
10972 zval
* local_TLE0
= NULL
;
10973 zval
* local_TLE124
= NULL
;
10974 zval
* local_TLE2
= NULL
;
10975 zval
* local_TLE4
= NULL
;
10976 zval
* local_TLE6
= NULL
;
10977 zval
* local_TLE75
= NULL
;
10978 zval
* local_TLE76
= NULL
;
10979 zval
* local_TLE77
= NULL
;
10980 zval
* local_TLE78
= NULL
;
10981 zval
* local_TLE79
= NULL
;
10982 zval
* local_TLE80
= NULL
;
10983 zval
* local_TLE81
= NULL
;
10984 zval
* local_TLE82
= NULL
;
10985 zval
* local_TMIt122
= NULL
;
10986 zval
* local_TMIt123
= NULL
;
10987 zval
* local_this
= getThis();
10988 zval
* local_touched
= NULL
;
10989 zval
* local_wgCacheEpoch
= NULL
;
10990 // Add all parameters as local variables
10992 int num_args
= ZEND_NUM_ARGS ();
10994 zend_get_parameters_array(0, num_args
, params
);
10996 params
[0]->refcount
++;
10997 if (local_touched
!= NULL
)
10999 zval_ptr_dtor (&local_touched
);
11001 local_touched
= params
[0];
11004 // global $wgCacheEpoch;
11006 if (local_wgCacheEpoch
== NULL
)
11008 local_wgCacheEpoch
= EG (uninitialized_zval_ptr
);
11009 local_wgCacheEpoch
->refcount
++;
11011 zval
** p_local
= &local_wgCacheEpoch
;
11013 zval
** p_global
= get_st_entry (&EG(symbol_table
), "wgCacheEpoch", 12 + 1, 2181899014u TSRMLS_CC
);
11015 sep_copy_on_write (p_global
);
11016 copy_into_ref (p_local
, p_global
);
11017 phc_check_invariants (TSRMLS_C
);
11019 // $TLE75 = $this->getcachetime();
11021 if (local_this
== NULL
)
11023 local_this
= EG (uninitialized_zval_ptr
);
11024 local_this
->refcount
++;
11026 zval
** p_obj
= &local_this
;
11028 zend_fcall_info fci_object
;
11029 zend_fcall_info_cache fcic_object
= {0, NULL
, NULL
, NULL
};
11030 initialize_method_call (&fci_object
, &fcic_object
, p_obj
, "getcachetime", "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 138 TSRMLS_CC
);
11031 zend_function
* signature
= fcic_object
.function_handler
;
11032 zend_arg_info
* arg_info
= signature
->common
.arg_info
; // optional
11038 // Setup array of arguments
11039 // TODO: i think arrays of size 0 is an error
11042 zval
** args_ind
[0];
11047 phc_setup_error (1, "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 138, NULL TSRMLS_CC
);
11049 // save existing parameters, in case of recursion
11050 int param_count_save
= fci_object
.param_count
;
11051 zval
*** params_save
= fci_object
.params
;
11052 zval
** retval_save
= fci_object
.retval_ptr_ptr
;
11057 fci_object
.params
= args_ind
;
11058 fci_object
.param_count
= 0;
11059 fci_object
.retval_ptr_ptr
= &rhs
;
11061 // call the function
11062 int success
= zend_call_function (&fci_object
, &fcic_object TSRMLS_CC
);
11063 assert(success
== SUCCESS
);
11066 fci_object
.params
= params_save
;
11067 fci_object
.param_count
= param_count_save
;
11068 fci_object
.retval_ptr_ptr
= retval_save
;
11070 // unset the errors
11071 phc_setup_error (0, NULL
, 0, NULL TSRMLS_CC
);
11074 for (i
= 0; i
< 0; i
++)
11078 assert (destruct
[i
]);
11079 zval_ptr_dtor (args_ind
[i
]);
11084 // When the Zend engine returns by reference, it allocates a zval into
11085 // retval_ptr_ptr. To return by reference, the callee writes into the
11086 // retval_ptr_ptr, freeing the allocated value as it does. (Note, it may
11087 // not actually return anything). So the zval returned - whether we return
11088 // it, or it is the allocated zval - has a refcount of 1.
11090 // The caller is responsible for cleaning that up (note, this is unaffected
11091 // by whether it is added to some COW set).
11093 // For reasons unknown, the Zend API resets the refcount and is_ref fields
11094 // of the return value after the function returns (unless the callee is
11095 // interpreted). If the function is supposed to return by reference, this
11096 // loses the refcount. This only happens when non-interpreted code is
11097 // called. We work around it, when compiled code is called, by saving the
11098 // refcount into SAVED_REFCOUNT, in the return statement. The downside is
11099 // that we may create an error if our code is called by a callback, and
11100 // returns by reference, and the callback returns by reference. At least
11101 // this is an obscure case.
11102 if(signature
->common
.return_reference
&& signature
->type
!= ZEND_USER_FUNCTION
)
11104 assert (rhs
!= EG(uninitialized_zval_ptr
));
11106 if (saved_refcount
!= 0)
11108 rhs
->refcount
= saved_refcount
;
11112 saved_refcount
= 0; // for 'obscure cases'
11114 if (local_TLE75
== NULL
)
11116 local_TLE75
= EG (uninitialized_zval_ptr
);
11117 local_TLE75
->refcount
++;
11119 zval
** p_lhs
= &local_TLE75
;
11121 write_var (p_lhs
, rhs
);
11124 zval_ptr_dtor (&rhs
);
11125 if(signature
->common
.return_reference
&& signature
->type
!= ZEND_USER_FUNCTION
)
11126 zval_ptr_dtor (&rhs
);
11128 phc_check_invariants (TSRMLS_C
);
11132 if (local_TLE76
== NULL
)
11134 local_TLE76
= EG (uninitialized_zval_ptr
);
11135 local_TLE76
->refcount
++;
11137 zval
** p_lhs
= &local_TLE76
;
11140 if ((*p_lhs
)->is_ref
)
11142 // Always overwrite the current value
11148 ALLOC_INIT_ZVAL (value
);
11149 zval_ptr_dtor (p_lhs
);
11153 ZVAL_LONG (value
, -1);
11155 phc_check_invariants (TSRMLS_C
);
11157 // $TLE0 = ($TLE75 == $TLE76);
11159 if (local_TLE0
== NULL
)
11161 local_TLE0
= EG (uninitialized_zval_ptr
);
11162 local_TLE0
->refcount
++;
11164 zval
** p_lhs
= &local_TLE0
;
11167 if (local_TLE75
== NULL
)
11168 left
= EG (uninitialized_zval_ptr
);
11170 left
= local_TLE75
;
11173 if (local_TLE76
== NULL
)
11174 right
= EG (uninitialized_zval_ptr
);
11176 right
= local_TLE76
;
11178 if (in_copy_on_write (*p_lhs
))
11180 zval_ptr_dtor (p_lhs
);
11181 ALLOC_INIT_ZVAL (*p_lhs
);
11184 zval old
= **p_lhs
;
11185 int result_is_operand
= (*p_lhs
== left
|| *p_lhs
== right
);
11186 is_equal_function (*p_lhs
, left
, right TSRMLS_CC
);
11188 // If the result is one of the operands, the operator function
11189 // will already have cleaned up the result
11190 if (!result_is_operand
)
11192 phc_check_invariants (TSRMLS_C
);
11194 // if (TLE0) goto L179 else goto L180;
11197 if (local_TLE0
== NULL
)
11198 p_cond
= EG (uninitialized_zval_ptr
);
11200 p_cond
= local_TLE0
;
11202 zend_bool bcond
= zend_is_true (p_cond
);
11207 phc_check_invariants (TSRMLS_C
);
11213 if (local_TEF1
== NULL
)
11215 local_TEF1
= EG (uninitialized_zval_ptr
);
11216 local_TEF1
->refcount
++;
11218 zval
** p_lhs
= &local_TEF1
;
11221 if (local_TLE0
== NULL
)
11222 rhs
= EG (uninitialized_zval_ptr
);
11228 if ((*p_lhs
)->is_ref
)
11229 overwrite_lhs (*p_lhs
, rhs
);
11232 zval_ptr_dtor (p_lhs
);
11235 // Take a copy of RHS for LHS
11236 *p_lhs
= zvp_clone_ex (rhs
);
11248 phc_check_invariants (TSRMLS_C
);
11253 phc_check_invariants (TSRMLS_C
);
11257 // $TLE77 = $this->getcachetime();
11259 if (local_this
== NULL
)
11261 local_this
= EG (uninitialized_zval_ptr
);
11262 local_this
->refcount
++;
11264 zval
** p_obj
= &local_this
;
11266 zend_fcall_info fci_object
;
11267 zend_fcall_info_cache fcic_object
= {0, NULL
, NULL
, NULL
};
11268 initialize_method_call (&fci_object
, &fcic_object
, p_obj
, "getcachetime", "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 139 TSRMLS_CC
);
11269 zend_function
* signature
= fcic_object
.function_handler
;
11270 zend_arg_info
* arg_info
= signature
->common
.arg_info
; // optional
11276 // Setup array of arguments
11277 // TODO: i think arrays of size 0 is an error
11280 zval
** args_ind
[0];
11285 phc_setup_error (1, "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 139, NULL TSRMLS_CC
);
11287 // save existing parameters, in case of recursion
11288 int param_count_save
= fci_object
.param_count
;
11289 zval
*** params_save
= fci_object
.params
;
11290 zval
** retval_save
= fci_object
.retval_ptr_ptr
;
11295 fci_object
.params
= args_ind
;
11296 fci_object
.param_count
= 0;
11297 fci_object
.retval_ptr_ptr
= &rhs
;
11299 // call the function
11300 int success
= zend_call_function (&fci_object
, &fcic_object TSRMLS_CC
);
11301 assert(success
== SUCCESS
);
11304 fci_object
.params
= params_save
;
11305 fci_object
.param_count
= param_count_save
;
11306 fci_object
.retval_ptr_ptr
= retval_save
;
11308 // unset the errors
11309 phc_setup_error (0, NULL
, 0, NULL TSRMLS_CC
);
11312 for (i
= 0; i
< 0; i
++)
11316 assert (destruct
[i
]);
11317 zval_ptr_dtor (args_ind
[i
]);
11322 // When the Zend engine returns by reference, it allocates a zval into
11323 // retval_ptr_ptr. To return by reference, the callee writes into the
11324 // retval_ptr_ptr, freeing the allocated value as it does. (Note, it may
11325 // not actually return anything). So the zval returned - whether we return
11326 // it, or it is the allocated zval - has a refcount of 1.
11328 // The caller is responsible for cleaning that up (note, this is unaffected
11329 // by whether it is added to some COW set).
11331 // For reasons unknown, the Zend API resets the refcount and is_ref fields
11332 // of the return value after the function returns (unless the callee is
11333 // interpreted). If the function is supposed to return by reference, this
11334 // loses the refcount. This only happens when non-interpreted code is
11335 // called. We work around it, when compiled code is called, by saving the
11336 // refcount into SAVED_REFCOUNT, in the return statement. The downside is
11337 // that we may create an error if our code is called by a callback, and
11338 // returns by reference, and the callback returns by reference. At least
11339 // this is an obscure case.
11340 if(signature
->common
.return_reference
&& signature
->type
!= ZEND_USER_FUNCTION
)
11342 assert (rhs
!= EG(uninitialized_zval_ptr
));
11344 if (saved_refcount
!= 0)
11346 rhs
->refcount
= saved_refcount
;
11350 saved_refcount
= 0; // for 'obscure cases'
11352 if (local_TLE77
== NULL
)
11354 local_TLE77
= EG (uninitialized_zval_ptr
);
11355 local_TLE77
->refcount
++;
11357 zval
** p_lhs
= &local_TLE77
;
11359 write_var (p_lhs
, rhs
);
11362 zval_ptr_dtor (&rhs
);
11363 if(signature
->common
.return_reference
&& signature
->type
!= ZEND_USER_FUNCTION
)
11364 zval_ptr_dtor (&rhs
);
11366 phc_check_invariants (TSRMLS_C
);
11368 // $TEF1 = ($TLE77 < $touched);
11370 if (local_TEF1
== NULL
)
11372 local_TEF1
= EG (uninitialized_zval_ptr
);
11373 local_TEF1
->refcount
++;
11375 zval
** p_lhs
= &local_TEF1
;
11378 if (local_TLE77
== NULL
)
11379 left
= EG (uninitialized_zval_ptr
);
11381 left
= local_TLE77
;
11384 if (local_touched
== NULL
)
11385 right
= EG (uninitialized_zval_ptr
);
11387 right
= local_touched
;
11389 if (in_copy_on_write (*p_lhs
))
11391 zval_ptr_dtor (p_lhs
);
11392 ALLOC_INIT_ZVAL (*p_lhs
);
11395 zval old
= **p_lhs
;
11396 int result_is_operand
= (*p_lhs
== left
|| *p_lhs
== right
);
11397 is_smaller_function (*p_lhs
, left
, right TSRMLS_CC
);
11399 // If the result is one of the operands, the operator function
11400 // will already have cleaned up the result
11401 if (!result_is_operand
)
11403 phc_check_invariants (TSRMLS_C
);
11408 phc_check_invariants (TSRMLS_C
);
11412 // $TLE2 = (bool) $TEF1;
11414 if (local_TLE2
== NULL
)
11416 local_TLE2
= EG (uninitialized_zval_ptr
);
11417 local_TLE2
->refcount
++;
11419 zval
** p_lhs
= &local_TLE2
;
11422 if (local_TEF1
== NULL
)
11423 rhs
= EG (uninitialized_zval_ptr
);
11429 if ((*p_lhs
)->is_ref
)
11430 overwrite_lhs (*p_lhs
, rhs
);
11433 zval_ptr_dtor (p_lhs
);
11436 // Take a copy of RHS for LHS
11437 *p_lhs
= zvp_clone_ex (rhs
);
11450 assert (IS_BOOL
>= 0 && IS_BOOL
<= 6);
11451 if ((*p_lhs
)->type
!= IS_BOOL
)
11453 sep_copy_on_write (p_lhs
);
11454 convert_to_boolean (*p_lhs
);
11457 phc_check_invariants (TSRMLS_C
);
11459 // if (TLE2) goto L182 else goto L183;
11462 if (local_TLE2
== NULL
)
11463 p_cond
= EG (uninitialized_zval_ptr
);
11465 p_cond
= local_TLE2
;
11467 zend_bool bcond
= zend_is_true (p_cond
);
11472 phc_check_invariants (TSRMLS_C
);
11478 if (local_TEF3
== NULL
)
11480 local_TEF3
= EG (uninitialized_zval_ptr
);
11481 local_TEF3
->refcount
++;
11483 zval
** p_lhs
= &local_TEF3
;
11486 if (local_TLE2
== NULL
)
11487 rhs
= EG (uninitialized_zval_ptr
);
11493 if ((*p_lhs
)->is_ref
)
11494 overwrite_lhs (*p_lhs
, rhs
);
11497 zval_ptr_dtor (p_lhs
);
11500 // Take a copy of RHS for LHS
11501 *p_lhs
= zvp_clone_ex (rhs
);
11513 phc_check_invariants (TSRMLS_C
);
11518 phc_check_invariants (TSRMLS_C
);
11522 // $TLE78 = $this->getcachetime();
11524 if (local_this
== NULL
)
11526 local_this
= EG (uninitialized_zval_ptr
);
11527 local_this
->refcount
++;
11529 zval
** p_obj
= &local_this
;
11531 zend_fcall_info fci_object
;
11532 zend_fcall_info_cache fcic_object
= {0, NULL
, NULL
, NULL
};
11533 initialize_method_call (&fci_object
, &fcic_object
, p_obj
, "getcachetime", "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 140 TSRMLS_CC
);
11534 zend_function
* signature
= fcic_object
.function_handler
;
11535 zend_arg_info
* arg_info
= signature
->common
.arg_info
; // optional
11541 // Setup array of arguments
11542 // TODO: i think arrays of size 0 is an error
11545 zval
** args_ind
[0];
11550 phc_setup_error (1, "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 140, NULL TSRMLS_CC
);
11552 // save existing parameters, in case of recursion
11553 int param_count_save
= fci_object
.param_count
;
11554 zval
*** params_save
= fci_object
.params
;
11555 zval
** retval_save
= fci_object
.retval_ptr_ptr
;
11560 fci_object
.params
= args_ind
;
11561 fci_object
.param_count
= 0;
11562 fci_object
.retval_ptr_ptr
= &rhs
;
11564 // call the function
11565 int success
= zend_call_function (&fci_object
, &fcic_object TSRMLS_CC
);
11566 assert(success
== SUCCESS
);
11569 fci_object
.params
= params_save
;
11570 fci_object
.param_count
= param_count_save
;
11571 fci_object
.retval_ptr_ptr
= retval_save
;
11573 // unset the errors
11574 phc_setup_error (0, NULL
, 0, NULL TSRMLS_CC
);
11577 for (i
= 0; i
< 0; i
++)
11581 assert (destruct
[i
]);
11582 zval_ptr_dtor (args_ind
[i
]);
11587 // When the Zend engine returns by reference, it allocates a zval into
11588 // retval_ptr_ptr. To return by reference, the callee writes into the
11589 // retval_ptr_ptr, freeing the allocated value as it does. (Note, it may
11590 // not actually return anything). So the zval returned - whether we return
11591 // it, or it is the allocated zval - has a refcount of 1.
11593 // The caller is responsible for cleaning that up (note, this is unaffected
11594 // by whether it is added to some COW set).
11596 // For reasons unknown, the Zend API resets the refcount and is_ref fields
11597 // of the return value after the function returns (unless the callee is
11598 // interpreted). If the function is supposed to return by reference, this
11599 // loses the refcount. This only happens when non-interpreted code is
11600 // called. We work around it, when compiled code is called, by saving the
11601 // refcount into SAVED_REFCOUNT, in the return statement. The downside is
11602 // that we may create an error if our code is called by a callback, and
11603 // returns by reference, and the callback returns by reference. At least
11604 // this is an obscure case.
11605 if(signature
->common
.return_reference
&& signature
->type
!= ZEND_USER_FUNCTION
)
11607 assert (rhs
!= EG(uninitialized_zval_ptr
));
11609 if (saved_refcount
!= 0)
11611 rhs
->refcount
= saved_refcount
;
11615 saved_refcount
= 0; // for 'obscure cases'
11617 if (local_TLE78
== NULL
)
11619 local_TLE78
= EG (uninitialized_zval_ptr
);
11620 local_TLE78
->refcount
++;
11622 zval
** p_lhs
= &local_TLE78
;
11624 write_var (p_lhs
, rhs
);
11627 zval_ptr_dtor (&rhs
);
11628 if(signature
->common
.return_reference
&& signature
->type
!= ZEND_USER_FUNCTION
)
11629 zval_ptr_dtor (&rhs
);
11631 phc_check_invariants (TSRMLS_C
);
11633 // $TEF3 = ($TLE78 <= $wgCacheEpoch);
11635 if (local_TEF3
== NULL
)
11637 local_TEF3
= EG (uninitialized_zval_ptr
);
11638 local_TEF3
->refcount
++;
11640 zval
** p_lhs
= &local_TEF3
;
11643 if (local_TLE78
== NULL
)
11644 left
= EG (uninitialized_zval_ptr
);
11646 left
= local_TLE78
;
11649 if (local_wgCacheEpoch
== NULL
)
11650 right
= EG (uninitialized_zval_ptr
);
11652 right
= local_wgCacheEpoch
;
11654 if (in_copy_on_write (*p_lhs
))
11656 zval_ptr_dtor (p_lhs
);
11657 ALLOC_INIT_ZVAL (*p_lhs
);
11660 zval old
= **p_lhs
;
11661 int result_is_operand
= (*p_lhs
== left
|| *p_lhs
== right
);
11662 is_smaller_or_equal_function (*p_lhs
, left
, right TSRMLS_CC
);
11664 // If the result is one of the operands, the operator function
11665 // will already have cleaned up the result
11666 if (!result_is_operand
)
11668 phc_check_invariants (TSRMLS_C
);
11673 phc_check_invariants (TSRMLS_C
);
11677 // $TLE4 = (bool) $TEF3;
11679 if (local_TLE4
== NULL
)
11681 local_TLE4
= EG (uninitialized_zval_ptr
);
11682 local_TLE4
->refcount
++;
11684 zval
** p_lhs
= &local_TLE4
;
11687 if (local_TEF3
== NULL
)
11688 rhs
= EG (uninitialized_zval_ptr
);
11694 if ((*p_lhs
)->is_ref
)
11695 overwrite_lhs (*p_lhs
, rhs
);
11698 zval_ptr_dtor (p_lhs
);
11701 // Take a copy of RHS for LHS
11702 *p_lhs
= zvp_clone_ex (rhs
);
11715 assert (IS_BOOL
>= 0 && IS_BOOL
<= 6);
11716 if ((*p_lhs
)->type
!= IS_BOOL
)
11718 sep_copy_on_write (p_lhs
);
11719 convert_to_boolean (*p_lhs
);
11722 phc_check_invariants (TSRMLS_C
);
11724 // if (TLE4) goto L185 else goto L186;
11727 if (local_TLE4
== NULL
)
11728 p_cond
= EG (uninitialized_zval_ptr
);
11730 p_cond
= local_TLE4
;
11732 zend_bool bcond
= zend_is_true (p_cond
);
11737 phc_check_invariants (TSRMLS_C
);
11743 if (local_TEF5
== NULL
)
11745 local_TEF5
= EG (uninitialized_zval_ptr
);
11746 local_TEF5
->refcount
++;
11748 zval
** p_lhs
= &local_TEF5
;
11751 if (local_TLE4
== NULL
)
11752 rhs
= EG (uninitialized_zval_ptr
);
11758 if ((*p_lhs
)->is_ref
)
11759 overwrite_lhs (*p_lhs
, rhs
);
11762 zval_ptr_dtor (p_lhs
);
11765 // Take a copy of RHS for LHS
11766 *p_lhs
= zvp_clone_ex (rhs
);
11778 phc_check_invariants (TSRMLS_C
);
11783 phc_check_invariants (TSRMLS_C
);
11787 // $TMIt122 = $this->mVersion;
11789 if (local_this
== NULL
)
11791 local_this
= EG (uninitialized_zval_ptr
);
11792 local_this
->refcount
++;
11794 zval
** p_obj
= &local_this
;
11797 INIT_ZVAL (field_name
);
11798 ZVAL_STRING (&field_name
, "mVersion", 0);
11800 // I *think* this is correct, but documentation of the Zend API is scarce :)
11801 zval
* field
= Z_OBJ_HT_PP(p_obj
)->read_property(*p_obj
, &field_name
, BP_VAR_R TSRMLS_CC
);
11802 if (local_TMIt122
== NULL
)
11804 local_TMIt122
= EG (uninitialized_zval_ptr
);
11805 local_TMIt122
->refcount
++;
11807 zval
** p_lhs
= &local_TMIt122
;
11809 write_var (p_lhs
, field
);
11810 phc_check_invariants (TSRMLS_C
);
11812 // $TLE79 = isset($TMIt122);
11814 if (local_TLE79
== NULL
)
11816 local_TLE79
= EG (uninitialized_zval_ptr
);
11817 local_TLE79
->refcount
++;
11819 zval
** p_lhs
= &local_TLE79
;
11821 if ((*p_lhs
)->is_ref
)
11823 // Always overwrite the current value
11829 ALLOC_INIT_ZVAL (value
);
11830 zval_ptr_dtor (p_lhs
);
11833 ZVAL_BOOL(value
, local_TMIt122
!= NULL
&& !ZVAL_IS_NULL(local_TMIt122
));
11834 phc_check_invariants (TSRMLS_C
);
11836 // $TEF5 = !$TLE79;
11838 if (local_TEF5
== NULL
)
11840 local_TEF5
= EG (uninitialized_zval_ptr
);
11841 local_TEF5
->refcount
++;
11843 zval
** p_lhs
= &local_TEF5
;
11846 if (local_TLE79
== NULL
)
11847 rhs
= EG (uninitialized_zval_ptr
);
11851 if (in_copy_on_write (*p_lhs
))
11853 zval_ptr_dtor (p_lhs
);
11854 ALLOC_INIT_ZVAL (*p_lhs
);
11857 zval old
= **p_lhs
;
11858 int result_is_operand
= (*p_lhs
== rhs
);
11859 boolean_not_function (*p_lhs
, rhs TSRMLS_CC
);
11860 if (!result_is_operand
)
11862 phc_check_invariants (TSRMLS_C
);
11867 phc_check_invariants (TSRMLS_C
);
11871 // $TLE6 = (bool) $TEF5;
11873 if (local_TLE6
== NULL
)
11875 local_TLE6
= EG (uninitialized_zval_ptr
);
11876 local_TLE6
->refcount
++;
11878 zval
** p_lhs
= &local_TLE6
;
11881 if (local_TEF5
== NULL
)
11882 rhs
= EG (uninitialized_zval_ptr
);
11888 if ((*p_lhs
)->is_ref
)
11889 overwrite_lhs (*p_lhs
, rhs
);
11892 zval_ptr_dtor (p_lhs
);
11895 // Take a copy of RHS for LHS
11896 *p_lhs
= zvp_clone_ex (rhs
);
11909 assert (IS_BOOL
>= 0 && IS_BOOL
<= 6);
11910 if ((*p_lhs
)->type
!= IS_BOOL
)
11912 sep_copy_on_write (p_lhs
);
11913 convert_to_boolean (*p_lhs
);
11916 phc_check_invariants (TSRMLS_C
);
11918 // if (TLE6) goto L191 else goto L192;
11921 if (local_TLE6
== NULL
)
11922 p_cond
= EG (uninitialized_zval_ptr
);
11924 p_cond
= local_TLE6
;
11926 zend_bool bcond
= zend_is_true (p_cond
);
11931 phc_check_invariants (TSRMLS_C
);
11937 if (local_TEF7
== NULL
)
11939 local_TEF7
= EG (uninitialized_zval_ptr
);
11940 local_TEF7
->refcount
++;
11942 zval
** p_lhs
= &local_TEF7
;
11945 if (local_TLE6
== NULL
)
11946 rhs
= EG (uninitialized_zval_ptr
);
11952 if ((*p_lhs
)->is_ref
)
11953 overwrite_lhs (*p_lhs
, rhs
);
11956 zval_ptr_dtor (p_lhs
);
11959 // Take a copy of RHS for LHS
11960 *p_lhs
= zvp_clone_ex (rhs
);
11972 phc_check_invariants (TSRMLS_C
);
11977 phc_check_invariants (TSRMLS_C
);
11981 // $TLE80 = Parser::VERSION;
11983 // No null-terminator in length for get_constant.
11984 // zend_get_constant always returns a copy of the constant.
11985 if (local_TLE80
== NULL
)
11987 local_TLE80
= EG (uninitialized_zval_ptr
);
11988 local_TLE80
->refcount
++;
11990 zval
** p_lhs
= &local_TLE80
;
11992 if (!(*p_lhs
)->is_ref
)
11994 zval_ptr_dtor (p_lhs
);
11995 get_constant ("Parser::VERSION", 15, p_lhs TSRMLS_CC
);
12001 get_constant ("Parser::VERSION", 15, p_lhs TSRMLS_CC
);
12002 overwrite_lhs_no_copy (*p_lhs
, constant
);
12003 safe_free_zval_ptr (constant
);
12006 phc_check_invariants (TSRMLS_C
);
12010 if (local_TLE81
== NULL
)
12012 local_TLE81
= EG (uninitialized_zval_ptr
);
12013 local_TLE81
->refcount
++;
12015 zval
** p_lhs
= &local_TLE81
;
12018 if ((*p_lhs
)->is_ref
)
12020 // Always overwrite the current value
12026 ALLOC_INIT_ZVAL (value
);
12027 zval_ptr_dtor (p_lhs
);
12031 ZVAL_STRINGL(value
, "lt", 2, 1);
12033 phc_check_invariants (TSRMLS_C
);
12035 // $TLE124 = param_is_ref (NULL, "version_compare", 0);
12038 initialize_function_call (&version_compare_fci
, &version_compare_fcic
, "version_compare", "<unknown>", 0 TSRMLS_CC
);
12039 zend_function
* signature
= version_compare_fcic
.function_handler
;
12040 zend_arg_info
* arg_info
= signature
->common
.arg_info
;
12042 while (arg_info
&& count
< 0)
12048 if (local_TLE124
== NULL
)
12050 local_TLE124
= EG (uninitialized_zval_ptr
);
12051 local_TLE124
->refcount
++;
12053 zval
** p_lhs
= &local_TLE124
;
12056 ALLOC_INIT_ZVAL (rhs
);
12057 if (arg_info
&& count
== 0)
12059 ZVAL_BOOL (rhs
, arg_info
->pass_by_reference
);
12063 ZVAL_BOOL (rhs
, signature
->common
.pass_rest_by_reference
);
12065 write_var (p_lhs
, rhs
);
12066 zval_ptr_dtor (&rhs
);
12067 phc_check_invariants (TSRMLS_C
);
12069 // if (TLE124) goto L188 else goto L189;
12072 if (local_TLE124
== NULL
)
12073 p_cond
= EG (uninitialized_zval_ptr
);
12075 p_cond
= local_TLE124
;
12077 zend_bool bcond
= zend_is_true (p_cond
);
12082 phc_check_invariants (TSRMLS_C
);
12086 // $TMIt123 =& $this->mVersion;
12088 if (local_this
== NULL
)
12090 local_this
= EG (uninitialized_zval_ptr
);
12091 local_this
->refcount
++;
12093 zval
** p_obj
= &local_this
;
12096 INIT_ZVAL (field_name
);
12097 ZVAL_STRING (&field_name
, "mVersion", 0);
12099 zval
** field
= Z_OBJ_HT_PP(p_obj
)->get_property_ptr_ptr(*p_obj
, &field_name TSRMLS_CC
);
12100 sep_copy_on_write (field
);
12101 if (local_TMIt123
== NULL
)
12103 local_TMIt123
= EG (uninitialized_zval_ptr
);
12104 local_TMIt123
->refcount
++;
12106 zval
** p_lhs
= &local_TMIt123
;
12108 copy_into_ref (p_lhs
, field
);
12109 phc_check_invariants (TSRMLS_C
);
12114 phc_check_invariants (TSRMLS_C
);
12118 // $TMIt123 = $this->mVersion;
12120 if (local_this
== NULL
)
12122 local_this
= EG (uninitialized_zval_ptr
);
12123 local_this
->refcount
++;
12125 zval
** p_obj
= &local_this
;
12128 INIT_ZVAL (field_name
);
12129 ZVAL_STRING (&field_name
, "mVersion", 0);
12131 // I *think* this is correct, but documentation of the Zend API is scarce :)
12132 zval
* field
= Z_OBJ_HT_PP(p_obj
)->read_property(*p_obj
, &field_name
, BP_VAR_R TSRMLS_CC
);
12133 if (local_TMIt123
== NULL
)
12135 local_TMIt123
= EG (uninitialized_zval_ptr
);
12136 local_TMIt123
->refcount
++;
12138 zval
** p_lhs
= &local_TMIt123
;
12140 write_var (p_lhs
, field
);
12141 phc_check_invariants (TSRMLS_C
);
12146 phc_check_invariants (TSRMLS_C
);
12150 // $TEF7 = version_compare($TMIt123, $TLE80, $TLE81);
12152 initialize_function_call (&version_compare_fci
, &version_compare_fcic
, "version_compare", "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 142 TSRMLS_CC
);
12153 zend_function
* signature
= version_compare_fcic
.function_handler
;
12154 zend_arg_info
* arg_info
= signature
->common
.arg_info
; // optional
12158 // TODO: find names to replace index
12161 by_ref
[abr_index
] = arg_info
->pass_by_reference
;
12165 by_ref
[abr_index
] = signature
->common
.pass_rest_by_reference
;
12168 // TODO: find names to replace index
12171 by_ref
[abr_index
] = arg_info
->pass_by_reference
;
12175 by_ref
[abr_index
] = signature
->common
.pass_rest_by_reference
;
12178 // TODO: find names to replace index
12181 by_ref
[abr_index
] = arg_info
->pass_by_reference
;
12185 by_ref
[abr_index
] = signature
->common
.pass_rest_by_reference
;
12190 // Setup array of arguments
12191 // TODO: i think arrays of size 0 is an error
12194 zval
** args_ind
[3];
12197 destruct
[af_index
] = 0;
12198 if (by_ref
[af_index
])
12200 if (local_TMIt123
== NULL
)
12202 local_TMIt123
= EG (uninitialized_zval_ptr
);
12203 local_TMIt123
->refcount
++;
12205 zval
** p_arg
= &local_TMIt123
;
12207 args_ind
[af_index
] = fetch_var_arg_by_ref (p_arg
);
12208 assert (!in_copy_on_write (*args_ind
[af_index
]));
12209 args
[af_index
] = *args_ind
[af_index
];
12214 if (local_TMIt123
== NULL
)
12215 arg
= EG (uninitialized_zval_ptr
);
12217 arg
= local_TMIt123
;
12219 args
[af_index
] = fetch_var_arg (arg
, &destruct
[af_index
]);
12220 args_ind
[af_index
] = &args
[af_index
];
12223 destruct
[af_index
] = 0;
12224 if (by_ref
[af_index
])
12226 if (local_TLE80
== NULL
)
12228 local_TLE80
= EG (uninitialized_zval_ptr
);
12229 local_TLE80
->refcount
++;
12231 zval
** p_arg
= &local_TLE80
;
12233 args_ind
[af_index
] = fetch_var_arg_by_ref (p_arg
);
12234 assert (!in_copy_on_write (*args_ind
[af_index
]));
12235 args
[af_index
] = *args_ind
[af_index
];
12240 if (local_TLE80
== NULL
)
12241 arg
= EG (uninitialized_zval_ptr
);
12245 args
[af_index
] = fetch_var_arg (arg
, &destruct
[af_index
]);
12246 args_ind
[af_index
] = &args
[af_index
];
12249 destruct
[af_index
] = 0;
12250 if (by_ref
[af_index
])
12252 if (local_TLE81
== NULL
)
12254 local_TLE81
= EG (uninitialized_zval_ptr
);
12255 local_TLE81
->refcount
++;
12257 zval
** p_arg
= &local_TLE81
;
12259 args_ind
[af_index
] = fetch_var_arg_by_ref (p_arg
);
12260 assert (!in_copy_on_write (*args_ind
[af_index
]));
12261 args
[af_index
] = *args_ind
[af_index
];
12266 if (local_TLE81
== NULL
)
12267 arg
= EG (uninitialized_zval_ptr
);
12271 args
[af_index
] = fetch_var_arg (arg
, &destruct
[af_index
]);
12272 args_ind
[af_index
] = &args
[af_index
];
12277 phc_setup_error (1, "/home/mdupont/2009/02/introspector/rdfintrospector/mediawiki/trunk/phase3/includes/parser/ParserOutput.php", 142, NULL TSRMLS_CC
);
12279 // save existing parameters, in case of recursion
12280 int param_count_save
= version_compare_fci
.param_count
;
12281 zval
*** params_save
= version_compare_fci
.params
;
12282 zval
** retval_save
= version_compare_fci
.retval_ptr_ptr
;
12287 version_compare_fci
.params
= args_ind
;
12288 version_compare_fci
.param_count
= 3;
12289 version_compare_fci
.retval_ptr_ptr
= &rhs
;
12291 // call the function
12292 int success
= zend_call_function (&version_compare_fci
, &version_compare_fcic TSRMLS_CC
);
12293 assert(success
== SUCCESS
);
12296 version_compare_fci
.params
= params_save
;
12297 version_compare_fci
.param_count
= param_count_save
;
12298 version_compare_fci
.retval_ptr_ptr
= retval_save
;
12300 // unset the errors
12301 phc_setup_error (0, NULL
, 0, NULL TSRMLS_CC
);
12304 for (i
= 0; i
< 3; i
++)
12308 assert (destruct
[i
]);
12309 zval_ptr_dtor (args_ind
[i
]);
12314 // When the Zend engine returns by reference, it allocates a zval into
12315 // retval_ptr_ptr. To return by reference, the callee writes into the
12316 // retval_ptr_ptr, freeing the allocated value as it does. (Note, it may
12317 // not actually return anything). So the zval returned - whether we return
12318 // it, or it is the allocated zval - has a refcount of 1.
12320 // The caller is responsible for cleaning that up (note, this is unaffected
12321 // by whether it is added to some COW set).
12323 // For reasons unknown, the Zend API resets the refcount and is_ref fields
12324 // of the return value after the function returns (unless the callee is
12325 // interpreted). If the function is supposed to return by reference, this
12326 // loses the refcount. This only happens when non-interpreted code is
12327 // called. We work around it, when compiled code is called, by saving the
12328 // refcount into SAVED_REFCOUNT, in the return statement. The downside is
12329 // that we may create an error if our code is called by a callback, and
12330 // returns by reference, and the callback returns by reference. At least
12331 // this is an obscure case.
12332 if(signature
->common
.return_reference
&& signature
->type
!= ZEND_USER_FUNCTION
)
12334 assert (rhs
!= EG(uninitialized_zval_ptr
));
12336 if (saved_refcount
!= 0)
12338 rhs
->refcount
= saved_refcount
;
12342 saved_refcount
= 0; // for 'obscure cases'
12344 if (local_TEF7
== NULL
)
12346 local_TEF7
= EG (uninitialized_zval_ptr
);
12347 local_TEF7
->refcount
++;
12349 zval
** p_lhs
= &local_TEF7
;
12351 write_var (p_lhs
, rhs
);
12354 zval_ptr_dtor (&rhs
);
12355 if(signature
->common
.return_reference
&& signature
->type
!= ZEND_USER_FUNCTION
)
12356 zval_ptr_dtor (&rhs
);
12358 phc_check_invariants (TSRMLS_C
);
12363 phc_check_invariants (TSRMLS_C
);
12367 // $TLE82 = (bool) $TEF7;
12369 if (local_TLE82
== NULL
)
12371 local_TLE82
= EG (uninitialized_zval_ptr
);
12372 local_TLE82
->refcount
++;
12374 zval
** p_lhs
= &local_TLE82
;
12377 if (local_TEF7
== NULL
)
12378 rhs
= EG (uninitialized_zval_ptr
);
12384 if ((*p_lhs
)->is_ref
)
12385 overwrite_lhs (*p_lhs
, rhs
);
12388 zval_ptr_dtor (p_lhs
);
12391 // Take a copy of RHS for LHS
12392 *p_lhs
= zvp_clone_ex (rhs
);
12405 assert (IS_BOOL
>= 0 && IS_BOOL
<= 6);
12406 if ((*p_lhs
)->type
!= IS_BOOL
)
12408 sep_copy_on_write (p_lhs
);
12409 convert_to_boolean (*p_lhs
);
12412 phc_check_invariants (TSRMLS_C
);
12417 if (local_TLE82
== NULL
)
12418 rhs
= EG (uninitialized_zval_ptr
);
12422 // Run-time return by reference has different semantics to compile-time.
12423 // If the function has CTRBR and RTRBR, the the assignment will be
12424 // reference. If one or the other is return-by-copy, the result will be
12425 // by copy. Its a question of whether its separated at return-time (which
12426 // we do here) or at the call-site.
12427 return_value
->value
= rhs
->value
;
12428 return_value
->type
= rhs
->type
;
12429 zval_copy_ctor (return_value
);
12430 goto end_of_function
;
12431 phc_check_invariants (TSRMLS_C
);
12434 end_of_function
:__attribute__((unused
));
12435 if (local_TEF1
!= NULL
)
12437 zval_ptr_dtor (&local_TEF1
);
12439 if (local_TEF3
!= NULL
)
12441 zval_ptr_dtor (&local_TEF3
);
12443 if (local_TEF5
!= NULL
)
12445 zval_ptr_dtor (&local_TEF5
);
12447 if (local_TEF7
!= NULL
)
12449 zval_ptr_dtor (&local_TEF7
);
12451 if (local_TLE0
!= NULL
)
12453 zval_ptr_dtor (&local_TLE0
);
12455 if (local_TLE124
!= NULL
)
12457 zval_ptr_dtor (&local_TLE124
);
12459 if (local_TLE2
!= NULL
)
12461 zval_ptr_dtor (&local_TLE2
);
12463 if (local_TLE4
!= NULL
)
12465 zval_ptr_dtor (&local_TLE4
);
12467 if (local_TLE6
!= NULL
)
12469 zval_ptr_dtor (&local_TLE6
);
12471 if (local_TLE75
!= NULL
)
12473 zval_ptr_dtor (&local_TLE75
);
12475 if (local_TLE76
!= NULL
)
12477 zval_ptr_dtor (&local_TLE76
);
12479 if (local_TLE77
!= NULL
)
12481 zval_ptr_dtor (&local_TLE77
);
12483 if (local_TLE78
!= NULL
)
12485 zval_ptr_dtor (&local_TLE78
);
12487 if (local_TLE79
!= NULL
)
12489 zval_ptr_dtor (&local_TLE79
);
12491 if (local_TLE80
!= NULL
)
12493 zval_ptr_dtor (&local_TLE80
);
12495 if (local_TLE81
!= NULL
)
12497 zval_ptr_dtor (&local_TLE81
);
12499 if (local_TLE82
!= NULL
)
12501 zval_ptr_dtor (&local_TLE82
);
12503 if (local_TMIt122
!= NULL
)
12505 zval_ptr_dtor (&local_TMIt122
);
12507 if (local_TMIt123
!= NULL
)
12509 zval_ptr_dtor (&local_TMIt123
);
12511 if (local_touched
!= NULL
)
12513 zval_ptr_dtor (&local_touched
);
12515 if (local_wgCacheEpoch
!= NULL
)
12517 zval_ptr_dtor (&local_wgCacheEpoch
);
12520 // function addheaditem($section, $tag = False)
12523 // $TLE84 = ($tag !== $TLE83);
12524 // if (TLE84) goto L194 else goto L195;
12526 // $TSt85 =& $this->mHeadItems;
12527 // $TSt85[$tag] = $section;
12530 // $TSt86 =& $this->mHeadItems;
12531 // $TSt86[] = $section;
12535 PHP_METHOD(ParserOutput
, addheaditem
)
12537 zval
* local_TLE83
= NULL
;
12538 zval
* local_TLE84
= NULL
;
12539 zval
* local_TSt85
= NULL
;
12540 zval
* local_TSt86
= NULL
;
12541 zval
* local_section
= NULL
;
12542 zval
* local_tag
= NULL
;
12543 zval
* local_this
= getThis();
12544 // Add all parameters as local variables
12546 int num_args
= ZEND_NUM_ARGS ();
12548 zend_get_parameters_array(0, num_args
, params
);
12550 params
[0]->refcount
++;
12551 if (local_section
!= NULL
)
12553 zval_ptr_dtor (&local_section
);
12555 local_section
= params
[0];
12559 zval
* default_value
;
12561 zval
* local___static_value__
= NULL
;
12562 // $__static_value__ = False;
12564 if (local___static_value__
== NULL
)
12566 local___static_value__
= EG (uninitialized_zval_ptr
);
12567 local___static_value__
->refcount
++;
12569 zval
** p_lhs
= &local___static_value__
;
12572 if ((*p_lhs
)->is_ref
)
12574 // Always overwrite the current value
12580 ALLOC_INIT_ZVAL (value
);
12581 zval_ptr_dtor (p_lhs
);
12585 ZVAL_BOOL (value
, 0);
12587 phc_check_invariants (TSRMLS_C
);
12589 default_value
= local___static_value__
;
12590 assert(!default_value
->is_ref
);
12591 default_value
->refcount
++;
12592 if (local___static_value__
!= NULL
)
12594 zval_ptr_dtor (&local___static_value__
);
12597 default_value
->refcount
--;
12598 params
[1] = default_value
;
12600 params
[1]->refcount
++;
12601 if (local_tag
!= NULL
)
12603 zval_ptr_dtor (&local_tag
);
12605 local_tag
= params
[1];
12610 if (local_TLE83
== NULL
)
12612 local_TLE83
= EG (uninitialized_zval_ptr
);
12613 local_TLE83
->refcount
++;
12615 zval
** p_lhs
= &local_TLE83
;
12618 if ((*p_lhs
)->is_ref
)
12620 // Always overwrite the current value
12626 ALLOC_INIT_ZVAL (value
);
12627 zval_ptr_dtor (p_lhs
);
12631 ZVAL_BOOL (value
, 0);
12633 phc_check_invariants (TSRMLS_C
);
12635 // $TLE84 = ($tag !== $TLE83);
12637 if (local_TLE84
== NULL
)
12639 local_TLE84
= EG (uninitialized_zval_ptr
);
12640 local_TLE84
->refcount
++;
12642 zval
** p_lhs
= &local_TLE84
;
12645 if (local_tag
== NULL
)
12646 left
= EG (uninitialized_zval_ptr
);
12651 if (local_TLE83
== NULL
)
12652 right
= EG (uninitialized_zval_ptr
);
12654 right
= local_TLE83
;
12656 if (in_copy_on_write (*p_lhs
))
12658 zval_ptr_dtor (p_lhs
);
12659 ALLOC_INIT_ZVAL (*p_lhs
);
12662 zval old
= **p_lhs
;
12663 int result_is_operand
= (*p_lhs
== left
|| *p_lhs
== right
);
12664 is_not_identical_function (*p_lhs
, left
, right TSRMLS_CC
);
12666 // If the result is one of the operands, the operator function
12667 // will already have cleaned up the result
12668 if (!result_is_operand
)
12670 phc_check_invariants (TSRMLS_C
);
12672 // if (TLE84) goto L194 else goto L195;
12675 if (local_TLE84
== NULL
)
12676 p_cond
= EG (uninitialized_zval_ptr
);
12678 p_cond
= local_TLE84
;
12680 zend_bool bcond
= zend_is_true (p_cond
);
12685 phc_check_invariants (TSRMLS_C
);
12689 // $TSt85 =& $this->mHeadItems;
12691 if (local_this
== NULL
)
12693 local_this
= EG (uninitialized_zval_ptr
);
12694 local_this
->refcount
++;
12696 zval
** p_obj
= &local_this
;
12699 INIT_ZVAL (field_name
);
12700 ZVAL_STRING (&field_name
, "mHeadItems", 0);
12702 zval
** field
= Z_OBJ_HT_PP(p_obj
)->get_property_ptr_ptr(*p_obj
, &field_name TSRMLS_CC
);
12703 sep_copy_on_write (field
);
12704 if (local_TSt85
== NULL
)
12706 local_TSt85
= EG (uninitialized_zval_ptr
);
12707 local_TSt85
->refcount
++;
12709 zval
** p_lhs
= &local_TSt85
;
12711 copy_into_ref (p_lhs
, field
);
12712 phc_check_invariants (TSRMLS_C
);
12714 // $TSt85[$tag] = $section;
12716 if (local_TSt85
== NULL
)
12718 local_TSt85
= EG (uninitialized_zval_ptr
);
12719 local_TSt85
->refcount
++;
12721 zval
** p_array
= &local_TSt85
;
12723 check_array_type (p_array TSRMLS_CC
);
12726 if (local_tag
== NULL
)
12727 index
= EG (uninitialized_zval_ptr
);
12733 if (Z_TYPE_PP (p_array
) == IS_STRING
&& Z_STRLEN_PP (p_array
) > 0)
12736 if (local_section
== NULL
)
12737 rhs
= EG (uninitialized_zval_ptr
);
12739 rhs
= local_section
;
12741 write_string_index (p_array
, index
, rhs TSRMLS_CC
);
12743 else if (Z_TYPE_PP (p_array
) == IS_ARRAY
)
12745 zval
** p_lhs
= get_ht_entry (p_array
, index TSRMLS_CC
);
12747 if (local_section
== NULL
)
12748 rhs
= EG (uninitialized_zval_ptr
);
12750 rhs
= local_section
;
12754 write_var (p_lhs
, rhs
);
12757 phc_check_invariants (TSRMLS_C
);
12762 phc_check_invariants (TSRMLS_C
);
12766 // $TSt86 =& $this->mHeadItems;
12768 if (local_this
== NULL
)
12770 local_this
= EG (uninitialized_zval_ptr
);
12771 local_this
->refcount
++;
12773 zval
** p_obj
= &local_this
;
12776 INIT_ZVAL (field_name
);
12777 ZVAL_STRING (&field_name
, "mHeadItems", 0);
12779 zval
** field
= Z_OBJ_HT_PP(p_obj
)->get_property_ptr_ptr(*p_obj
, &field_name TSRMLS_CC
);
12780 sep_copy_on_write (field
);
12781 if (local_TSt86
== NULL
)
12783 local_TSt86
= EG (uninitialized_zval_ptr
);
12784 local_TSt86
->refcount
++;
12786 zval
** p_lhs
= &local_TSt86
;
12788 copy_into_ref (p_lhs
, field
);
12789 phc_check_invariants (TSRMLS_C
);
12791 // $TSt86[] = $section;
12793 if (local_TSt86
== NULL
)
12795 local_TSt86
= EG (uninitialized_zval_ptr
);
12796 local_TSt86
->refcount
++;
12798 zval
** p_array
= &local_TSt86
;
12800 // Push EG(uninit) and get a pointer to the symtable entry
12801 zval
** p_lhs
= push_and_index_ht (p_array TSRMLS_CC
);
12805 if (local_section
== NULL
)
12806 rhs
= EG (uninitialized_zval_ptr
);
12808 rhs
= local_section
;
12811 write_var (p_lhs
, rhs
);
12813 // I think if this is NULL, then the LHS is a bool or similar, and you cant
12815 phc_check_invariants (TSRMLS_C
);
12820 phc_check_invariants (TSRMLS_C
);
12825 end_of_function
:__attribute__((unused
));
12826 if (local_TLE83
!= NULL
)
12828 zval_ptr_dtor (&local_TLE83
);
12830 if (local_TLE84
!= NULL
)
12832 zval_ptr_dtor (&local_TLE84
);
12834 if (local_TSt85
!= NULL
)
12836 zval_ptr_dtor (&local_TSt85
);
12838 if (local_TSt86
!= NULL
)
12840 zval_ptr_dtor (&local_TSt86
);
12842 if (local_section
!= NULL
)
12844 zval_ptr_dtor (&local_section
);
12846 if (local_tag
!= NULL
)
12848 zval_ptr_dtor (&local_tag
);
12851 // public function setdisplaytitle($text)
12853 // $this->displayTitle = $text;
12855 PHP_METHOD(ParserOutput
, setdisplaytitle
)
12857 zval
* local_text
= NULL
;
12858 zval
* local_this
= getThis();
12859 // Add all parameters as local variables
12861 int num_args
= ZEND_NUM_ARGS ();
12863 zend_get_parameters_array(0, num_args
, params
);
12865 params
[0]->refcount
++;
12866 if (local_text
!= NULL
)
12868 zval_ptr_dtor (&local_text
);
12870 local_text
= params
[0];
12873 // $this->displayTitle = $text;
12875 if (local_this
== NULL
)
12877 local_this
= EG (uninitialized_zval_ptr
);
12878 local_this
->refcount
++;
12880 zval
** p_obj
= &local_this
;
12883 if (local_text
== NULL
)
12884 rhs
= EG (uninitialized_zval_ptr
);
12889 INIT_ZVAL (field_name
);
12890 ZVAL_STRING (&field_name
, "displayTitle", 0);
12892 Z_OBJ_HT_PP(p_obj
)->write_property(*p_obj
, &field_name
, rhs TSRMLS_CC
);
12893 phc_check_invariants (TSRMLS_C
);
12896 end_of_function
:__attribute__((unused
));
12897 if (local_text
!= NULL
)
12899 zval_ptr_dtor (&local_text
);
12902 // public function getdisplaytitle()
12904 // $TSt87 = $this->displayTitle;
12907 PHP_METHOD(ParserOutput
, getdisplaytitle
)
12909 zval
* local_TSt87
= NULL
;
12910 zval
* local_this
= getThis();
12912 // $TSt87 = $this->displayTitle;
12914 if (local_this
== NULL
)
12916 local_this
= EG (uninitialized_zval_ptr
);
12917 local_this
->refcount
++;
12919 zval
** p_obj
= &local_this
;
12922 INIT_ZVAL (field_name
);
12923 ZVAL_STRING (&field_name
, "displayTitle", 0);
12925 // I *think* this is correct, but documentation of the Zend API is scarce :)
12926 zval
* field
= Z_OBJ_HT_PP(p_obj
)->read_property(*p_obj
, &field_name
, BP_VAR_R TSRMLS_CC
);
12927 if (local_TSt87
== NULL
)
12929 local_TSt87
= EG (uninitialized_zval_ptr
);
12930 local_TSt87
->refcount
++;
12932 zval
** p_lhs
= &local_TSt87
;
12934 write_var (p_lhs
, field
);
12935 phc_check_invariants (TSRMLS_C
);
12940 if (local_TSt87
== NULL
)
12941 rhs
= EG (uninitialized_zval_ptr
);
12945 // Run-time return by reference has different semantics to compile-time.
12946 // If the function has CTRBR and RTRBR, the the assignment will be
12947 // reference. If one or the other is return-by-copy, the result will be
12948 // by copy. Its a question of whether its separated at return-time (which
12949 // we do here) or at the call-site.
12950 return_value
->value
= rhs
->value
;
12951 return_value
->type
= rhs
->type
;
12952 zval_copy_ctor (return_value
);
12953 goto end_of_function
;
12954 phc_check_invariants (TSRMLS_C
);
12957 end_of_function
:__attribute__((unused
));
12958 if (local_TSt87
!= NULL
)
12960 zval_ptr_dtor (&local_TSt87
);
12963 // public function setflag($flag)
12965 // $TSt88 =& $this->mFlags;
12967 // $TSt88[$flag] = $TLE89;
12969 PHP_METHOD(ParserOutput
, setflag
)
12971 zval
* local_TLE89
= NULL
;
12972 zval
* local_TSt88
= NULL
;
12973 zval
* local_flag
= NULL
;
12974 zval
* local_this
= getThis();
12975 // Add all parameters as local variables
12977 int num_args
= ZEND_NUM_ARGS ();
12979 zend_get_parameters_array(0, num_args
, params
);
12981 params
[0]->refcount
++;
12982 if (local_flag
!= NULL
)
12984 zval_ptr_dtor (&local_flag
);
12986 local_flag
= params
[0];
12989 // $TSt88 =& $this->mFlags;
12991 if (local_this
== NULL
)
12993 local_this
= EG (uninitialized_zval_ptr
);
12994 local_this
->refcount
++;
12996 zval
** p_obj
= &local_this
;
12999 INIT_ZVAL (field_name
);
13000 ZVAL_STRING (&field_name
, "mFlags", 0);
13002 zval
** field
= Z_OBJ_HT_PP(p_obj
)->get_property_ptr_ptr(*p_obj
, &field_name TSRMLS_CC
);
13003 sep_copy_on_write (field
);
13004 if (local_TSt88
== NULL
)
13006 local_TSt88
= EG (uninitialized_zval_ptr
);
13007 local_TSt88
->refcount
++;
13009 zval
** p_lhs
= &local_TSt88
;
13011 copy_into_ref (p_lhs
, field
);
13012 phc_check_invariants (TSRMLS_C
);
13016 if (local_TLE89
== NULL
)
13018 local_TLE89
= EG (uninitialized_zval_ptr
);
13019 local_TLE89
->refcount
++;
13021 zval
** p_lhs
= &local_TLE89
;
13024 if ((*p_lhs
)->is_ref
)
13026 // Always overwrite the current value
13032 ALLOC_INIT_ZVAL (value
);
13033 zval_ptr_dtor (p_lhs
);
13037 ZVAL_BOOL (value
, 1);
13039 phc_check_invariants (TSRMLS_C
);
13041 // $TSt88[$flag] = $TLE89;
13043 if (local_TSt88
== NULL
)
13045 local_TSt88
= EG (uninitialized_zval_ptr
);
13046 local_TSt88
->refcount
++;
13048 zval
** p_array
= &local_TSt88
;
13050 check_array_type (p_array TSRMLS_CC
);
13053 if (local_flag
== NULL
)
13054 index
= EG (uninitialized_zval_ptr
);
13056 index
= local_flag
;
13060 if (Z_TYPE_PP (p_array
) == IS_STRING
&& Z_STRLEN_PP (p_array
) > 0)
13063 if (local_TLE89
== NULL
)
13064 rhs
= EG (uninitialized_zval_ptr
);
13068 write_string_index (p_array
, index
, rhs TSRMLS_CC
);
13070 else if (Z_TYPE_PP (p_array
) == IS_ARRAY
)
13072 zval
** p_lhs
= get_ht_entry (p_array
, index TSRMLS_CC
);
13074 if (local_TLE89
== NULL
)
13075 rhs
= EG (uninitialized_zval_ptr
);
13081 write_var (p_lhs
, rhs
);
13084 phc_check_invariants (TSRMLS_C
);
13087 end_of_function
:__attribute__((unused
));
13088 if (local_TLE89
!= NULL
)
13090 zval_ptr_dtor (&local_TLE89
);
13092 if (local_TSt88
!= NULL
)
13094 zval_ptr_dtor (&local_TSt88
);
13096 if (local_flag
!= NULL
)
13098 zval_ptr_dtor (&local_flag
);
13101 // public function getflag($flag)
13103 // $TMIt125 = $this->mFlags;
13104 // $TLE90 = isset($TMIt125[$flag]);
13107 PHP_METHOD(ParserOutput
, getflag
)
13109 zval
* local_TLE90
= NULL
;
13110 zval
* local_TMIt125
= NULL
;
13111 zval
* local_flag
= NULL
;
13112 zval
* local_this
= getThis();
13113 // Add all parameters as local variables
13115 int num_args
= ZEND_NUM_ARGS ();
13117 zend_get_parameters_array(0, num_args
, params
);
13119 params
[0]->refcount
++;
13120 if (local_flag
!= NULL
)
13122 zval_ptr_dtor (&local_flag
);
13124 local_flag
= params
[0];
13127 // $TMIt125 = $this->mFlags;
13129 if (local_this
== NULL
)
13131 local_this
= EG (uninitialized_zval_ptr
);
13132 local_this
->refcount
++;
13134 zval
** p_obj
= &local_this
;
13137 INIT_ZVAL (field_name
);
13138 ZVAL_STRING (&field_name
, "mFlags", 0);
13140 // I *think* this is correct, but documentation of the Zend API is scarce :)
13141 zval
* field
= Z_OBJ_HT_PP(p_obj
)->read_property(*p_obj
, &field_name
, BP_VAR_R TSRMLS_CC
);
13142 if (local_TMIt125
== NULL
)
13144 local_TMIt125
= EG (uninitialized_zval_ptr
);
13145 local_TMIt125
->refcount
++;
13147 zval
** p_lhs
= &local_TMIt125
;
13149 write_var (p_lhs
, field
);
13150 phc_check_invariants (TSRMLS_C
);
13152 // $TLE90 = isset($TMIt125[$flag]);
13154 if (local_TLE90
== NULL
)
13156 local_TLE90
= EG (uninitialized_zval_ptr
);
13157 local_TLE90
->refcount
++;
13159 zval
** p_lhs
= &local_TLE90
;
13161 if ((*p_lhs
)->is_ref
)
13163 // Always overwrite the current value
13169 ALLOC_INIT_ZVAL (value
);
13170 zval_ptr_dtor (p_lhs
);
13173 if (local_TMIt125
== NULL
)
13175 local_TMIt125
= EG (uninitialized_zval_ptr
);
13176 local_TMIt125
->refcount
++;
13178 zval
** u_array
= &local_TMIt125
;
13180 if (local_flag
== NULL
)
13182 u_index
= EG (uninitialized_zval_ptr
);
13186 u_index
= local_flag
;
13188 ZVAL_BOOL(value
, isset_array (u_array
, u_index
));
13189 phc_check_invariants (TSRMLS_C
);
13194 if (local_TLE90
== NULL
)
13195 rhs
= EG (uninitialized_zval_ptr
);
13199 // Run-time return by reference has different semantics to compile-time.
13200 // If the function has CTRBR and RTRBR, the the assignment will be
13201 // reference. If one or the other is return-by-copy, the result will be
13202 // by copy. Its a question of whether its separated at return-time (which
13203 // we do here) or at the call-site.
13204 return_value
->value
= rhs
->value
;
13205 return_value
->type
= rhs
->type
;
13206 zval_copy_ctor (return_value
);
13207 goto end_of_function
;
13208 phc_check_invariants (TSRMLS_C
);
13211 end_of_function
:__attribute__((unused
));
13212 if (local_TLE90
!= NULL
)
13214 zval_ptr_dtor (&local_TLE90
);
13216 if (local_TMIt125
!= NULL
)
13218 zval_ptr_dtor (&local_TMIt125
);
13220 if (local_flag
!= NULL
)
13222 zval_ptr_dtor (&local_flag
);
13225 // public function setproperty($name, $value)
13227 // $TSt91 =& $this->mProperties;
13228 // $TSt91[$name] = $value;
13230 PHP_METHOD(ParserOutput
, setproperty
)
13232 zval
* local_TSt91
= NULL
;
13233 zval
* local_name
= NULL
;
13234 zval
* local_this
= getThis();
13235 zval
* local_value
= NULL
;
13236 // Add all parameters as local variables
13238 int num_args
= ZEND_NUM_ARGS ();
13240 zend_get_parameters_array(0, num_args
, params
);
13242 params
[0]->refcount
++;
13243 if (local_name
!= NULL
)
13245 zval_ptr_dtor (&local_name
);
13247 local_name
= params
[0];
13249 params
[1]->refcount
++;
13250 if (local_value
!= NULL
)
13252 zval_ptr_dtor (&local_value
);
13254 local_value
= params
[1];
13257 // $TSt91 =& $this->mProperties;
13259 if (local_this
== NULL
)
13261 local_this
= EG (uninitialized_zval_ptr
);
13262 local_this
->refcount
++;
13264 zval
** p_obj
= &local_this
;
13267 INIT_ZVAL (field_name
);
13268 ZVAL_STRING (&field_name
, "mProperties", 0);
13270 zval
** field
= Z_OBJ_HT_PP(p_obj
)->get_property_ptr_ptr(*p_obj
, &field_name TSRMLS_CC
);
13271 sep_copy_on_write (field
);
13272 if (local_TSt91
== NULL
)
13274 local_TSt91
= EG (uninitialized_zval_ptr
);
13275 local_TSt91
->refcount
++;
13277 zval
** p_lhs
= &local_TSt91
;
13279 copy_into_ref (p_lhs
, field
);
13280 phc_check_invariants (TSRMLS_C
);
13282 // $TSt91[$name] = $value;
13284 if (local_TSt91
== NULL
)
13286 local_TSt91
= EG (uninitialized_zval_ptr
);
13287 local_TSt91
->refcount
++;
13289 zval
** p_array
= &local_TSt91
;
13291 check_array_type (p_array TSRMLS_CC
);
13294 if (local_name
== NULL
)
13295 index
= EG (uninitialized_zval_ptr
);
13297 index
= local_name
;
13301 if (Z_TYPE_PP (p_array
) == IS_STRING
&& Z_STRLEN_PP (p_array
) > 0)
13304 if (local_value
== NULL
)
13305 rhs
= EG (uninitialized_zval_ptr
);
13309 write_string_index (p_array
, index
, rhs TSRMLS_CC
);
13311 else if (Z_TYPE_PP (p_array
) == IS_ARRAY
)
13313 zval
** p_lhs
= get_ht_entry (p_array
, index TSRMLS_CC
);
13315 if (local_value
== NULL
)
13316 rhs
= EG (uninitialized_zval_ptr
);
13322 write_var (p_lhs
, rhs
);
13325 phc_check_invariants (TSRMLS_C
);
13328 end_of_function
:__attribute__((unused
));
13329 if (local_TSt91
!= NULL
)
13331 zval_ptr_dtor (&local_TSt91
);
13333 if (local_name
!= NULL
)
13335 zval_ptr_dtor (&local_name
);
13337 if (local_value
!= NULL
)
13339 zval_ptr_dtor (&local_value
);
13342 // public function getproperty($name)
13344 // $TMIt126 = $this->mProperties;
13345 // $TLE92 = isset($TMIt126[$name]);
13346 // if (TLE92) goto L197 else goto L198;
13348 // $TSt93 = $this->mProperties;
13349 // $TSi94 = $TSt93[$name];
13358 PHP_METHOD(ParserOutput
, getproperty
)
13360 zval
* local_TEF8
= NULL
;
13361 zval
* local_TLE92
= NULL
;
13362 zval
* local_TMIt126
= NULL
;
13363 zval
* local_TSi94
= NULL
;
13364 zval
* local_TSt93
= NULL
;
13365 zval
* local_name
= NULL
;
13366 zval
* local_this
= getThis();
13367 // Add all parameters as local variables
13369 int num_args
= ZEND_NUM_ARGS ();
13371 zend_get_parameters_array(0, num_args
, params
);
13373 params
[0]->refcount
++;
13374 if (local_name
!= NULL
)
13376 zval_ptr_dtor (&local_name
);
13378 local_name
= params
[0];
13381 // $TMIt126 = $this->mProperties;
13383 if (local_this
== NULL
)
13385 local_this
= EG (uninitialized_zval_ptr
);
13386 local_this
->refcount
++;
13388 zval
** p_obj
= &local_this
;
13391 INIT_ZVAL (field_name
);
13392 ZVAL_STRING (&field_name
, "mProperties", 0);
13394 // I *think* this is correct, but documentation of the Zend API is scarce :)
13395 zval
* field
= Z_OBJ_HT_PP(p_obj
)->read_property(*p_obj
, &field_name
, BP_VAR_R TSRMLS_CC
);
13396 if (local_TMIt126
== NULL
)
13398 local_TMIt126
= EG (uninitialized_zval_ptr
);
13399 local_TMIt126
->refcount
++;
13401 zval
** p_lhs
= &local_TMIt126
;
13403 write_var (p_lhs
, field
);
13404 phc_check_invariants (TSRMLS_C
);
13406 // $TLE92 = isset($TMIt126[$name]);
13408 if (local_TLE92
== NULL
)
13410 local_TLE92
= EG (uninitialized_zval_ptr
);
13411 local_TLE92
->refcount
++;
13413 zval
** p_lhs
= &local_TLE92
;
13415 if ((*p_lhs
)->is_ref
)
13417 // Always overwrite the current value
13423 ALLOC_INIT_ZVAL (value
);
13424 zval_ptr_dtor (p_lhs
);
13427 if (local_TMIt126
== NULL
)
13429 local_TMIt126
= EG (uninitialized_zval_ptr
);
13430 local_TMIt126
->refcount
++;
13432 zval
** u_array
= &local_TMIt126
;
13434 if (local_name
== NULL
)
13436 u_index
= EG (uninitialized_zval_ptr
);
13440 u_index
= local_name
;
13442 ZVAL_BOOL(value
, isset_array (u_array
, u_index
));
13443 phc_check_invariants (TSRMLS_C
);
13445 // if (TLE92) goto L197 else goto L198;
13448 if (local_TLE92
== NULL
)
13449 p_cond
= EG (uninitialized_zval_ptr
);
13451 p_cond
= local_TLE92
;
13453 zend_bool bcond
= zend_is_true (p_cond
);
13458 phc_check_invariants (TSRMLS_C
);
13462 // $TSt93 = $this->mProperties;
13464 if (local_this
== NULL
)
13466 local_this
= EG (uninitialized_zval_ptr
);
13467 local_this
->refcount
++;
13469 zval
** p_obj
= &local_this
;
13472 INIT_ZVAL (field_name
);
13473 ZVAL_STRING (&field_name
, "mProperties", 0);
13475 // I *think* this is correct, but documentation of the Zend API is scarce :)
13476 zval
* field
= Z_OBJ_HT_PP(p_obj
)->read_property(*p_obj
, &field_name
, BP_VAR_R TSRMLS_CC
);
13477 if (local_TSt93
== NULL
)
13479 local_TSt93
= EG (uninitialized_zval_ptr
);
13480 local_TSt93
->refcount
++;
13482 zval
** p_lhs
= &local_TSt93
;
13484 write_var (p_lhs
, field
);
13485 phc_check_invariants (TSRMLS_C
);
13487 // $TSi94 = $TSt93[$name];
13489 if (local_TSi94
== NULL
)
13491 local_TSi94
= EG (uninitialized_zval_ptr
);
13492 local_TSi94
->refcount
++;
13494 zval
** p_lhs
= &local_TSi94
;
13497 if (local_TSt93
== NULL
)
13498 r_array
= EG (uninitialized_zval_ptr
);
13500 r_array
= local_TSt93
;
13503 if (local_name
== NULL
)
13504 r_index
= EG (uninitialized_zval_ptr
);
13506 r_index
= local_name
;
13510 int is_rhs_new
= 0;
13511 if (Z_TYPE_P (r_array
) != IS_ARRAY
)
13513 if (Z_TYPE_P (r_array
) == IS_STRING
)
13516 rhs
= read_string_index (r_array
, r_index TSRMLS_CC
);
13519 // TODO: warning here?
13520 rhs
= EG (uninitialized_zval_ptr
);
13524 if (check_array_index_type (r_index TSRMLS_CC
))
13526 // Read array variable
13527 read_array (&rhs
, r_array
, r_index TSRMLS_CC
);
13530 rhs
= *p_lhs
; // HACK to fail *p_lhs != rhs
13534 write_var (p_lhs
, rhs
);
13536 if (is_rhs_new
) zval_ptr_dtor (&rhs
);
13537 phc_check_invariants (TSRMLS_C
);
13541 if (local_TEF8
== NULL
)
13543 local_TEF8
= EG (uninitialized_zval_ptr
);
13544 local_TEF8
->refcount
++;
13546 zval
** p_lhs
= &local_TEF8
;
13549 if (local_TSi94
== NULL
)
13550 rhs
= EG (uninitialized_zval_ptr
);
13556 if ((*p_lhs
)->is_ref
)
13557 overwrite_lhs (*p_lhs
, rhs
);
13560 zval_ptr_dtor (p_lhs
);
13563 // Take a copy of RHS for LHS
13564 *p_lhs
= zvp_clone_ex (rhs
);
13576 phc_check_invariants (TSRMLS_C
);
13581 phc_check_invariants (TSRMLS_C
);
13587 if (local_TEF8
== NULL
)
13589 local_TEF8
= EG (uninitialized_zval_ptr
);
13590 local_TEF8
->refcount
++;
13592 zval
** p_lhs
= &local_TEF8
;
13595 if ((*p_lhs
)->is_ref
)
13597 // Always overwrite the current value
13603 ALLOC_INIT_ZVAL (value
);
13604 zval_ptr_dtor (p_lhs
);
13608 ZVAL_BOOL (value
, 0);
13610 phc_check_invariants (TSRMLS_C
);
13615 phc_check_invariants (TSRMLS_C
);
13622 if (local_TEF8
== NULL
)
13623 rhs
= EG (uninitialized_zval_ptr
);
13627 // Run-time return by reference has different semantics to compile-time.
13628 // If the function has CTRBR and RTRBR, the the assignment will be
13629 // reference. If one or the other is return-by-copy, the result will be
13630 // by copy. Its a question of whether its separated at return-time (which
13631 // we do here) or at the call-site.
13632 return_value
->value
= rhs
->value
;
13633 return_value
->type
= rhs
->type
;
13634 zval_copy_ctor (return_value
);
13635 goto end_of_function
;
13636 phc_check_invariants (TSRMLS_C
);
13639 end_of_function
:__attribute__((unused
));
13640 if (local_TEF8
!= NULL
)
13642 zval_ptr_dtor (&local_TEF8
);
13644 if (local_TLE92
!= NULL
)
13646 zval_ptr_dtor (&local_TLE92
);
13648 if (local_TMIt126
!= NULL
)
13650 zval_ptr_dtor (&local_TMIt126
);
13652 if (local_TSi94
!= NULL
)
13654 zval_ptr_dtor (&local_TSi94
);
13656 if (local_TSt93
!= NULL
)
13658 zval_ptr_dtor (&local_TSt93
);
13660 if (local_name
!= NULL
)
13662 zval_ptr_dtor (&local_name
);
13665 // public function getproperties()
13667 // $TMIt127 = $this->mProperties;
13668 // $TLE95 = isset($TMIt127);
13669 // $TLE96 = !$TLE95;
13670 // if (TLE96) goto L200 else goto L201;
13673 // $TSa97 = (array) $TSa97;
13674 // $this->mProperties = $TSa97;
13679 // $TSt98 = $this->mProperties;
13682 PHP_METHOD(ParserOutput
, getproperties
)
13684 zval
* local_TLE95
= NULL
;
13685 zval
* local_TLE96
= NULL
;
13686 zval
* local_TMIt127
= NULL
;
13687 zval
* local_TSa97
= NULL
;
13688 zval
* local_TSt98
= NULL
;
13689 zval
* local_this
= getThis();
13691 // $TMIt127 = $this->mProperties;
13693 if (local_this
== NULL
)
13695 local_this
= EG (uninitialized_zval_ptr
);
13696 local_this
->refcount
++;
13698 zval
** p_obj
= &local_this
;
13701 INIT_ZVAL (field_name
);
13702 ZVAL_STRING (&field_name
, "mProperties", 0);
13704 // I *think* this is correct, but documentation of the Zend API is scarce :)
13705 zval
* field
= Z_OBJ_HT_PP(p_obj
)->read_property(*p_obj
, &field_name
, BP_VAR_R TSRMLS_CC
);
13706 if (local_TMIt127
== NULL
)
13708 local_TMIt127
= EG (uninitialized_zval_ptr
);
13709 local_TMIt127
->refcount
++;
13711 zval
** p_lhs
= &local_TMIt127
;
13713 write_var (p_lhs
, field
);
13714 phc_check_invariants (TSRMLS_C
);
13716 // $TLE95 = isset($TMIt127);
13718 if (local_TLE95
== NULL
)
13720 local_TLE95
= EG (uninitialized_zval_ptr
);
13721 local_TLE95
->refcount
++;
13723 zval
** p_lhs
= &local_TLE95
;
13725 if ((*p_lhs
)->is_ref
)
13727 // Always overwrite the current value
13733 ALLOC_INIT_ZVAL (value
);
13734 zval_ptr_dtor (p_lhs
);
13737 ZVAL_BOOL(value
, local_TMIt127
!= NULL
&& !ZVAL_IS_NULL(local_TMIt127
));
13738 phc_check_invariants (TSRMLS_C
);
13740 // $TLE96 = !$TLE95;
13742 if (local_TLE96
== NULL
)
13744 local_TLE96
= EG (uninitialized_zval_ptr
);
13745 local_TLE96
->refcount
++;
13747 zval
** p_lhs
= &local_TLE96
;
13750 if (local_TLE95
== NULL
)
13751 rhs
= EG (uninitialized_zval_ptr
);
13755 if (in_copy_on_write (*p_lhs
))
13757 zval_ptr_dtor (p_lhs
);
13758 ALLOC_INIT_ZVAL (*p_lhs
);
13761 zval old
= **p_lhs
;
13762 int result_is_operand
= (*p_lhs
== rhs
);
13763 boolean_not_function (*p_lhs
, rhs TSRMLS_CC
);
13764 if (!result_is_operand
)
13766 phc_check_invariants (TSRMLS_C
);
13768 // if (TLE96) goto L200 else goto L201;
13771 if (local_TLE96
== NULL
)
13772 p_cond
= EG (uninitialized_zval_ptr
);
13774 p_cond
= local_TLE96
;
13776 zend_bool bcond
= zend_is_true (p_cond
);
13781 phc_check_invariants (TSRMLS_C
);
13787 if (local_TSa97
!= NULL
)
13789 zval_ptr_dtor (&local_TSa97
);
13790 local_TSa97
= NULL
;
13792 phc_check_invariants (TSRMLS_C
);
13794 // $TSa97 = (array) $TSa97;
13796 if (local_TSa97
== NULL
)
13798 local_TSa97
= EG (uninitialized_zval_ptr
);
13799 local_TSa97
->refcount
++;
13801 zval
** p_lhs
= &local_TSa97
;
13804 if (local_TSa97
== NULL
)
13805 rhs
= EG (uninitialized_zval_ptr
);
13811 if ((*p_lhs
)->is_ref
)
13812 overwrite_lhs (*p_lhs
, rhs
);
13815 zval_ptr_dtor (p_lhs
);
13818 // Take a copy of RHS for LHS
13819 *p_lhs
= zvp_clone_ex (rhs
);
13832 assert (IS_ARRAY
>= 0 && IS_ARRAY
<= 6);
13833 if ((*p_lhs
)->type
!= IS_ARRAY
)
13835 sep_copy_on_write (p_lhs
);
13836 convert_to_array (*p_lhs
);
13839 phc_check_invariants (TSRMLS_C
);
13841 // $this->mProperties = $TSa97;
13843 if (local_this
== NULL
)
13845 local_this
= EG (uninitialized_zval_ptr
);
13846 local_this
->refcount
++;
13848 zval
** p_obj
= &local_this
;
13851 if (local_TSa97
== NULL
)
13852 rhs
= EG (uninitialized_zval_ptr
);
13857 INIT_ZVAL (field_name
);
13858 ZVAL_STRING (&field_name
, "mProperties", 0);
13860 Z_OBJ_HT_PP(p_obj
)->write_property(*p_obj
, &field_name
, rhs TSRMLS_CC
);
13861 phc_check_invariants (TSRMLS_C
);
13866 phc_check_invariants (TSRMLS_C
);
13873 phc_check_invariants (TSRMLS_C
);
13877 // $TSt98 = $this->mProperties;
13879 if (local_this
== NULL
)
13881 local_this
= EG (uninitialized_zval_ptr
);
13882 local_this
->refcount
++;
13884 zval
** p_obj
= &local_this
;
13887 INIT_ZVAL (field_name
);
13888 ZVAL_STRING (&field_name
, "mProperties", 0);
13890 // I *think* this is correct, but documentation of the Zend API is scarce :)
13891 zval
* field
= Z_OBJ_HT_PP(p_obj
)->read_property(*p_obj
, &field_name
, BP_VAR_R TSRMLS_CC
);
13892 if (local_TSt98
== NULL
)
13894 local_TSt98
= EG (uninitialized_zval_ptr
);
13895 local_TSt98
->refcount
++;
13897 zval
** p_lhs
= &local_TSt98
;
13899 write_var (p_lhs
, field
);
13900 phc_check_invariants (TSRMLS_C
);
13905 if (local_TSt98
== NULL
)
13906 rhs
= EG (uninitialized_zval_ptr
);
13910 // Run-time return by reference has different semantics to compile-time.
13911 // If the function has CTRBR and RTRBR, the the assignment will be
13912 // reference. If one or the other is return-by-copy, the result will be
13913 // by copy. Its a question of whether its separated at return-time (which
13914 // we do here) or at the call-site.
13915 return_value
->value
= rhs
->value
;
13916 return_value
->type
= rhs
->type
;
13917 zval_copy_ctor (return_value
);
13918 goto end_of_function
;
13919 phc_check_invariants (TSRMLS_C
);
13922 end_of_function
:__attribute__((unused
));
13923 if (local_TLE95
!= NULL
)
13925 zval_ptr_dtor (&local_TLE95
);
13927 if (local_TLE96
!= NULL
)
13929 zval_ptr_dtor (&local_TLE96
);
13931 if (local_TMIt127
!= NULL
)
13933 zval_ptr_dtor (&local_TMIt127
);
13935 if (local_TSa97
!= NULL
)
13937 zval_ptr_dtor (&local_TSa97
);
13939 if (local_TSt98
!= NULL
)
13941 zval_ptr_dtor (&local_TSt98
);
13944 // ArgInfo structures (necessary to support compile time pass-by-reference)
13945 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_parseroutput_arg_info
, 0, 0, 0)
13946 ZEND_ARG_INFO(0, "text")
13947 ZEND_ARG_INFO(0, "languageLinks")
13948 ZEND_ARG_INFO(0, "categoryLinks")
13949 ZEND_ARG_INFO(0, "containsOldMagic")
13950 ZEND_ARG_INFO(0, "titletext")
13951 ZEND_END_ARG_INFO()
13953 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_gettext_arg_info
, 0, 0, 0)
13954 ZEND_END_ARG_INFO()
13956 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_getlanguagelinks_arg_info
, 0, 1, 0)
13957 ZEND_END_ARG_INFO()
13959 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_getcategorylinks_arg_info
, 0, 0, 0)
13960 ZEND_END_ARG_INFO()
13962 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_getcategories_arg_info
, 0, 1, 0)
13963 ZEND_END_ARG_INFO()
13965 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_getcachetime_arg_info
, 0, 0, 0)
13966 ZEND_END_ARG_INFO()
13968 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_gettitletext_arg_info
, 0, 0, 0)
13969 ZEND_END_ARG_INFO()
13971 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_getsections_arg_info
, 0, 0, 0)
13972 ZEND_END_ARG_INFO()
13974 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_getlinks_arg_info
, 0, 1, 0)
13975 ZEND_END_ARG_INFO()
13977 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_gettemplates_arg_info
, 0, 1, 0)
13978 ZEND_END_ARG_INFO()
13980 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_getimages_arg_info
, 0, 1, 0)
13981 ZEND_END_ARG_INFO()
13983 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_getexternallinks_arg_info
, 0, 1, 0)
13984 ZEND_END_ARG_INFO()
13986 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_getnogallery_arg_info
, 0, 0, 0)
13987 ZEND_END_ARG_INFO()
13989 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_getsubtitle_arg_info
, 0, 0, 0)
13990 ZEND_END_ARG_INFO()
13992 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_getoutputhooks_arg_info
, 0, 0, 0)
13993 ZEND_END_ARG_INFO()
13995 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_getwarnings_arg_info
, 0, 0, 0)
13996 ZEND_END_ARG_INFO()
13998 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_getindexpolicy_arg_info
, 0, 0, 0)
13999 ZEND_END_ARG_INFO()
14001 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_containsoldmagic_arg_info
, 0, 0, 0)
14002 ZEND_END_ARG_INFO()
14004 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_settext_arg_info
, 0, 0, 0)
14005 ZEND_ARG_INFO(0, "text")
14006 ZEND_END_ARG_INFO()
14008 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_setlanguagelinks_arg_info
, 0, 0, 0)
14009 ZEND_ARG_INFO(0, "ll")
14010 ZEND_END_ARG_INFO()
14012 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_setcategorylinks_arg_info
, 0, 0, 0)
14013 ZEND_ARG_INFO(0, "cl")
14014 ZEND_END_ARG_INFO()
14016 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_setcontainsoldmagic_arg_info
, 0, 0, 0)
14017 ZEND_ARG_INFO(0, "com")
14018 ZEND_END_ARG_INFO()
14020 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_setcachetime_arg_info
, 0, 0, 0)
14021 ZEND_ARG_INFO(0, "t")
14022 ZEND_END_ARG_INFO()
14024 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_settitletext_arg_info
, 0, 0, 0)
14025 ZEND_ARG_INFO(0, "t")
14026 ZEND_END_ARG_INFO()
14028 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_setsections_arg_info
, 0, 0, 0)
14029 ZEND_ARG_INFO(0, "toc")
14030 ZEND_END_ARG_INFO()
14032 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_setindexpolicy_arg_info
, 0, 0, 0)
14033 ZEND_ARG_INFO(0, "policy")
14034 ZEND_END_ARG_INFO()
14036 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_addcategory_arg_info
, 0, 0, 0)
14037 ZEND_ARG_INFO(0, "c")
14038 ZEND_ARG_INFO(0, "sort")
14039 ZEND_END_ARG_INFO()
14041 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_addlanguagelink_arg_info
, 0, 0, 0)
14042 ZEND_ARG_INFO(0, "t")
14043 ZEND_END_ARG_INFO()
14045 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_addexternallink_arg_info
, 0, 0, 0)
14046 ZEND_ARG_INFO(0, "url")
14047 ZEND_END_ARG_INFO()
14049 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_addwarning_arg_info
, 0, 0, 0)
14050 ZEND_ARG_INFO(0, "s")
14051 ZEND_END_ARG_INFO()
14053 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_addoutputhook_arg_info
, 0, 0, 0)
14054 ZEND_ARG_INFO(0, "hook")
14055 ZEND_ARG_INFO(0, "data")
14056 ZEND_END_ARG_INFO()
14058 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_setnewsection_arg_info
, 0, 0, 0)
14059 ZEND_ARG_INFO(0, "value")
14060 ZEND_END_ARG_INFO()
14062 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_getnewsection_arg_info
, 0, 0, 0)
14063 ZEND_END_ARG_INFO()
14065 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_addlink_arg_info
, 0, 0, 0)
14066 ZEND_ARG_INFO(0, "title")
14067 ZEND_ARG_INFO(0, "id")
14068 ZEND_END_ARG_INFO()
14070 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_addimage_arg_info
, 0, 0, 0)
14071 ZEND_ARG_INFO(0, "name")
14072 ZEND_END_ARG_INFO()
14074 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_addtemplate_arg_info
, 0, 0, 0)
14075 ZEND_ARG_INFO(0, "title")
14076 ZEND_ARG_INFO(0, "page_id")
14077 ZEND_ARG_INFO(0, "rev_id")
14078 ZEND_END_ARG_INFO()
14080 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_expired_arg_info
, 0, 0, 0)
14081 ZEND_ARG_INFO(0, "touched")
14082 ZEND_END_ARG_INFO()
14084 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_addheaditem_arg_info
, 0, 0, 0)
14085 ZEND_ARG_INFO(0, "section")
14086 ZEND_ARG_INFO(0, "tag")
14087 ZEND_END_ARG_INFO()
14089 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_setdisplaytitle_arg_info
, 0, 0, 0)
14090 ZEND_ARG_INFO(0, "text")
14091 ZEND_END_ARG_INFO()
14093 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_getdisplaytitle_arg_info
, 0, 0, 0)
14094 ZEND_END_ARG_INFO()
14096 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_setflag_arg_info
, 0, 0, 0)
14097 ZEND_ARG_INFO(0, "flag")
14098 ZEND_END_ARG_INFO()
14100 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_getflag_arg_info
, 0, 0, 0)
14101 ZEND_ARG_INFO(0, "flag")
14102 ZEND_END_ARG_INFO()
14104 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_setproperty_arg_info
, 0, 0, 0)
14105 ZEND_ARG_INFO(0, "name")
14106 ZEND_ARG_INFO(0, "value")
14107 ZEND_END_ARG_INFO()
14109 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_getproperty_arg_info
, 0, 0, 0)
14110 ZEND_ARG_INFO(0, "name")
14111 ZEND_END_ARG_INFO()
14113 ZEND_BEGIN_ARG_INFO_EX(ParserOutput_getproperties_arg_info
, 0, 0, 0)
14114 ZEND_END_ARG_INFO()
14116 static function_entry ParserOutput_functions
[] = {
14117 PHP_ME(ParserOutput
, parseroutput
, ParserOutput_parseroutput_arg_info
, ZEND_ACC_PUBLIC
)
14118 PHP_ME(ParserOutput
, gettext
, ParserOutput_gettext_arg_info
, ZEND_ACC_PUBLIC
)
14119 PHP_ME(ParserOutput
, getlanguagelinks
, ParserOutput_getlanguagelinks_arg_info
, ZEND_ACC_PUBLIC
)
14120 PHP_ME(ParserOutput
, getcategorylinks
, ParserOutput_getcategorylinks_arg_info
, ZEND_ACC_PUBLIC
)
14121 PHP_ME(ParserOutput
, getcategories
, ParserOutput_getcategories_arg_info
, ZEND_ACC_PUBLIC
)
14122 PHP_ME(ParserOutput
, getcachetime
, ParserOutput_getcachetime_arg_info
, ZEND_ACC_PUBLIC
)
14123 PHP_ME(ParserOutput
, gettitletext
, ParserOutput_gettitletext_arg_info
, ZEND_ACC_PUBLIC
)
14124 PHP_ME(ParserOutput
, getsections
, ParserOutput_getsections_arg_info
, ZEND_ACC_PUBLIC
)
14125 PHP_ME(ParserOutput
, getlinks
, ParserOutput_getlinks_arg_info
, ZEND_ACC_PUBLIC
)
14126 PHP_ME(ParserOutput
, gettemplates
, ParserOutput_gettemplates_arg_info
, ZEND_ACC_PUBLIC
)
14127 PHP_ME(ParserOutput
, getimages
, ParserOutput_getimages_arg_info
, ZEND_ACC_PUBLIC
)
14128 PHP_ME(ParserOutput
, getexternallinks
, ParserOutput_getexternallinks_arg_info
, ZEND_ACC_PUBLIC
)
14129 PHP_ME(ParserOutput
, getnogallery
, ParserOutput_getnogallery_arg_info
, ZEND_ACC_PUBLIC
)
14130 PHP_ME(ParserOutput
, getsubtitle
, ParserOutput_getsubtitle_arg_info
, ZEND_ACC_PUBLIC
)
14131 PHP_ME(ParserOutput
, getoutputhooks
, ParserOutput_getoutputhooks_arg_info
, ZEND_ACC_PUBLIC
)
14132 PHP_ME(ParserOutput
, getwarnings
, ParserOutput_getwarnings_arg_info
, ZEND_ACC_PUBLIC
)
14133 PHP_ME(ParserOutput
, getindexpolicy
, ParserOutput_getindexpolicy_arg_info
, ZEND_ACC_PUBLIC
)
14134 PHP_ME(ParserOutput
, containsoldmagic
, ParserOutput_containsoldmagic_arg_info
, ZEND_ACC_PUBLIC
)
14135 PHP_ME(ParserOutput
, settext
, ParserOutput_settext_arg_info
, ZEND_ACC_PUBLIC
)
14136 PHP_ME(ParserOutput
, setlanguagelinks
, ParserOutput_setlanguagelinks_arg_info
, ZEND_ACC_PUBLIC
)
14137 PHP_ME(ParserOutput
, setcategorylinks
, ParserOutput_setcategorylinks_arg_info
, ZEND_ACC_PUBLIC
)
14138 PHP_ME(ParserOutput
, setcontainsoldmagic
, ParserOutput_setcontainsoldmagic_arg_info
, ZEND_ACC_PUBLIC
)
14139 PHP_ME(ParserOutput
, setcachetime
, ParserOutput_setcachetime_arg_info
, ZEND_ACC_PUBLIC
)
14140 PHP_ME(ParserOutput
, settitletext
, ParserOutput_settitletext_arg_info
, ZEND_ACC_PUBLIC
)
14141 PHP_ME(ParserOutput
, setsections
, ParserOutput_setsections_arg_info
, ZEND_ACC_PUBLIC
)
14142 PHP_ME(ParserOutput
, setindexpolicy
, ParserOutput_setindexpolicy_arg_info
, ZEND_ACC_PUBLIC
)
14143 PHP_ME(ParserOutput
, addcategory
, ParserOutput_addcategory_arg_info
, ZEND_ACC_PUBLIC
)
14144 PHP_ME(ParserOutput
, addlanguagelink
, ParserOutput_addlanguagelink_arg_info
, ZEND_ACC_PUBLIC
)
14145 PHP_ME(ParserOutput
, addexternallink
, ParserOutput_addexternallink_arg_info
, ZEND_ACC_PUBLIC
)
14146 PHP_ME(ParserOutput
, addwarning
, ParserOutput_addwarning_arg_info
, ZEND_ACC_PUBLIC
)
14147 PHP_ME(ParserOutput
, addoutputhook
, ParserOutput_addoutputhook_arg_info
, ZEND_ACC_PUBLIC
)
14148 PHP_ME(ParserOutput
, setnewsection
, ParserOutput_setnewsection_arg_info
, ZEND_ACC_PUBLIC
)
14149 PHP_ME(ParserOutput
, getnewsection
, ParserOutput_getnewsection_arg_info
, ZEND_ACC_PUBLIC
)
14150 PHP_ME(ParserOutput
, addlink
, ParserOutput_addlink_arg_info
, ZEND_ACC_PUBLIC
)
14151 PHP_ME(ParserOutput
, addimage
, ParserOutput_addimage_arg_info
, ZEND_ACC_PUBLIC
)
14152 PHP_ME(ParserOutput
, addtemplate
, ParserOutput_addtemplate_arg_info
, ZEND_ACC_PUBLIC
)
14153 PHP_ME(ParserOutput
, expired
, ParserOutput_expired_arg_info
, ZEND_ACC_PUBLIC
)
14154 PHP_ME(ParserOutput
, addheaditem
, ParserOutput_addheaditem_arg_info
, ZEND_ACC_PUBLIC
)
14155 PHP_ME(ParserOutput
, setdisplaytitle
, ParserOutput_setdisplaytitle_arg_info
, ZEND_ACC_PUBLIC
)
14156 PHP_ME(ParserOutput
, getdisplaytitle
, ParserOutput_getdisplaytitle_arg_info
, ZEND_ACC_PUBLIC
)
14157 PHP_ME(ParserOutput
, setflag
, ParserOutput_setflag_arg_info
, ZEND_ACC_PUBLIC
)
14158 PHP_ME(ParserOutput
, getflag
, ParserOutput_getflag_arg_info
, ZEND_ACC_PUBLIC
)
14159 PHP_ME(ParserOutput
, setproperty
, ParserOutput_setproperty_arg_info
, ZEND_ACC_PUBLIC
)
14160 PHP_ME(ParserOutput
, getproperty
, ParserOutput_getproperty_arg_info
, ZEND_ACC_PUBLIC
)
14161 PHP_ME(ParserOutput
, getproperties
, ParserOutput_getproperties_arg_info
, ZEND_ACC_PUBLIC
)
14162 { NULL
, NULL
, NULL
}
14164 // function __MAIN__()
14167 PHP_FUNCTION(__MAIN__
)
14171 end_of_function
:__attribute__((unused
));
14173 // Module initialization
14174 PHP_MINIT_FUNCTION(app
)
14177 zend_class_entry ce
; // temp
14178 zend_class_entry
* ce_reg
; // once registered, ce_ptr should be used
14179 INIT_CLASS_ENTRY(ce
, "ParserOutput", ParserOutput_functions
);
14180 ce_reg
= zend_register_internal_class(&ce TSRMLS_CC
);
14181 ce_reg
->type
&= ~ZEND_INTERNAL_CLASS
;
14183 zval
* default_value
;
14185 zval
* local___static_value__
= NULL
;
14186 // $__static_value__ = NULL;
14188 if (local___static_value__
== NULL
)
14190 local___static_value__
= EG (uninitialized_zval_ptr
);
14191 local___static_value__
->refcount
++;
14193 zval
** p_lhs
= &local___static_value__
;
14196 if ((*p_lhs
)->is_ref
)
14198 // Always overwrite the current value
14204 ALLOC_INIT_ZVAL (value
);
14205 zval_ptr_dtor (p_lhs
);
14211 phc_check_invariants (TSRMLS_C
);
14213 default_value
= local___static_value__
;
14214 assert(!default_value
->is_ref
);
14215 default_value
->refcount
++;
14216 if (local___static_value__
!= NULL
)
14218 zval_ptr_dtor (&local___static_value__
);
14221 phc_declare_property(ce_reg
, "mText", 5, default_value
, ZEND_ACC_PUBLIC TSRMLS_CC
);}{
14222 zval
* default_value
;
14224 zval
* local___static_value__
= NULL
;
14225 // $__static_value__ = NULL;
14227 if (local___static_value__
== NULL
)
14229 local___static_value__
= EG (uninitialized_zval_ptr
);
14230 local___static_value__
->refcount
++;
14232 zval
** p_lhs
= &local___static_value__
;
14235 if ((*p_lhs
)->is_ref
)
14237 // Always overwrite the current value
14243 ALLOC_INIT_ZVAL (value
);
14244 zval_ptr_dtor (p_lhs
);
14250 phc_check_invariants (TSRMLS_C
);
14252 default_value
= local___static_value__
;
14253 assert(!default_value
->is_ref
);
14254 default_value
->refcount
++;
14255 if (local___static_value__
!= NULL
)
14257 zval_ptr_dtor (&local___static_value__
);
14260 phc_declare_property(ce_reg
, "mLanguageLinks", 14, default_value
, ZEND_ACC_PUBLIC TSRMLS_CC
);}{
14261 zval
* default_value
;
14263 zval
* local___static_value__
= NULL
;
14264 // $__static_value__ = NULL;
14266 if (local___static_value__
== NULL
)
14268 local___static_value__
= EG (uninitialized_zval_ptr
);
14269 local___static_value__
->refcount
++;
14271 zval
** p_lhs
= &local___static_value__
;
14274 if ((*p_lhs
)->is_ref
)
14276 // Always overwrite the current value
14282 ALLOC_INIT_ZVAL (value
);
14283 zval_ptr_dtor (p_lhs
);
14289 phc_check_invariants (TSRMLS_C
);
14291 default_value
= local___static_value__
;
14292 assert(!default_value
->is_ref
);
14293 default_value
->refcount
++;
14294 if (local___static_value__
!= NULL
)
14296 zval_ptr_dtor (&local___static_value__
);
14299 phc_declare_property(ce_reg
, "mCategories", 11, default_value
, ZEND_ACC_PUBLIC TSRMLS_CC
);}{
14300 zval
* default_value
;
14302 zval
* local___static_value__
= NULL
;
14303 // $__static_value__ = NULL;
14305 if (local___static_value__
== NULL
)
14307 local___static_value__
= EG (uninitialized_zval_ptr
);
14308 local___static_value__
->refcount
++;
14310 zval
** p_lhs
= &local___static_value__
;
14313 if ((*p_lhs
)->is_ref
)
14315 // Always overwrite the current value
14321 ALLOC_INIT_ZVAL (value
);
14322 zval_ptr_dtor (p_lhs
);
14328 phc_check_invariants (TSRMLS_C
);
14330 default_value
= local___static_value__
;
14331 assert(!default_value
->is_ref
);
14332 default_value
->refcount
++;
14333 if (local___static_value__
!= NULL
)
14335 zval_ptr_dtor (&local___static_value__
);
14338 phc_declare_property(ce_reg
, "mContainsOldMagic", 17, default_value
, ZEND_ACC_PUBLIC TSRMLS_CC
);}{
14339 zval
* default_value
;
14341 zval
* local___static_value__
= NULL
;
14342 // $__static_value__ = NULL;
14344 if (local___static_value__
== NULL
)
14346 local___static_value__
= EG (uninitialized_zval_ptr
);
14347 local___static_value__
->refcount
++;
14349 zval
** p_lhs
= &local___static_value__
;
14352 if ((*p_lhs
)->is_ref
)
14354 // Always overwrite the current value
14360 ALLOC_INIT_ZVAL (value
);
14361 zval_ptr_dtor (p_lhs
);
14367 phc_check_invariants (TSRMLS_C
);
14369 default_value
= local___static_value__
;
14370 assert(!default_value
->is_ref
);
14371 default_value
->refcount
++;
14372 if (local___static_value__
!= NULL
)
14374 zval_ptr_dtor (&local___static_value__
);
14377 phc_declare_property(ce_reg
, "mTitleText", 10, default_value
, ZEND_ACC_PUBLIC TSRMLS_CC
);}{
14378 zval
* default_value
;
14380 zval
* local___static_value__
= NULL
;
14381 // $__static_value__ = '';
14383 if (local___static_value__
== NULL
)
14385 local___static_value__
= EG (uninitialized_zval_ptr
);
14386 local___static_value__
->refcount
++;
14388 zval
** p_lhs
= &local___static_value__
;
14391 if ((*p_lhs
)->is_ref
)
14393 // Always overwrite the current value
14399 ALLOC_INIT_ZVAL (value
);
14400 zval_ptr_dtor (p_lhs
);
14404 ZVAL_STRINGL(value
, "", 0, 1);
14406 phc_check_invariants (TSRMLS_C
);
14408 default_value
= local___static_value__
;
14409 assert(!default_value
->is_ref
);
14410 default_value
->refcount
++;
14411 if (local___static_value__
!= NULL
)
14413 zval_ptr_dtor (&local___static_value__
);
14416 phc_declare_property(ce_reg
, "mCacheTime", 10, default_value
, ZEND_ACC_PUBLIC TSRMLS_CC
);}{
14417 zval
* default_value
;
14419 zval
* local___static_value__
= NULL
;
14420 // $__static_value__ = Parser::VERSION;
14422 // No null-terminator in length for get_constant.
14423 // zend_get_constant always returns a copy of the constant.
14424 if (local___static_value__
== NULL
)
14426 local___static_value__
= EG (uninitialized_zval_ptr
);
14427 local___static_value__
->refcount
++;
14429 zval
** p_lhs
= &local___static_value__
;
14431 if (!(*p_lhs
)->is_ref
)
14433 zval_ptr_dtor (p_lhs
);
14434 get_constant ("Parser::VERSION", 15, p_lhs TSRMLS_CC
);
14440 get_constant ("Parser::VERSION", 15, p_lhs TSRMLS_CC
);
14441 overwrite_lhs_no_copy (*p_lhs
, constant
);
14442 safe_free_zval_ptr (constant
);
14445 phc_check_invariants (TSRMLS_C
);
14447 default_value
= local___static_value__
;
14448 assert(!default_value
->is_ref
);
14449 default_value
->refcount
++;
14450 if (local___static_value__
!= NULL
)
14452 zval_ptr_dtor (&local___static_value__
);
14455 phc_declare_property(ce_reg
, "mVersion", 8, default_value
, ZEND_ACC_PUBLIC TSRMLS_CC
);}{
14456 zval
* default_value
;
14458 zval
* local_TSa205
= NULL
;
14459 zval
* local___static_value__
= NULL
;
14462 if (local_TSa205
!= NULL
)
14464 zval_ptr_dtor (&local_TSa205
);
14465 local_TSa205
= NULL
;
14467 phc_check_invariants (TSRMLS_C
);
14469 // $TSa205 = (array) $TSa205;
14471 if (local_TSa205
== NULL
)
14473 local_TSa205
= EG (uninitialized_zval_ptr
);
14474 local_TSa205
->refcount
++;
14476 zval
** p_lhs
= &local_TSa205
;
14479 if (local_TSa205
== NULL
)
14480 rhs
= EG (uninitialized_zval_ptr
);
14482 rhs
= local_TSa205
;
14486 if ((*p_lhs
)->is_ref
)
14487 overwrite_lhs (*p_lhs
, rhs
);
14490 zval_ptr_dtor (p_lhs
);
14493 // Take a copy of RHS for LHS
14494 *p_lhs
= zvp_clone_ex (rhs
);
14507 assert (IS_ARRAY
>= 0 && IS_ARRAY
<= 6);
14508 if ((*p_lhs
)->type
!= IS_ARRAY
)
14510 sep_copy_on_write (p_lhs
);
14511 convert_to_array (*p_lhs
);
14514 phc_check_invariants (TSRMLS_C
);
14516 // $__static_value__ = $TSa205;
14518 if (local___static_value__
== NULL
)
14520 local___static_value__
= EG (uninitialized_zval_ptr
);
14521 local___static_value__
->refcount
++;
14523 zval
** p_lhs
= &local___static_value__
;
14526 if (local_TSa205
== NULL
)
14527 rhs
= EG (uninitialized_zval_ptr
);
14529 rhs
= local_TSa205
;
14533 if ((*p_lhs
)->is_ref
)
14534 overwrite_lhs (*p_lhs
, rhs
);
14537 zval_ptr_dtor (p_lhs
);
14540 // Take a copy of RHS for LHS
14541 *p_lhs
= zvp_clone_ex (rhs
);
14553 phc_check_invariants (TSRMLS_C
);
14555 default_value
= local___static_value__
;
14556 assert(!default_value
->is_ref
);
14557 default_value
->refcount
++;
14558 if (local_TSa205
!= NULL
)
14560 zval_ptr_dtor (&local_TSa205
);
14562 if (local___static_value__
!= NULL
)
14564 zval_ptr_dtor (&local___static_value__
);
14567 phc_declare_property(ce_reg
, "mLinks", 6, default_value
, ZEND_ACC_PUBLIC TSRMLS_CC
);}{
14568 zval
* default_value
;
14570 zval
* local_TSa206
= NULL
;
14571 zval
* local___static_value__
= NULL
;
14574 if (local_TSa206
!= NULL
)
14576 zval_ptr_dtor (&local_TSa206
);
14577 local_TSa206
= NULL
;
14579 phc_check_invariants (TSRMLS_C
);
14581 // $TSa206 = (array) $TSa206;
14583 if (local_TSa206
== NULL
)
14585 local_TSa206
= EG (uninitialized_zval_ptr
);
14586 local_TSa206
->refcount
++;
14588 zval
** p_lhs
= &local_TSa206
;
14591 if (local_TSa206
== NULL
)
14592 rhs
= EG (uninitialized_zval_ptr
);
14594 rhs
= local_TSa206
;
14598 if ((*p_lhs
)->is_ref
)
14599 overwrite_lhs (*p_lhs
, rhs
);
14602 zval_ptr_dtor (p_lhs
);
14605 // Take a copy of RHS for LHS
14606 *p_lhs
= zvp_clone_ex (rhs
);
14619 assert (IS_ARRAY
>= 0 && IS_ARRAY
<= 6);
14620 if ((*p_lhs
)->type
!= IS_ARRAY
)
14622 sep_copy_on_write (p_lhs
);
14623 convert_to_array (*p_lhs
);
14626 phc_check_invariants (TSRMLS_C
);
14628 // $__static_value__ = $TSa206;
14630 if (local___static_value__
== NULL
)
14632 local___static_value__
= EG (uninitialized_zval_ptr
);
14633 local___static_value__
->refcount
++;
14635 zval
** p_lhs
= &local___static_value__
;
14638 if (local_TSa206
== NULL
)
14639 rhs
= EG (uninitialized_zval_ptr
);
14641 rhs
= local_TSa206
;
14645 if ((*p_lhs
)->is_ref
)
14646 overwrite_lhs (*p_lhs
, rhs
);
14649 zval_ptr_dtor (p_lhs
);
14652 // Take a copy of RHS for LHS
14653 *p_lhs
= zvp_clone_ex (rhs
);
14665 phc_check_invariants (TSRMLS_C
);
14667 default_value
= local___static_value__
;
14668 assert(!default_value
->is_ref
);
14669 default_value
->refcount
++;
14670 if (local_TSa206
!= NULL
)
14672 zval_ptr_dtor (&local_TSa206
);
14674 if (local___static_value__
!= NULL
)
14676 zval_ptr_dtor (&local___static_value__
);
14679 phc_declare_property(ce_reg
, "mTemplates", 10, default_value
, ZEND_ACC_PUBLIC TSRMLS_CC
);}{
14680 zval
* default_value
;
14682 zval
* local_TSa207
= NULL
;
14683 zval
* local___static_value__
= NULL
;
14686 if (local_TSa207
!= NULL
)
14688 zval_ptr_dtor (&local_TSa207
);
14689 local_TSa207
= NULL
;
14691 phc_check_invariants (TSRMLS_C
);
14693 // $TSa207 = (array) $TSa207;
14695 if (local_TSa207
== NULL
)
14697 local_TSa207
= EG (uninitialized_zval_ptr
);
14698 local_TSa207
->refcount
++;
14700 zval
** p_lhs
= &local_TSa207
;
14703 if (local_TSa207
== NULL
)
14704 rhs
= EG (uninitialized_zval_ptr
);
14706 rhs
= local_TSa207
;
14710 if ((*p_lhs
)->is_ref
)
14711 overwrite_lhs (*p_lhs
, rhs
);
14714 zval_ptr_dtor (p_lhs
);
14717 // Take a copy of RHS for LHS
14718 *p_lhs
= zvp_clone_ex (rhs
);
14731 assert (IS_ARRAY
>= 0 && IS_ARRAY
<= 6);
14732 if ((*p_lhs
)->type
!= IS_ARRAY
)
14734 sep_copy_on_write (p_lhs
);
14735 convert_to_array (*p_lhs
);
14738 phc_check_invariants (TSRMLS_C
);
14740 // $__static_value__ = $TSa207;
14742 if (local___static_value__
== NULL
)
14744 local___static_value__
= EG (uninitialized_zval_ptr
);
14745 local___static_value__
->refcount
++;
14747 zval
** p_lhs
= &local___static_value__
;
14750 if (local_TSa207
== NULL
)
14751 rhs
= EG (uninitialized_zval_ptr
);
14753 rhs
= local_TSa207
;
14757 if ((*p_lhs
)->is_ref
)
14758 overwrite_lhs (*p_lhs
, rhs
);
14761 zval_ptr_dtor (p_lhs
);
14764 // Take a copy of RHS for LHS
14765 *p_lhs
= zvp_clone_ex (rhs
);
14777 phc_check_invariants (TSRMLS_C
);
14779 default_value
= local___static_value__
;
14780 assert(!default_value
->is_ref
);
14781 default_value
->refcount
++;
14782 if (local_TSa207
!= NULL
)
14784 zval_ptr_dtor (&local_TSa207
);
14786 if (local___static_value__
!= NULL
)
14788 zval_ptr_dtor (&local___static_value__
);
14791 phc_declare_property(ce_reg
, "mTemplateIds", 12, default_value
, ZEND_ACC_PUBLIC TSRMLS_CC
);}{
14792 zval
* default_value
;
14794 zval
* local_TSa208
= NULL
;
14795 zval
* local___static_value__
= NULL
;
14798 if (local_TSa208
!= NULL
)
14800 zval_ptr_dtor (&local_TSa208
);
14801 local_TSa208
= NULL
;
14803 phc_check_invariants (TSRMLS_C
);
14805 // $TSa208 = (array) $TSa208;
14807 if (local_TSa208
== NULL
)
14809 local_TSa208
= EG (uninitialized_zval_ptr
);
14810 local_TSa208
->refcount
++;
14812 zval
** p_lhs
= &local_TSa208
;
14815 if (local_TSa208
== NULL
)
14816 rhs
= EG (uninitialized_zval_ptr
);
14818 rhs
= local_TSa208
;
14822 if ((*p_lhs
)->is_ref
)
14823 overwrite_lhs (*p_lhs
, rhs
);
14826 zval_ptr_dtor (p_lhs
);
14829 // Take a copy of RHS for LHS
14830 *p_lhs
= zvp_clone_ex (rhs
);
14843 assert (IS_ARRAY
>= 0 && IS_ARRAY
<= 6);
14844 if ((*p_lhs
)->type
!= IS_ARRAY
)
14846 sep_copy_on_write (p_lhs
);
14847 convert_to_array (*p_lhs
);
14850 phc_check_invariants (TSRMLS_C
);
14852 // $__static_value__ = $TSa208;
14854 if (local___static_value__
== NULL
)
14856 local___static_value__
= EG (uninitialized_zval_ptr
);
14857 local___static_value__
->refcount
++;
14859 zval
** p_lhs
= &local___static_value__
;
14862 if (local_TSa208
== NULL
)
14863 rhs
= EG (uninitialized_zval_ptr
);
14865 rhs
= local_TSa208
;
14869 if ((*p_lhs
)->is_ref
)
14870 overwrite_lhs (*p_lhs
, rhs
);
14873 zval_ptr_dtor (p_lhs
);
14876 // Take a copy of RHS for LHS
14877 *p_lhs
= zvp_clone_ex (rhs
);
14889 phc_check_invariants (TSRMLS_C
);
14891 default_value
= local___static_value__
;
14892 assert(!default_value
->is_ref
);
14893 default_value
->refcount
++;
14894 if (local_TSa208
!= NULL
)
14896 zval_ptr_dtor (&local_TSa208
);
14898 if (local___static_value__
!= NULL
)
14900 zval_ptr_dtor (&local___static_value__
);
14903 phc_declare_property(ce_reg
, "mImages", 7, default_value
, ZEND_ACC_PUBLIC TSRMLS_CC
);}{
14904 zval
* default_value
;
14906 zval
* local_TSa209
= NULL
;
14907 zval
* local___static_value__
= NULL
;
14910 if (local_TSa209
!= NULL
)
14912 zval_ptr_dtor (&local_TSa209
);
14913 local_TSa209
= NULL
;
14915 phc_check_invariants (TSRMLS_C
);
14917 // $TSa209 = (array) $TSa209;
14919 if (local_TSa209
== NULL
)
14921 local_TSa209
= EG (uninitialized_zval_ptr
);
14922 local_TSa209
->refcount
++;
14924 zval
** p_lhs
= &local_TSa209
;
14927 if (local_TSa209
== NULL
)
14928 rhs
= EG (uninitialized_zval_ptr
);
14930 rhs
= local_TSa209
;
14934 if ((*p_lhs
)->is_ref
)
14935 overwrite_lhs (*p_lhs
, rhs
);
14938 zval_ptr_dtor (p_lhs
);
14941 // Take a copy of RHS for LHS
14942 *p_lhs
= zvp_clone_ex (rhs
);
14955 assert (IS_ARRAY
>= 0 && IS_ARRAY
<= 6);
14956 if ((*p_lhs
)->type
!= IS_ARRAY
)
14958 sep_copy_on_write (p_lhs
);
14959 convert_to_array (*p_lhs
);
14962 phc_check_invariants (TSRMLS_C
);
14964 // $__static_value__ = $TSa209;
14966 if (local___static_value__
== NULL
)
14968 local___static_value__
= EG (uninitialized_zval_ptr
);
14969 local___static_value__
->refcount
++;
14971 zval
** p_lhs
= &local___static_value__
;
14974 if (local_TSa209
== NULL
)
14975 rhs
= EG (uninitialized_zval_ptr
);
14977 rhs
= local_TSa209
;
14981 if ((*p_lhs
)->is_ref
)
14982 overwrite_lhs (*p_lhs
, rhs
);
14985 zval_ptr_dtor (p_lhs
);
14988 // Take a copy of RHS for LHS
14989 *p_lhs
= zvp_clone_ex (rhs
);
15001 phc_check_invariants (TSRMLS_C
);
15003 default_value
= local___static_value__
;
15004 assert(!default_value
->is_ref
);
15005 default_value
->refcount
++;
15006 if (local_TSa209
!= NULL
)
15008 zval_ptr_dtor (&local_TSa209
);
15010 if (local___static_value__
!= NULL
)
15012 zval_ptr_dtor (&local___static_value__
);
15015 phc_declare_property(ce_reg
, "mExternalLinks", 14, default_value
, ZEND_ACC_PUBLIC TSRMLS_CC
);}{
15016 zval
* default_value
;
15018 zval
* local___static_value__
= NULL
;
15019 // $__static_value__ = False;
15021 if (local___static_value__
== NULL
)
15023 local___static_value__
= EG (uninitialized_zval_ptr
);
15024 local___static_value__
->refcount
++;
15026 zval
** p_lhs
= &local___static_value__
;
15029 if ((*p_lhs
)->is_ref
)
15031 // Always overwrite the current value
15037 ALLOC_INIT_ZVAL (value
);
15038 zval_ptr_dtor (p_lhs
);
15042 ZVAL_BOOL (value
, 0);
15044 phc_check_invariants (TSRMLS_C
);
15046 default_value
= local___static_value__
;
15047 assert(!default_value
->is_ref
);
15048 default_value
->refcount
++;
15049 if (local___static_value__
!= NULL
)
15051 zval_ptr_dtor (&local___static_value__
);
15054 phc_declare_property(ce_reg
, "mNewSection", 11, default_value
, ZEND_ACC_PUBLIC TSRMLS_CC
);}{
15055 zval
* default_value
;
15057 zval
* local___static_value__
= NULL
;
15058 // $__static_value__ = False;
15060 if (local___static_value__
== NULL
)
15062 local___static_value__
= EG (uninitialized_zval_ptr
);
15063 local___static_value__
->refcount
++;
15065 zval
** p_lhs
= &local___static_value__
;
15068 if ((*p_lhs
)->is_ref
)
15070 // Always overwrite the current value
15076 ALLOC_INIT_ZVAL (value
);
15077 zval_ptr_dtor (p_lhs
);
15081 ZVAL_BOOL (value
, 0);
15083 phc_check_invariants (TSRMLS_C
);
15085 default_value
= local___static_value__
;
15086 assert(!default_value
->is_ref
);
15087 default_value
->refcount
++;
15088 if (local___static_value__
!= NULL
)
15090 zval_ptr_dtor (&local___static_value__
);
15093 phc_declare_property(ce_reg
, "mNoGallery", 10, default_value
, ZEND_ACC_PUBLIC TSRMLS_CC
);}{
15094 zval
* default_value
;
15096 zval
* local_TSa210
= NULL
;
15097 zval
* local___static_value__
= NULL
;
15100 if (local_TSa210
!= NULL
)
15102 zval_ptr_dtor (&local_TSa210
);
15103 local_TSa210
= NULL
;
15105 phc_check_invariants (TSRMLS_C
);
15107 // $TSa210 = (array) $TSa210;
15109 if (local_TSa210
== NULL
)
15111 local_TSa210
= EG (uninitialized_zval_ptr
);
15112 local_TSa210
->refcount
++;
15114 zval
** p_lhs
= &local_TSa210
;
15117 if (local_TSa210
== NULL
)
15118 rhs
= EG (uninitialized_zval_ptr
);
15120 rhs
= local_TSa210
;
15124 if ((*p_lhs
)->is_ref
)
15125 overwrite_lhs (*p_lhs
, rhs
);
15128 zval_ptr_dtor (p_lhs
);
15131 // Take a copy of RHS for LHS
15132 *p_lhs
= zvp_clone_ex (rhs
);
15145 assert (IS_ARRAY
>= 0 && IS_ARRAY
<= 6);
15146 if ((*p_lhs
)->type
!= IS_ARRAY
)
15148 sep_copy_on_write (p_lhs
);
15149 convert_to_array (*p_lhs
);
15152 phc_check_invariants (TSRMLS_C
);
15154 // $__static_value__ = $TSa210;
15156 if (local___static_value__
== NULL
)
15158 local___static_value__
= EG (uninitialized_zval_ptr
);
15159 local___static_value__
->refcount
++;
15161 zval
** p_lhs
= &local___static_value__
;
15164 if (local_TSa210
== NULL
)
15165 rhs
= EG (uninitialized_zval_ptr
);
15167 rhs
= local_TSa210
;
15171 if ((*p_lhs
)->is_ref
)
15172 overwrite_lhs (*p_lhs
, rhs
);
15175 zval_ptr_dtor (p_lhs
);
15178 // Take a copy of RHS for LHS
15179 *p_lhs
= zvp_clone_ex (rhs
);
15191 phc_check_invariants (TSRMLS_C
);
15193 default_value
= local___static_value__
;
15194 assert(!default_value
->is_ref
);
15195 default_value
->refcount
++;
15196 if (local_TSa210
!= NULL
)
15198 zval_ptr_dtor (&local_TSa210
);
15200 if (local___static_value__
!= NULL
)
15202 zval_ptr_dtor (&local___static_value__
);
15205 phc_declare_property(ce_reg
, "mHeadItems", 10, default_value
, ZEND_ACC_PUBLIC TSRMLS_CC
);}{
15206 zval
* default_value
;
15208 zval
* local_TSa211
= NULL
;
15209 zval
* local___static_value__
= NULL
;
15212 if (local_TSa211
!= NULL
)
15214 zval_ptr_dtor (&local_TSa211
);
15215 local_TSa211
= NULL
;
15217 phc_check_invariants (TSRMLS_C
);
15219 // $TSa211 = (array) $TSa211;
15221 if (local_TSa211
== NULL
)
15223 local_TSa211
= EG (uninitialized_zval_ptr
);
15224 local_TSa211
->refcount
++;
15226 zval
** p_lhs
= &local_TSa211
;
15229 if (local_TSa211
== NULL
)
15230 rhs
= EG (uninitialized_zval_ptr
);
15232 rhs
= local_TSa211
;
15236 if ((*p_lhs
)->is_ref
)
15237 overwrite_lhs (*p_lhs
, rhs
);
15240 zval_ptr_dtor (p_lhs
);
15243 // Take a copy of RHS for LHS
15244 *p_lhs
= zvp_clone_ex (rhs
);
15257 assert (IS_ARRAY
>= 0 && IS_ARRAY
<= 6);
15258 if ((*p_lhs
)->type
!= IS_ARRAY
)
15260 sep_copy_on_write (p_lhs
);
15261 convert_to_array (*p_lhs
);
15264 phc_check_invariants (TSRMLS_C
);
15266 // $__static_value__ = $TSa211;
15268 if (local___static_value__
== NULL
)
15270 local___static_value__
= EG (uninitialized_zval_ptr
);
15271 local___static_value__
->refcount
++;
15273 zval
** p_lhs
= &local___static_value__
;
15276 if (local_TSa211
== NULL
)
15277 rhs
= EG (uninitialized_zval_ptr
);
15279 rhs
= local_TSa211
;
15283 if ((*p_lhs
)->is_ref
)
15284 overwrite_lhs (*p_lhs
, rhs
);
15287 zval_ptr_dtor (p_lhs
);
15290 // Take a copy of RHS for LHS
15291 *p_lhs
= zvp_clone_ex (rhs
);
15303 phc_check_invariants (TSRMLS_C
);
15305 default_value
= local___static_value__
;
15306 assert(!default_value
->is_ref
);
15307 default_value
->refcount
++;
15308 if (local_TSa211
!= NULL
)
15310 zval_ptr_dtor (&local_TSa211
);
15312 if (local___static_value__
!= NULL
)
15314 zval_ptr_dtor (&local___static_value__
);
15317 phc_declare_property(ce_reg
, "mOutputHooks", 12, default_value
, ZEND_ACC_PUBLIC TSRMLS_CC
);}{
15318 zval
* default_value
;
15320 zval
* local_TSa212
= NULL
;
15321 zval
* local___static_value__
= NULL
;
15324 if (local_TSa212
!= NULL
)
15326 zval_ptr_dtor (&local_TSa212
);
15327 local_TSa212
= NULL
;
15329 phc_check_invariants (TSRMLS_C
);
15331 // $TSa212 = (array) $TSa212;
15333 if (local_TSa212
== NULL
)
15335 local_TSa212
= EG (uninitialized_zval_ptr
);
15336 local_TSa212
->refcount
++;
15338 zval
** p_lhs
= &local_TSa212
;
15341 if (local_TSa212
== NULL
)
15342 rhs
= EG (uninitialized_zval_ptr
);
15344 rhs
= local_TSa212
;
15348 if ((*p_lhs
)->is_ref
)
15349 overwrite_lhs (*p_lhs
, rhs
);
15352 zval_ptr_dtor (p_lhs
);
15355 // Take a copy of RHS for LHS
15356 *p_lhs
= zvp_clone_ex (rhs
);
15369 assert (IS_ARRAY
>= 0 && IS_ARRAY
<= 6);
15370 if ((*p_lhs
)->type
!= IS_ARRAY
)
15372 sep_copy_on_write (p_lhs
);
15373 convert_to_array (*p_lhs
);
15376 phc_check_invariants (TSRMLS_C
);
15378 // $__static_value__ = $TSa212;
15380 if (local___static_value__
== NULL
)
15382 local___static_value__
= EG (uninitialized_zval_ptr
);
15383 local___static_value__
->refcount
++;
15385 zval
** p_lhs
= &local___static_value__
;
15388 if (local_TSa212
== NULL
)
15389 rhs
= EG (uninitialized_zval_ptr
);
15391 rhs
= local_TSa212
;
15395 if ((*p_lhs
)->is_ref
)
15396 overwrite_lhs (*p_lhs
, rhs
);
15399 zval_ptr_dtor (p_lhs
);
15402 // Take a copy of RHS for LHS
15403 *p_lhs
= zvp_clone_ex (rhs
);
15415 phc_check_invariants (TSRMLS_C
);
15417 default_value
= local___static_value__
;
15418 assert(!default_value
->is_ref
);
15419 default_value
->refcount
++;
15420 if (local_TSa212
!= NULL
)
15422 zval_ptr_dtor (&local_TSa212
);
15424 if (local___static_value__
!= NULL
)
15426 zval_ptr_dtor (&local___static_value__
);
15429 phc_declare_property(ce_reg
, "mWarnings", 9, default_value
, ZEND_ACC_PUBLIC TSRMLS_CC
);}{
15430 zval
* default_value
;
15432 zval
* local_TSa213
= NULL
;
15433 zval
* local___static_value__
= NULL
;
15436 if (local_TSa213
!= NULL
)
15438 zval_ptr_dtor (&local_TSa213
);
15439 local_TSa213
= NULL
;
15441 phc_check_invariants (TSRMLS_C
);
15443 // $TSa213 = (array) $TSa213;
15445 if (local_TSa213
== NULL
)
15447 local_TSa213
= EG (uninitialized_zval_ptr
);
15448 local_TSa213
->refcount
++;
15450 zval
** p_lhs
= &local_TSa213
;
15453 if (local_TSa213
== NULL
)
15454 rhs
= EG (uninitialized_zval_ptr
);
15456 rhs
= local_TSa213
;
15460 if ((*p_lhs
)->is_ref
)
15461 overwrite_lhs (*p_lhs
, rhs
);
15464 zval_ptr_dtor (p_lhs
);
15467 // Take a copy of RHS for LHS
15468 *p_lhs
= zvp_clone_ex (rhs
);
15481 assert (IS_ARRAY
>= 0 && IS_ARRAY
<= 6);
15482 if ((*p_lhs
)->type
!= IS_ARRAY
)
15484 sep_copy_on_write (p_lhs
);
15485 convert_to_array (*p_lhs
);
15488 phc_check_invariants (TSRMLS_C
);
15490 // $__static_value__ = $TSa213;
15492 if (local___static_value__
== NULL
)
15494 local___static_value__
= EG (uninitialized_zval_ptr
);
15495 local___static_value__
->refcount
++;
15497 zval
** p_lhs
= &local___static_value__
;
15500 if (local_TSa213
== NULL
)
15501 rhs
= EG (uninitialized_zval_ptr
);
15503 rhs
= local_TSa213
;
15507 if ((*p_lhs
)->is_ref
)
15508 overwrite_lhs (*p_lhs
, rhs
);
15511 zval_ptr_dtor (p_lhs
);
15514 // Take a copy of RHS for LHS
15515 *p_lhs
= zvp_clone_ex (rhs
);
15527 phc_check_invariants (TSRMLS_C
);
15529 default_value
= local___static_value__
;
15530 assert(!default_value
->is_ref
);
15531 default_value
->refcount
++;
15532 if (local_TSa213
!= NULL
)
15534 zval_ptr_dtor (&local_TSa213
);
15536 if (local___static_value__
!= NULL
)
15538 zval_ptr_dtor (&local___static_value__
);
15541 phc_declare_property(ce_reg
, "mSections", 9, default_value
, ZEND_ACC_PUBLIC TSRMLS_CC
);}{
15542 zval
* default_value
;
15544 zval
* local_TSa214
= NULL
;
15545 zval
* local___static_value__
= NULL
;
15548 if (local_TSa214
!= NULL
)
15550 zval_ptr_dtor (&local_TSa214
);
15551 local_TSa214
= NULL
;
15553 phc_check_invariants (TSRMLS_C
);
15555 // $TSa214 = (array) $TSa214;
15557 if (local_TSa214
== NULL
)
15559 local_TSa214
= EG (uninitialized_zval_ptr
);
15560 local_TSa214
->refcount
++;
15562 zval
** p_lhs
= &local_TSa214
;
15565 if (local_TSa214
== NULL
)
15566 rhs
= EG (uninitialized_zval_ptr
);
15568 rhs
= local_TSa214
;
15572 if ((*p_lhs
)->is_ref
)
15573 overwrite_lhs (*p_lhs
, rhs
);
15576 zval_ptr_dtor (p_lhs
);
15579 // Take a copy of RHS for LHS
15580 *p_lhs
= zvp_clone_ex (rhs
);
15593 assert (IS_ARRAY
>= 0 && IS_ARRAY
<= 6);
15594 if ((*p_lhs
)->type
!= IS_ARRAY
)
15596 sep_copy_on_write (p_lhs
);
15597 convert_to_array (*p_lhs
);
15600 phc_check_invariants (TSRMLS_C
);
15602 // $__static_value__ = $TSa214;
15604 if (local___static_value__
== NULL
)
15606 local___static_value__
= EG (uninitialized_zval_ptr
);
15607 local___static_value__
->refcount
++;
15609 zval
** p_lhs
= &local___static_value__
;
15612 if (local_TSa214
== NULL
)
15613 rhs
= EG (uninitialized_zval_ptr
);
15615 rhs
= local_TSa214
;
15619 if ((*p_lhs
)->is_ref
)
15620 overwrite_lhs (*p_lhs
, rhs
);
15623 zval_ptr_dtor (p_lhs
);
15626 // Take a copy of RHS for LHS
15627 *p_lhs
= zvp_clone_ex (rhs
);
15639 phc_check_invariants (TSRMLS_C
);
15641 default_value
= local___static_value__
;
15642 assert(!default_value
->is_ref
);
15643 default_value
->refcount
++;
15644 if (local_TSa214
!= NULL
)
15646 zval_ptr_dtor (&local_TSa214
);
15648 if (local___static_value__
!= NULL
)
15650 zval_ptr_dtor (&local___static_value__
);
15653 phc_declare_property(ce_reg
, "mProperties", 11, default_value
, ZEND_ACC_PUBLIC TSRMLS_CC
);}{
15654 zval
* default_value
;
15656 zval
* local___static_value__
= NULL
;
15657 // $__static_value__ = '';
15659 if (local___static_value__
== NULL
)
15661 local___static_value__
= EG (uninitialized_zval_ptr
);
15662 local___static_value__
->refcount
++;
15664 zval
** p_lhs
= &local___static_value__
;
15667 if ((*p_lhs
)->is_ref
)
15669 // Always overwrite the current value
15675 ALLOC_INIT_ZVAL (value
);
15676 zval_ptr_dtor (p_lhs
);
15680 ZVAL_STRINGL(value
, "", 0, 1);
15682 phc_check_invariants (TSRMLS_C
);
15684 default_value
= local___static_value__
;
15685 assert(!default_value
->is_ref
);
15686 default_value
->refcount
++;
15687 if (local___static_value__
!= NULL
)
15689 zval_ptr_dtor (&local___static_value__
);
15692 phc_declare_property(ce_reg
, "mIndexPolicy", 12, default_value
, ZEND_ACC_PRIVATE TSRMLS_CC
);}{
15693 zval
* default_value
;
15695 zval
* local___static_value__
= NULL
;
15696 // $__static_value__ = False;
15698 if (local___static_value__
== NULL
)
15700 local___static_value__
= EG (uninitialized_zval_ptr
);
15701 local___static_value__
->refcount
++;
15703 zval
** p_lhs
= &local___static_value__
;
15706 if ((*p_lhs
)->is_ref
)
15708 // Always overwrite the current value
15714 ALLOC_INIT_ZVAL (value
);
15715 zval_ptr_dtor (p_lhs
);
15719 ZVAL_BOOL (value
, 0);
15721 phc_check_invariants (TSRMLS_C
);
15723 default_value
= local___static_value__
;
15724 assert(!default_value
->is_ref
);
15725 default_value
->refcount
++;
15726 if (local___static_value__
!= NULL
)
15728 zval_ptr_dtor (&local___static_value__
);
15731 phc_declare_property(ce_reg
, "displayTitle", 12, default_value
, ZEND_ACC_PRIVATE TSRMLS_CC
);}}return SUCCESS
;}// ArgInfo structures (necessary to support compile time pass-by-reference)
15732 ZEND_BEGIN_ARG_INFO_EX(app___MAIN___arg_info
, 0, 0, 0)
15733 ZEND_END_ARG_INFO()
15735 static function_entry app_functions
[] = {
15736 PHP_FE(__MAIN__
, app___MAIN___arg_info
)
15737 { NULL
, NULL
, NULL
}
15739 // Register the module itself with PHP
15740 zend_module_entry app_module_entry
= {
15741 STANDARD_MODULE_HEADER
,
15744 PHP_MINIT(app
), /* MINIT */
15745 NULL
, /* MSHUTDOWN */
15747 NULL
, /* RSHUTDOWN */
15750 STANDARD_MODULE_PROPERTIES
15752 #include <sapi/embed/php_embed.h>
15753 #include <signal.h>
15755 void sighandler(int signum
)
15760 printf("SIGABRT received!\n");
15763 printf("SIGSEGV received!\n");
15766 printf("Unknown signal received!\n");
15770 printf("This could be a bug in phc. If you suspect it is, please email\n");
15771 printf("a bug report to phc-general@phpcompiler.org.\n");
15776 main (int argc
, char* argv
[])
15778 int phc_exit_status
;
15779 signal(SIGABRT
, sighandler
);
15780 signal(SIGSEGV
, sighandler
);
15783 int dealloc_pools
= 1;
15784 php_embed_init (argc
, argv PTSRMLS_CC
);
15788 // initialize the phc runtime
15791 // load the compiled extension
15792 zend_startup_module (&app_module_entry
);
15795 ZVAL_STRING (&main_name
, "__MAIN__", NULL
);
15799 // Use standard errors, on stdout
15800 zend_alter_ini_entry ("report_zend_debug", sizeof("report_zend_debug"), "0", sizeof("0") - 1, PHP_INI_ALL
, PHP_INI_STAGE_RUNTIME
);
15801 zend_alter_ini_entry ("display_startup_errors", sizeof("display_startup_errors"), "1", sizeof("1") - 1, PHP_INI_ALL
, PHP_INI_STAGE_RUNTIME
);
15803 // initialize all the constants
15804 saved_refcount
= 0;
15807 int success
= call_user_function(
15808 EG (function_table
),
15816 assert (success
== SUCCESS
);
15818 // finalize the runtime
15819 finalize_runtime();
15830 phc_exit_status
= EG(exit_status
);
15831 php_embed_shutdown (TSRMLS_C
);
15833 return phc_exit_status
;