@@ -20,18 +20,18 @@ API adjustment to the old output control code:
20
20
21
21
Starting an internal handler whithout context:
22
22
// php_ob_set_internal_handler(my_php_output_handler_func_t, buffer_size, "output handler name", erase TSRMLS_CC);
23
- php_output_start_internal(handler_name_zval , my_php_output_handler_func_t, chunk_size, flags TSRMLS_CC);
23
+ php_output_start_internal(handler_name, handler_name_len , my_php_output_handler_func_t, chunk_size, flags TSRMLS_CC);
24
24
25
25
Starting an internal handler with context:
26
26
// not possible with old API
27
27
php_output_handler *h;
28
- h = php_output_handler_create_internal(handler_name_zval , my_php_output_handler_context_func_t, chunk_size, flags TSRMLS_CC);
28
+ h = php_output_handler_create_internal(handler_name, handler_name_len , my_php_output_handler_context_func_t, chunk_size, flags TSRMLS_CC);
29
29
php_output_handler_set_context(h, my_context, my_context_dtor);
30
30
php_output_handler_start(h TSRMLS_CC);
31
31
32
32
Testing whether a certain output handler has already been started:
33
33
// php_ob_handler_used("output handler name" TSRMLS_CC);
34
- php_output_handler_started(handler_name_zval TSRMLS_CC);
34
+ php_output_handler_started(handler_name, handler_name_len TSRMLS_CC);
35
35
36
36
Flushing one output buffer:
37
37
// php_ob_end_buffer(1, 1 TSRMLS_CC);
@@ -79,299 +79,15 @@ API adjustment to the old output control code:
79
79
80
80
Issue a warning because of an output handler conflict:
81
81
// php_ob_init_conflict("to be started handler name", "to be tested if already started handler name" TSRMLS_CC);
82
- php_output_handler_conflict(new_handler_name_zval, set_handler_name_zval TSRMLS_CC);
82
+ php_output_handler_conflict(new_handler_name, new_handler_name_len, set_handler_name, set_handler_name_len TSRMLS_CC);
83
83
84
84
Registering a conflict checking function, which will be checked prior starting the handler:
85
85
// not possible with old API, unless hardcoding into output.c
86
- php_output_handler_conflict_register(handler_name_zval , my_php_output_handler_conflict_check_t TSRMLS_CC);
86
+ php_output_handler_conflict_register(handler_name, handler_name_len , my_php_output_handler_conflict_check_t TSRMLS_CC);
87
87
88
88
Registering a reverse conflict checking function, which will be checked prior starting the specified foreign handler:
89
89
// not possible with old API
90
- php_output_handler_reverse_conflict_register(foreign_handler_name_zval, my_php_output_handler_conflict_check_t TSRMLS_CC);
91
-
92
- Facilitating a context from within an output handler callable with ob_start():
93
- // not possible with old API
94
- php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_GET_OPAQ, (void *) &custom_ctx_ptr_ptr TSRMLS_CC);
95
-
96
- Disabling of the output handler by itself:
97
- //not possible with old API
98
- php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_DISABLE, NULL TSRMLS_CC);
99
-
100
- Marking an output handler immutable by itself because of irreversibility of its operation:
101
- // not possible with old API
102
- php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_IMMUTABLE, NULL TSRMLS_CC);
103
-
104
- Restarting the output handler because of a CLEAN operation:
105
- // not possible with old API
106
- if (flags & PHP_OUTPUT_HANDLER_CLEAN) { ... }
107
-
108
- Recognizing by the output handler itself if it gets discarded:
109
- // not possible with old API
110
- if ((flags & PHP_OUTPUT_HANDLER_CLEAN) && (flags & PHP_OUTPUT_HANDLER_FINAL)) { ... }
111
-
112
-
113
- Output handler hooks
114
-
115
- The output handler can change its abilities at runtime. Eg. the gz handler can
116
- remove the CLEANABLE and REMOVABLE bits when the first output has passed through it;
117
- or handlers implemented in C to be used with ob_start() can contain a non-global
118
- context:
119
- PHP_OUTPUT_HANDLER_HOOK_GET_OPAQ
120
- pass a void*** pointer as second arg to receive the address of a pointer
121
- pointer to the opaque field of the output handler context
122
- PHP_OUTPUT_HANDLER_HOOK_GET_FLAGS
123
- pass a int* pointer as second arg to receive the flags set for the output handler
124
- PHP_OUTPUT_HANDLER_HOOK_GET_LEVEL
125
- pass a int* pointer as second arg to receive the level of this output handler
126
- (starts with 0)
127
- PHP_OUTPUT_HANDLER_HOOK_IMMUTABLE
128
- the second arg is ignored; marks the output handler to be neither cleanable
129
- nor removable
130
- PHP_OUTPUT_HANDLER_HOOK_DISABLE
131
- the second arg is ignored; marks the output handler as disabled
132
-
133
-
134
- Open questions
135
-
136
- Should the userland API be adjusted and unified?
137
-
138
- Many bits of the manual (and very first implementation) do not comply
139
- with the behaviour of the current (to be obsoleted) code, thus should
140
- the manual or the behaviour be adjusted?
141
-
142
- END
143
- $Id: README.NEW-OUTPUT-API 219039 2006-08-30 07:39:09Z mike $
144
-
145
-
146
- API adjustment to the old output control code:
147
-
148
- Everything now resides beneath the php_output namespace,
149
- and there's an API call for every output handler op.
150
-
151
- Checking output control layers status:
152
- // Using OG()
153
- php_output_get_status(TSRMLS_C);
154
-
155
- Starting the default output handler:
156
- // php_start_ob_buffer(NULL, 0, 1 TSRMLS_CC);
157
- php_output_start_default(TSRMLS_C);
158
-
159
- Starting an user handler by zval:
160
- // php_start_ob_buffer(zhandler, chunk_size, erase TSRMLS_CC);
161
- php_output_start_user(zhandler, chunk_size, flags TSRMLS_CC);
162
-
163
- Starting an internal handler whithout context:
164
- // php_ob_set_internal_handler(my_php_output_handler_func_t, buffer_size, "output handler name", erase TSRMLS_CC);
165
- php_output_start_internal(handler_name_zval, my_php_output_handler_func_t, chunk_size, flags TSRMLS_CC);
166
-
167
- Starting an internal handler with context:
168
- // not possible with old API
169
- php_output_handler *h;
170
- h = php_output_handler_create_internal(handler_name_zval, my_php_output_handler_context_func_t, chunk_size, flags TSRMLS_CC);
171
- php_output_handler_set_context(h, my_context, my_context_dtor);
172
- php_output_handler_start(h TSRMLS_CC);
173
-
174
- Testing whether a certain output handler has already been started:
175
- // php_ob_handler_used("output handler name" TSRMLS_CC);
176
- php_output_handler_started(handler_name_zval TSRMLS_CC);
177
-
178
- Flushing one output buffer:
179
- // php_ob_end_buffer(1, 1 TSRMLS_CC);
180
- php_output_flush(TSRMLS_C);
181
-
182
- Flushing all output buffers:
183
- // not possible with old API
184
- php_output_flush_all(TSRMLS_C);
185
-
186
- Cleaning one output buffer:
187
- // php_ob_end_buffer(0, 1 TSRMLS_CC);
188
- php_output_clean(TSRMLS_C);
189
-
190
- Cleaning all output buffers:
191
- // not possible with old API
192
- php_output_clean_all(TSRMLS_C);
193
-
194
- Discarding one output buffer:
195
- // php_ob_end_buffer(0, 0 TSRMLS_CC);
196
- php_output_discard(TSRMLS_C);
197
-
198
- Discarding all output buffers:
199
- // php_ob_end_buffers(0 TSRMLS_CC);
200
- php_output_discard_all(TSRMLS_C);
201
-
202
- Stopping (and dropping) one output buffer:
203
- // php_ob_end_buffer(1, 0 TSRMLS_CC)
204
- php_output_end(TSRMLS_C);
205
-
206
- Stopping (and dropping) all output buffers:
207
- // php_ob_end_buffers(1, 0 TSRMLS_CC);
208
- php_output_end_all(TSRMLS_C);
209
-
210
- Retrieving output buffers contents:
211
- // php_ob_get_buffer(zstring TSRMLS_CC);
212
- php_output_get_contents(zstring TSRMLS_CC);
213
-
214
- Retrieving output buffers length:
215
- // php_ob_get_length(zlength TSRMLS_CC);
216
- php_output_get_length(zlength TSRMLS_CC);
217
-
218
- Retrieving output buffering level:
219
- // OG(nesting_level);
220
- php_output_get_level(TSRMLS_C);
221
-
222
- Issue a warning because of an output handler conflict:
223
- // php_ob_init_conflict("to be started handler name", "to be tested if already started handler name" TSRMLS_CC);
224
- php_output_handler_conflict(new_handler_name_zval, set_handler_name_zval TSRMLS_CC);
225
-
226
- Registering a conflict checking function, which will be checked prior starting the handler:
227
- // not possible with old API, unless hardcoding into output.c
228
- php_output_handler_conflict_register(handler_name_zval, my_php_output_handler_conflict_check_t TSRMLS_CC);
229
-
230
- Registering a reverse conflict checking function, which will be checked prior starting the specified foreign handler:
231
- // not possible with old API
232
- php_output_handler_reverse_conflict_register(foreign_handler_name_zval, my_php_output_handler_conflict_check_t TSRMLS_CC);
233
-
234
- Facilitating a context from within an output handler callable with ob_start():
235
- // not possible with old API
236
- php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_GET_OPAQ, (void *) &custom_ctx_ptr_ptr TSRMLS_CC);
237
-
238
- Disabling of the output handler by itself:
239
- //not possible with old API
240
- php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_DISABLE, NULL TSRMLS_CC);
241
-
242
- Marking an output handler immutable by itself because of irreversibility of its operation:
243
- // not possible with old API
244
- php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_IMMUTABLE, NULL TSRMLS_CC);
245
-
246
- Restarting the output handler because of a CLEAN operation:
247
- // not possible with old API
248
- if (flags & PHP_OUTPUT_HANDLER_CLEAN) { ... }
249
-
250
- Recognizing by the output handler itself if it gets discarded:
251
- // not possible with old API
252
- if ((flags & PHP_OUTPUT_HANDLER_CLEAN) && (flags & PHP_OUTPUT_HANDLER_FINAL)) { ... }
253
-
254
-
255
- Output handler hooks
256
-
257
- The output handler can change its abilities at runtime. Eg. the gz handler can
258
- remove the CLEANABLE and REMOVABLE bits when the first output has passed through it;
259
- or handlers implemented in C to be used with ob_start() can contain a non-global
260
- context:
261
- PHP_OUTPUT_HANDLER_HOOK_GET_OPAQ
262
- pass a void*** pointer as second arg to receive the address of a pointer
263
- pointer to the opaque field of the output handler context
264
- PHP_OUTPUT_HANDLER_HOOK_GET_FLAGS
265
- pass a int* pointer as second arg to receive the flags set for the output handler
266
- PHP_OUTPUT_HANDLER_HOOK_GET_LEVEL
267
- pass a int* pointer as second arg to receive the level of this output handler
268
- (starts with 0)
269
- PHP_OUTPUT_HANDLER_HOOK_IMMUTABLE
270
- the second arg is ignored; marks the output handler to be neither cleanable
271
- nor removable
272
- PHP_OUTPUT_HANDLER_HOOK_DISABLE
273
- the second arg is ignored; marks the output handler as disabled
274
-
275
-
276
- Open questions
277
-
278
- Should the userland API be adjusted and unified?
279
-
280
- Many bits of the manual (and very first implementation) do not comply
281
- with the behaviour of the current (to be obsoleted) code, thus should
282
- the manual or the behaviour be adjusted?
283
-
284
- END
285
- $Id: README.NEW-OUTPUT-API 219039 2006-08-30 07:39:09Z mike $
286
-
287
-
288
- API adjustment to the old output control code:
289
-
290
- Everything now resides beneath the php_output namespace,
291
- and there's an API call for every output handler op.
292
-
293
- Checking output control layers status:
294
- // Using OG()
295
- php_output_get_status(TSRMLS_C);
296
-
297
- Starting the default output handler:
298
- // php_start_ob_buffer(NULL, 0, 1 TSRMLS_CC);
299
- php_output_start_default(TSRMLS_C);
300
-
301
- Starting an user handler by zval:
302
- // php_start_ob_buffer(zhandler, chunk_size, erase TSRMLS_CC);
303
- php_output_start_user(zhandler, chunk_size, flags TSRMLS_CC);
304
-
305
- Starting an internal handler whithout context:
306
- // php_ob_set_internal_handler(my_php_output_handler_func_t, buffer_size, "output handler name", erase TSRMLS_CC);
307
- php_output_start_internal(handler_name_zval, my_php_output_handler_func_t, chunk_size, flags TSRMLS_CC);
308
-
309
- Starting an internal handler with context:
310
- // not possible with old API
311
- php_output_handler *h;
312
- h = php_output_handler_create_internal(handler_name_zval, my_php_output_handler_context_func_t, chunk_size, flags TSRMLS_CC);
313
- php_output_handler_set_context(h, my_context, my_context_dtor);
314
- php_output_handler_start(h TSRMLS_CC);
315
-
316
- Testing whether a certain output handler has already been started:
317
- // php_ob_handler_used("output handler name" TSRMLS_CC);
318
- php_output_handler_started(handler_name_zval TSRMLS_CC);
319
-
320
- Flushing one output buffer:
321
- // php_ob_end_buffer(1, 1 TSRMLS_CC);
322
- php_output_flush(TSRMLS_C);
323
-
324
- Flushing all output buffers:
325
- // not possible with old API
326
- php_output_flush_all(TSRMLS_C);
327
-
328
- Cleaning one output buffer:
329
- // php_ob_end_buffer(0, 1 TSRMLS_CC);
330
- php_output_clean(TSRMLS_C);
331
-
332
- Cleaning all output buffers:
333
- // not possible with old API
334
- php_output_clean_all(TSRMLS_C);
335
-
336
- Discarding one output buffer:
337
- // php_ob_end_buffer(0, 0 TSRMLS_CC);
338
- php_output_discard(TSRMLS_C);
339
-
340
- Discarding all output buffers:
341
- // php_ob_end_buffers(0 TSRMLS_CC);
342
- php_output_discard_all(TSRMLS_C);
343
-
344
- Stopping (and dropping) one output buffer:
345
- // php_ob_end_buffer(1, 0 TSRMLS_CC)
346
- php_output_end(TSRMLS_C);
347
-
348
- Stopping (and dropping) all output buffers:
349
- // php_ob_end_buffers(1, 0 TSRMLS_CC);
350
- php_output_end_all(TSRMLS_C);
351
-
352
- Retrieving output buffers contents:
353
- // php_ob_get_buffer(zstring TSRMLS_CC);
354
- php_output_get_contents(zstring TSRMLS_CC);
355
-
356
- Retrieving output buffers length:
357
- // php_ob_get_length(zlength TSRMLS_CC);
358
- php_output_get_length(zlength TSRMLS_CC);
359
-
360
- Retrieving output buffering level:
361
- // OG(nesting_level);
362
- php_output_get_level(TSRMLS_C);
363
-
364
- Issue a warning because of an output handler conflict:
365
- // php_ob_init_conflict("to be started handler name", "to be tested if already started handler name" TSRMLS_CC);
366
- php_output_handler_conflict(new_handler_name_zval, set_handler_name_zval TSRMLS_CC);
367
-
368
- Registering a conflict checking function, which will be checked prior starting the handler:
369
- // not possible with old API, unless hardcoding into output.c
370
- php_output_handler_conflict_register(handler_name_zval, my_php_output_handler_conflict_check_t TSRMLS_CC);
371
-
372
- Registering a reverse conflict checking function, which will be checked prior starting the specified foreign handler:
373
- // not possible with old API
374
- php_output_handler_reverse_conflict_register(foreign_handler_name_zval, my_php_output_handler_conflict_check_t TSRMLS_CC);
90
+ php_output_handler_reverse_conflict_register(foreign_handler_name, foreign_handler_name_len, my_php_output_handler_conflict_check_t TSRMLS_CC);
375
91
376
92
Facilitating a context from within an output handler callable with ob_start():
377
93
// not possible with old API
0 commit comments