mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-19 23:16:38 +00:00
Compare commits
434
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5c0e6343a3 | ||
|
|
6d85947b52 | ||
|
|
4c961e9045 | ||
|
|
d733338225 | ||
|
|
e71ee33358 | ||
|
|
00fabe553a | ||
|
|
e6dc3a5cbc | ||
|
|
c02f6724a8 | ||
|
|
f20dd1f9ae | ||
|
|
5f790678ec | ||
|
|
a3bf7aa4fe | ||
|
|
6106c44c10 | ||
|
|
e670162315 | ||
|
|
ce1bd65d29 | ||
|
|
a4ff8bce62 | ||
|
|
e1ce0a64ea | ||
|
|
336b5af34b | ||
|
|
a4d1188313 | ||
|
|
09d8bbb2ee | ||
|
|
0891e86ed8 | ||
|
|
e46fee1d1a | ||
|
|
c06a26a524 | ||
|
|
3b38626603 | ||
|
|
2b48156eab | ||
|
|
92ba590555 | ||
|
|
1fe5265c3e | ||
|
|
112ac7e978 | ||
|
|
af2d266a09 | ||
|
|
4e606e3ceb | ||
|
|
96bb25e8e7 | ||
|
|
865f85718f | ||
|
|
9c60bd8df7 | ||
|
|
a8e80ec235 | ||
|
|
0488a86634 | ||
|
|
ced29dd706 | ||
|
|
9b07568c43 | ||
|
|
0cc45e7bdb | ||
|
|
10a9634bc9 | ||
|
|
eb5e97adf5 | ||
|
|
419f589580 | ||
|
|
9ea7a70e24 | ||
|
|
e64734f986 | ||
|
|
22458ed4d5 | ||
|
|
86544f5971 | ||
|
|
5a3a34e3e6 | ||
|
|
89bd3af6b9 | ||
|
|
d27d572a7d | ||
|
|
2bb9bbb803 | ||
|
|
08e1471c16 | ||
|
|
53324e8830 | ||
|
|
698539fa79 | ||
|
|
6b990988f1 | ||
|
|
6ee4060bfa | ||
|
|
c6e852d7db | ||
|
|
ffdd175918 | ||
|
|
5a4a66cdd5 | ||
|
|
6b730a04ae | ||
|
|
7f79e86886 | ||
|
|
7d0eedf08c | ||
|
|
f3448471df | ||
|
|
d52e132203 | ||
|
|
8661e8d298 | ||
|
|
8a142cb861 | ||
|
|
a46cb6b513 | ||
|
|
06c987663a | ||
|
|
ae4ae5a313 | ||
|
|
c4c6b69b64 | ||
|
|
84f3b13264 | ||
|
|
49418ce7da | ||
|
|
d4746a659e | ||
|
|
42c4bafbbd | ||
|
|
d596ea742a | ||
|
|
d47e50a9ff | ||
|
|
cfd930d218 | ||
|
|
4029454a0d | ||
|
|
ec54570362 | ||
|
|
3896e7403d | ||
|
|
ddc9246071 | ||
|
|
f310305fc2 | ||
|
|
2cfb5e4254 | ||
|
|
33ac0d0e33 | ||
|
|
d686b7579a | ||
|
|
d1c912628d | ||
|
|
24b8bc3489 | ||
|
|
8fcd33ed18 | ||
|
|
3d5f729181 | ||
|
|
0da5464a81 | ||
|
|
83051b1a86 | ||
|
|
1d9c49bb3c | ||
|
|
0296501274 | ||
|
|
22df3125d5 | ||
|
|
d652e02235 | ||
|
|
205775507a | ||
|
|
764a95f6f3 | ||
|
|
f1e02c5cc7 | ||
|
|
4d3944f941 | ||
|
|
5eb64a4957 | ||
|
|
899bc2f582 | ||
|
|
d24c14cb59 | ||
|
|
afcb62ba1e | ||
|
|
7aaef918a6 | ||
|
|
90906a91e9 | ||
|
|
748dd20476 | ||
|
|
9daa864c4f | ||
|
|
e692080fc5 | ||
|
|
cac310d87e | ||
|
|
442fa8dc1b | ||
|
|
f7d82d0e0d | ||
|
|
0d4720a61b | ||
|
|
9e5313fdca | ||
|
|
32447e4902 | ||
|
|
dbddbb6e34 | ||
|
|
178ee9325d | ||
|
|
3c9e1e6d70 | ||
|
|
73a413bdea | ||
|
|
481f77890d | ||
|
|
20f6aaeca9 | ||
|
|
aeae0d1bad | ||
|
|
3e5ac35bd9 | ||
|
|
761dbeedbb | ||
|
|
f8b17007e0 | ||
|
|
9badd4f0fb | ||
|
|
6b1d256af5 | ||
|
|
68cd943189 | ||
|
|
5afc8e2c83 | ||
|
|
ae01c146d1 | ||
|
|
a8be1c1d4b | ||
|
|
0fb528edee | ||
|
|
b65a473efb | ||
|
|
d78fb2b14a | ||
|
|
6d1d27bc3a | ||
|
|
707980c2be | ||
|
|
badf05a8ea | ||
|
|
b690b940ca | ||
|
|
5441c86936 | ||
|
|
a14dd7502b | ||
|
|
c42d8b3776 | ||
|
|
7deae5022d | ||
|
|
9ef6a73dee | ||
|
|
8454cca44c | ||
|
|
a259f797bf | ||
|
|
6ba6263817 | ||
|
|
24ef65019f | ||
|
|
c453a8fcda | ||
|
|
7c1d43dd95 | ||
|
|
d4cca6da93 | ||
|
|
d7b1fa9d35 | ||
|
|
4a0b4494d4 | ||
|
|
41406516b6 | ||
|
|
2a043ed2d3 | ||
|
|
38f6c131e5 | ||
|
|
b472636375 | ||
|
|
047d6f2855 | ||
|
|
b61d7501c9 | ||
|
|
4cd5db922b | ||
|
|
cf140b3bf7 | ||
|
|
c0a8ce2f61 | ||
|
|
0ab82cecc2 | ||
|
|
9b334da667 | ||
|
|
fb80ebe102 | ||
|
|
4b5666a539 | ||
|
|
2613069cd4 | ||
|
|
46c0f21386 | ||
|
|
e2d9e0ae70 | ||
|
|
dbe35d87d6 | ||
|
|
e750930899 | ||
|
|
54caf22325 | ||
|
|
42d25dc2b2 | ||
|
|
901fc6f3a4 | ||
|
|
9cfcc89a0b | ||
|
|
435405f5da | ||
|
|
bb3faf2d25 | ||
|
|
a622dd6bfb | ||
|
|
66ef4d185c | ||
|
|
ce03ced4d7 | ||
|
|
ba6ee3fc06 | ||
|
|
3aa95c59cc | ||
|
|
6ebe80be5d | ||
|
|
6356bcbbb9 | ||
|
|
ce2fbe1931 | ||
|
|
5efee3d587 | ||
|
|
b7385f02fd | ||
|
|
4d005a8e65 | ||
|
|
ce136a825c | ||
|
|
0d468290be | ||
|
|
d6458c3b1e | ||
|
|
00191c3c34 | ||
|
|
c4be9c3890 | ||
|
|
58f13c3c9f | ||
|
|
bccf2cea5d | ||
|
|
f3009cb596 | ||
|
|
c5ff0eb5b8 | ||
|
|
bcdc3b30f7 | ||
|
|
621cdd9019 | ||
|
|
c389adb96a | ||
|
|
4abc7a1e69 | ||
|
|
348880ce66 | ||
|
|
337513ffa0 | ||
|
|
ed4ce335d8 | ||
|
|
5583cd237f | ||
|
|
159369c68c | ||
|
|
29c99daa0f | ||
|
|
ef1eeff882 | ||
|
|
9c90bf42c1 | ||
|
|
ea3a6539dc | ||
|
|
3bdc7518a2 | ||
|
|
b4500e9b85 | ||
|
|
797bb31e24 | ||
|
|
2655e63e10 | ||
|
|
60c236be92 | ||
|
|
0d47dff287 | ||
|
|
c91c86b743 | ||
|
|
8a402bf368 | ||
|
|
f4994234e2 | ||
|
|
a1de9f382a | ||
|
|
50a1b1d06c | ||
|
|
57cfa703bf | ||
|
|
df59ed1c11 | ||
|
|
a22cd02f2f | ||
|
|
059e2be153 | ||
|
|
9db78b574b | ||
|
|
c9fc939be0 | ||
|
|
e3be1e0bea | ||
|
|
c881ee30ea | ||
|
|
34ffc8a6c4 | ||
|
|
b86ebe46cb | ||
|
|
ce0ea97850 | ||
|
|
a78fa3fcaf | ||
|
|
90f16527af | ||
|
|
aad53cbdec | ||
|
|
87bac04bf1 | ||
|
|
32a09f39be | ||
|
|
24704df3a8 | ||
|
|
a8cad398fc | ||
|
|
c5a068e025 | ||
|
|
24a1dbabc8 | ||
|
|
f94a437d9d | ||
|
|
27ef344f2b | ||
|
|
ad15797925 | ||
|
|
87b4f2a79d | ||
|
|
c2b911a0ec | ||
|
|
d3b7aaa3fc | ||
|
|
d4828ccd23 | ||
|
|
ab232ebb09 | ||
|
|
fd6f3961f8 | ||
|
|
7d4dde57d9 | ||
|
|
c7a553a7fb | ||
|
|
57f8649eac | ||
|
|
5b18acdcc9 | ||
|
|
962aa93ec7 | ||
|
|
d787d545d2 | ||
|
|
1e96fbe4a8 | ||
|
|
6597e85562 | ||
|
|
617e8a4f8c | ||
|
|
7cf3911cb8 | ||
|
|
ebae62d7c4 | ||
|
|
04d24bde20 | ||
|
|
3860164101 | ||
|
|
e32090a163 | ||
|
|
73ddb79613 | ||
|
|
9d67273740 | ||
|
|
f8b1db2d0d | ||
|
|
af567e7d54 | ||
|
|
e0e0147003 | ||
|
|
fdf0395e49 | ||
|
|
3a15e98155 | ||
|
|
11040eae16 | ||
|
|
6202b46f2a | ||
|
|
55320ca1b8 | ||
|
|
cac3520882 | ||
|
|
4a8d751cff | ||
|
|
d0cef550a3 | ||
|
|
43f4d46cb3 | ||
|
|
6dff9e55be | ||
|
|
44bcdeeb77 | ||
|
|
f9fe805abe | ||
|
|
864f2da733 | ||
|
|
813e3cf14d | ||
|
|
cbe5199c42 | ||
|
|
88bf630798 | ||
|
|
de4a5156e6 | ||
|
|
8fd0407b3a | ||
|
|
d0abd9510e | ||
|
|
0871df60a3 | ||
|
|
151fc3b7c0 | ||
|
|
90c336026e | ||
|
|
eca9e10bc0 | ||
|
|
803869d6ff | ||
|
|
2b0464c3a9 | ||
|
|
b373d8e184 | ||
|
|
174d2528b1 | ||
|
|
91bcba0343 | ||
|
|
a3168a398c | ||
|
|
2c38266536 | ||
|
|
b72437494b | ||
|
|
fa40847263 | ||
|
|
16e4bd5d58 | ||
|
|
9b468d9577 | ||
|
|
c033a81b50 | ||
|
|
9d24798b38 | ||
|
|
f4735e72e4 | ||
|
|
9b3e080098 | ||
|
|
ad4b429633 | ||
|
|
0688e6ef01 | ||
|
|
17f5a9d2a2 | ||
|
|
1838fcc7b0 | ||
|
|
5031bfc395 | ||
|
|
07446082c8 | ||
|
|
eaab2fbc4b | ||
|
|
7174b6ec78 | ||
|
|
3d900d4cad | ||
|
|
eba793fa1f | ||
|
|
be5920b3e9 | ||
|
|
a5d361e3ea | ||
|
|
8525f7bb02 | ||
|
|
5bb74e6562 | ||
|
|
3283b811eb | ||
|
|
257a192095 | ||
|
|
c92c788c85 | ||
|
|
c200eeeb61 | ||
|
|
8f128b2b13 | ||
|
|
9f16874a53 | ||
|
|
cb30330800 | ||
|
|
64f372fae2 | ||
|
|
0f88851e92 | ||
|
|
72ede78ebb | ||
|
|
267b5cea14 | ||
|
|
eb88d58e6c | ||
|
|
1c0ed3433e | ||
|
|
eb0a3ff1af | ||
|
|
af6dd192b3 | ||
|
|
a5142d18cb | ||
|
|
e86710ce11 | ||
|
|
4842f96e2d | ||
|
|
5431f235db | ||
|
|
c996aea40d | ||
|
|
f71444c756 | ||
|
|
34e56fea0b | ||
|
|
2556733787 | ||
|
|
a1f753c8e3 | ||
|
|
edc961cc66 | ||
|
|
0fecc8c6a0 | ||
|
|
592daf8453 | ||
|
|
ab81ddd1de | ||
|
|
ee185c604a | ||
|
|
5a7786c63f | ||
|
|
45b68febe9 | ||
|
|
691522780f | ||
|
|
efa0077e08 | ||
|
|
804b950562 | ||
|
|
0cbfc91628 | ||
|
|
df43d76e62 | ||
|
|
1efc049863 | ||
|
|
336e957951 | ||
|
|
5aedea7179 | ||
|
|
a175419f84 | ||
|
|
5d2f7ab843 | ||
|
|
4c252d805d | ||
|
|
0b401e1289 | ||
|
|
9c97c26832 | ||
|
|
b47136d332 | ||
|
|
8088be390f | ||
|
|
45c090f3e7 | ||
|
|
de174766f8 | ||
|
|
7a4b40efc5 | ||
|
|
a812818670 | ||
|
|
e79a8d440e | ||
|
|
ff515d0ee4 | ||
|
|
664b2389ca | ||
|
|
76d64590b0 | ||
|
|
cdac2b4ecf | ||
|
|
6cc57e0d0d | ||
|
|
48e413eb28 | ||
|
|
6aa682f564 | ||
|
|
187a0d9b28 | ||
|
|
dd9fc198ce | ||
|
|
2404c4c84f | ||
|
|
632c03de71 | ||
|
|
913970cebf | ||
|
|
036c5f9f31 | ||
|
|
213e155713 | ||
|
|
b298ed5b70 | ||
|
|
f53f94d24d | ||
|
|
dda73e99f2 | ||
|
|
3bd2faff8c | ||
|
|
be73f948d2 | ||
|
|
48c3d20dd4 | ||
|
|
d2699793e0 | ||
|
|
8338d48828 | ||
|
|
517d9bb1f2 | ||
|
|
c4eafddbda | ||
|
|
48392f04fa | ||
|
|
7670d2948d | ||
|
|
798103d4e0 | ||
|
|
dda0320c5c | ||
|
|
d7e716b8f0 | ||
|
|
aa8f43fad9 | ||
|
|
5f11cd5693 | ||
|
|
462580cd7d | ||
|
|
49a81742ef | ||
|
|
4d571dee74 | ||
|
|
a140e70661 | ||
|
|
0758c8794d | ||
|
|
9744284109 | ||
|
|
6d77506cfd | ||
|
|
f1af56fb4e | ||
|
|
12b71200be | ||
|
|
44a5b8e459 | ||
|
|
96e2651fa2 | ||
|
|
a3857fd963 | ||
|
|
8b1d84a6ce | ||
|
|
f534df710e | ||
|
|
a712d9cefb | ||
|
|
c2e16d3c5b | ||
|
|
311ab2c822 | ||
|
|
60176163f1 | ||
|
|
b529350d4a | ||
|
|
a5b5743d71 | ||
|
|
53d35553c6 | ||
|
|
4dc1cef4fe | ||
|
|
658fe1d0c3 | ||
|
|
462399b78b | ||
|
|
94cd357f5b | ||
|
|
e99039d692 | ||
|
|
3e58dee19a | ||
|
|
ec36ac1610 | ||
|
|
53cfb3d53d | ||
|
|
252082192a | ||
|
|
1a6f4efbad | ||
|
|
abd893a2ae | ||
|
|
a1cce74e96 | ||
|
|
78887ff757 | ||
|
|
9f20131311 | ||
|
|
a46e108b83 |
No files matched your search
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,6 +1,6 @@
|
||||
--------------------------------------------------------------------
|
||||
The PHP License, version 3.01
|
||||
Copyright (c) 1999 - 2010 The PHP Group. All rights reserved.
|
||||
Copyright (c) 1999 - 2009 The PHP Group. All rights reserved.
|
||||
--------------------------------------------------------------------
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
+1
-6
@@ -13,8 +13,6 @@ all: $(all_targets)
|
||||
|
||||
build-modules: $(PHP_MODULES) $(PHP_ZEND_EX)
|
||||
|
||||
build-binaries: $(PHP_BINARIES)
|
||||
|
||||
libphp$(PHP_MAJOR_VERSION).la: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
|
||||
$(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -rpath $(phptempdir) $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS) $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@
|
||||
-@$(LIBTOOL) --silent --mode=install cp $@ $(phptempdir)/$@ >/dev/null 2>&1
|
||||
@@ -37,8 +35,6 @@ install-sapi: $(OVERALL_TARGET)
|
||||
fi
|
||||
@$(INSTALL_IT)
|
||||
|
||||
install-binaries: build-binaries $(install_binary_targets)
|
||||
|
||||
install-modules: build-modules
|
||||
@test -d modules && \
|
||||
$(mkinstalldirs) $(INSTALL_ROOT)$(EXTENSION_DIR)
|
||||
@@ -83,7 +79,7 @@ PHP_TEST_SHARED_EXTENSIONS = ` \
|
||||
. $$i; $(top_srcdir)/build/shtool echo -n -- " -d $(ZEND_EXT_TYPE)=$(top_builddir)/modules/$$dlname"; \
|
||||
done; \
|
||||
fi`
|
||||
PHP_DEPRECATED_DIRECTIVES_REGEX = '^(magic_quotes_(gpc|runtime|sybase)?|(zend_)?extension(_debug)?(_ts)?)[\t\ ]*='
|
||||
PHP_DEPRECATED_DIRECTIVES_REGEX = '^(define_syslog_variables|register_(globals|long_arrays)?|safe_mode|magic_quotes_(gpc|runtime|sybase)?|(zend_)?extension(_debug)?(_ts)?)[\t\ ]*='
|
||||
|
||||
test: all
|
||||
-@if test ! -z "$(PHP_EXECUTABLE)" && test -x "$(PHP_EXECUTABLE)"; then \
|
||||
@@ -102,7 +98,6 @@ test: all
|
||||
TEST_PHP_SRCDIR=$(top_srcdir) \
|
||||
CC="$(CC)" \
|
||||
$(PHP_EXECUTABLE) -n -c $(top_builddir)/tmp-php.ini $(PHP_TEST_SETTINGS) $(top_srcdir)/run-tests.php -n -c $(top_builddir)/tmp-php.ini -d extension_dir=$(top_builddir)/modules/ $(PHP_TEST_SHARED_EXTENSIONS) $(TESTS); \
|
||||
rm $(top_builddir)/tmp-php.ini; \
|
||||
else \
|
||||
echo "ERROR: Cannot run tests without CLI sapi."; \
|
||||
fi
|
||||
|
||||
@@ -1,142 +0,0 @@
|
||||
$Id: README.NEW-OUTPUT-API 219039 2006-08-30 07:39:09Z mike $
|
||||
|
||||
|
||||
API adjustment to the old output control code:
|
||||
|
||||
Everything now resides beneath the php_output namespace,
|
||||
and there's an API call for every output handler op.
|
||||
|
||||
Checking output control layers status:
|
||||
// Using OG()
|
||||
php_output_get_status(TSRMLS_C);
|
||||
|
||||
Starting the default output handler:
|
||||
// php_start_ob_buffer(NULL, 0, 1 TSRMLS_CC);
|
||||
php_output_start_default(TSRMLS_C);
|
||||
|
||||
Starting an user handler by zval:
|
||||
// php_start_ob_buffer(zhandler, chunk_size, erase TSRMLS_CC);
|
||||
php_output_start_user(zhandler, chunk_size, flags TSRMLS_CC);
|
||||
|
||||
Starting an internal handler whithout context:
|
||||
// php_ob_set_internal_handler(my_php_output_handler_func_t, buffer_size, "output handler name", erase TSRMLS_CC);
|
||||
php_output_start_internal(handler_name, handler_name_len, my_php_output_handler_func_t, chunk_size, flags TSRMLS_CC);
|
||||
|
||||
Starting an internal handler with context:
|
||||
// not possible with old API
|
||||
php_output_handler *h;
|
||||
h = php_output_handler_create_internal(handler_name, handler_name_len, my_php_output_handler_context_func_t, chunk_size, flags TSRMLS_CC);
|
||||
php_output_handler_set_context(h, my_context, my_context_dtor);
|
||||
php_output_handler_start(h TSRMLS_CC);
|
||||
|
||||
Testing whether a certain output handler has already been started:
|
||||
// php_ob_handler_used("output handler name" TSRMLS_CC);
|
||||
php_output_handler_started(handler_name, handler_name_len TSRMLS_CC);
|
||||
|
||||
Flushing one output buffer:
|
||||
// php_ob_end_buffer(1, 1 TSRMLS_CC);
|
||||
php_output_flush(TSRMLS_C);
|
||||
|
||||
Flushing all output buffers:
|
||||
// not possible with old API
|
||||
php_output_flush_all(TSRMLS_C);
|
||||
|
||||
Cleaning one output buffer:
|
||||
// php_ob_end_buffer(0, 1 TSRMLS_CC);
|
||||
php_output_clean(TSRMLS_C);
|
||||
|
||||
Cleaning all output buffers:
|
||||
// not possible with old API
|
||||
php_output_clean_all(TSRMLS_C);
|
||||
|
||||
Discarding one output buffer:
|
||||
// php_ob_end_buffer(0, 0 TSRMLS_CC);
|
||||
php_output_discard(TSRMLS_C);
|
||||
|
||||
Discarding all output buffers:
|
||||
// php_ob_end_buffers(0 TSRMLS_CC);
|
||||
php_output_discard_all(TSRMLS_C);
|
||||
|
||||
Stopping (and dropping) one output buffer:
|
||||
// php_ob_end_buffer(1, 0 TSRMLS_CC)
|
||||
php_output_end(TSRMLS_C);
|
||||
|
||||
Stopping (and dropping) all output buffers:
|
||||
// php_ob_end_buffers(1, 0 TSRMLS_CC);
|
||||
php_output_end_all(TSRMLS_C);
|
||||
|
||||
Retrieving output buffers contents:
|
||||
// php_ob_get_buffer(zstring TSRMLS_CC);
|
||||
php_output_get_contents(zstring TSRMLS_CC);
|
||||
|
||||
Retrieving output buffers length:
|
||||
// php_ob_get_length(zlength TSRMLS_CC);
|
||||
php_output_get_length(zlength TSRMLS_CC);
|
||||
|
||||
Retrieving output buffering level:
|
||||
// OG(nesting_level);
|
||||
php_output_get_level(TSRMLS_C);
|
||||
|
||||
Issue a warning because of an output handler conflict:
|
||||
// php_ob_init_conflict("to be started handler name", "to be tested if already started handler name" TSRMLS_CC);
|
||||
php_output_handler_conflict(new_handler_name, new_handler_name_len, set_handler_name, set_handler_name_len TSRMLS_CC);
|
||||
|
||||
Registering a conflict checking function, which will be checked prior starting the handler:
|
||||
// not possible with old API, unless hardcoding into output.c
|
||||
php_output_handler_conflict_register(handler_name, handler_name_len, my_php_output_handler_conflict_check_t TSRMLS_CC);
|
||||
|
||||
Registering a reverse conflict checking function, which will be checked prior starting the specified foreign handler:
|
||||
// not possible with old API
|
||||
php_output_handler_reverse_conflict_register(foreign_handler_name, foreign_handler_name_len, my_php_output_handler_conflict_check_t TSRMLS_CC);
|
||||
|
||||
Facilitating a context from within an output handler callable with ob_start():
|
||||
// not possible with old API
|
||||
php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_GET_OPAQ, (void *) &custom_ctx_ptr_ptr TSRMLS_CC);
|
||||
|
||||
Disabling of the output handler by itself:
|
||||
//not possible with old API
|
||||
php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_DISABLE, NULL TSRMLS_CC);
|
||||
|
||||
Marking an output handler immutable by itself because of irreversibility of its operation:
|
||||
// not possible with old API
|
||||
php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_IMMUTABLE, NULL TSRMLS_CC);
|
||||
|
||||
Restarting the output handler because of a CLEAN operation:
|
||||
// not possible with old API
|
||||
if (flags & PHP_OUTPUT_HANDLER_CLEAN) { ... }
|
||||
|
||||
Recognizing by the output handler itself if it gets discarded:
|
||||
// not possible with old API
|
||||
if ((flags & PHP_OUTPUT_HANDLER_CLEAN) && (flags & PHP_OUTPUT_HANDLER_FINAL)) { ... }
|
||||
|
||||
|
||||
Output handler hooks
|
||||
|
||||
The output handler can change its abilities at runtime. Eg. the gz handler can
|
||||
remove the CLEANABLE and REMOVABLE bits when the first output has passed through it;
|
||||
or handlers implemented in C to be used with ob_start() can contain a non-global
|
||||
context:
|
||||
PHP_OUTPUT_HANDLER_HOOK_GET_OPAQ
|
||||
pass a void*** pointer as second arg to receive the address of a pointer
|
||||
pointer to the opaque field of the output handler context
|
||||
PHP_OUTPUT_HANDLER_HOOK_GET_FLAGS
|
||||
pass a int* pointer as second arg to receive the flags set for the output handler
|
||||
PHP_OUTPUT_HANDLER_HOOK_GET_LEVEL
|
||||
pass a int* pointer as second arg to receive the level of this output handler
|
||||
(starts with 0)
|
||||
PHP_OUTPUT_HANDLER_HOOK_IMMUTABLE
|
||||
the second arg is ignored; marks the output handler to be neither cleanable
|
||||
nor removable
|
||||
PHP_OUTPUT_HANDLER_HOOK_DISABLE
|
||||
the second arg is ignored; marks the output handler as disabled
|
||||
|
||||
|
||||
Open questions
|
||||
|
||||
Should the userland API be adjusted and unified?
|
||||
|
||||
Many bits of the manual (and very first implementation) do not comply
|
||||
with the behaviour of the current (to be obsoleted) code, thus should
|
||||
the manual or the behaviour be adjusted?
|
||||
|
||||
END
|
||||
+20
-23
@@ -20,18 +20,12 @@ php/QA/bug websites try to have someone from the webmaster team (Bjori) on hand.
|
||||
|
||||
5. Verify the tags to be extra sure everything was tagged properly.
|
||||
|
||||
6. Moving extensions from/to PECL requires write acces to the destination.
|
||||
Most developers should have this.
|
||||
6. Moving extensions from/to PECL requires root level access to the CVS server.
|
||||
Contact systems@php.net to get this taken care of.
|
||||
|
||||
Moving extensions from php-src to PECL
|
||||
- Checkout the pecl directory, most likely you want a sparse-root checkout
|
||||
svn co --depth=empty https://svn.php.net/repository/pecl
|
||||
- Create an directory for the extension incl. branch and tag structure,
|
||||
no trunk at this point and commit this to svn
|
||||
cd pecl; mkdir foo foo/tags foo/branches; svn add foo; svn commit
|
||||
- Move the extension from php-src to the new location
|
||||
svn mv https://svn.php.net/repository/php/php-src/trunk/ext/foo \
|
||||
https://svn.php.net/repository/pecl/foo/trunk
|
||||
- Filesystem: cp -r php-src/ext/foo pecl/foo
|
||||
- cvs rm php-src/ext/foo
|
||||
|
||||
If the extension is still usable or not dead, in cooperation with the extension
|
||||
maintainers if any:
|
||||
@@ -39,23 +33,25 @@ maintainers if any:
|
||||
- create the package.xml, commit
|
||||
- release the package
|
||||
|
||||
For Moving extensions from PECL to php-src the svn mv has to be tone the other
|
||||
way round.
|
||||
Moving extensions from PECL to php-src
|
||||
- Filesystem: cp -r pecl/foo php-src/ext/foo
|
||||
OR depending on the wishes from the PECL extension maintainer.
|
||||
- Filesystem: ln -s pecl/foo php-src/ext/foo
|
||||
|
||||
Rolling a non stable release (alpha/beta/RC)
|
||||
--------------------------------------------
|
||||
|
||||
1. Check windows snapshot builder logs (http://snaps.php.net/win32/snapshot-STABLE.log f.e.)
|
||||
|
||||
2. run the "scripts/dev/credits" script in php-src and commit the changes in the
|
||||
credits files in ext/standard.
|
||||
|
||||
3. Bump the version numbers in ``main/php_version.h``, ``configure.in`` and possibly ``NEWS``.
|
||||
2. Bump the version numbers in ``main/php_version.h``, ``configure.in`` and possibly ``NEWS``.
|
||||
Do not use abbreviations for alpha and beta.
|
||||
|
||||
4. Commit those changes and note the revision id.
|
||||
3. Commit those changes
|
||||
|
||||
5. tag the repository with the version. To do the tag in a fast way do a svn copy on the server using full URLs. You should use the revision id from the above commit to prevent mistakes in case there was a commit in between. f.e. "``svn cp https://svn.php.net/repository/php/php-src/branches/PHP_5_3@308399 https://svn.php.net/repository/php/php-src/tags/php_5_3_6RC1``"
|
||||
4. run the "scripts/dev/credits" script in php-src and commit the changes in the
|
||||
credits files in ext/standard.
|
||||
|
||||
5. tag the repository with the version f.e. "``cvs tag php_4_4_1RC1``"
|
||||
(of course, you need to change that to the version you're rolling an RC for).
|
||||
|
||||
6. Bump up the version numbers in ``main/php_version.h``, ``configure.in``
|
||||
@@ -69,7 +65,7 @@ correctly work.
|
||||
8. Log in onto the snaps box and go into the correct tree (f.e. the PHP_4_4
|
||||
branch if you're rolling 4.4.x releases).
|
||||
|
||||
9. You do not have to update the tree, but of course you can with "``svn up``".
|
||||
9. You do not have to update the tree, but of course you can with "``cvs up -dP``".
|
||||
|
||||
10. run: ``./makedist php 4.4.1RC1``, this will export the tree, create configure
|
||||
and build two tarballs (one gz and one bz2).
|
||||
@@ -104,7 +100,7 @@ Derick) run the following commands for you:
|
||||
|
||||
``sudo -u ezmlm ezmlm-sub ~ezmlm/primary-qa-tester/mod moderator-email-address``
|
||||
|
||||
3. Update the MD5 sums in ``web/qa/trunk/include/rc-md5sums.txt`` (no empty lines, ordered by filename, odler version number first, .bz2 before .gz).
|
||||
3. Update the MD5 sums in ``web/qa/trunk/include/rc-md5sums.txt`` (no empty lines).
|
||||
|
||||
4. Update in ``web/qa/trunk/include/release-qa.php`` constants with the new RC and
|
||||
commit this.
|
||||
@@ -115,9 +111,10 @@ commit this.
|
||||
|
||||
c. ``$RELEASE_PROCESS`` = array(4 => true, 5 => true)
|
||||
|
||||
1. Update in ``web/php-bugs/trunk/include/php_versions.php`` to include the new RC and commit.
|
||||
1. Update in ``php-bugs/trunk/include/functions.inc`` the ``show_version_option``
|
||||
function to include the new RC and commit.
|
||||
|
||||
2. Update ``web/php/trunk/include/version.inc`` (x=major version number)
|
||||
2. Update ``phpweb/include/version.inc`` (x=major version number)
|
||||
|
||||
a. ``$PHP_x_RC`` = "5.3.0RC1"
|
||||
|
||||
@@ -125,7 +122,7 @@ commit this.
|
||||
|
||||
3. Commit those changes:
|
||||
|
||||
a. ``svn commit web/qa/trunk web/php-bugs/trunk web/php/trunk``
|
||||
a. ``cvs commit include/version.inc include/releases.inc``
|
||||
|
||||
4. For the first RC, write the doc team (phpdoc@lists.php.net) about updating the
|
||||
INSTALL and win32/install.txt files which are generated from the PHP manual sources.
|
||||
|
||||
+17
-5
@@ -19,7 +19,9 @@ A simple implementation might look like the following. This stores the
|
||||
original raw user data and adds a my_get_raw() function while the normal
|
||||
$_POST, $_GET and $_COOKIE arrays are only populated with stripped
|
||||
data. In this simple example all I am doing is calling strip_tags() on
|
||||
the data.
|
||||
the data. If register_globals is turned on, the default globals that
|
||||
are created will be stripped ($foo) while a $RAW_foo is created with the
|
||||
original user input.
|
||||
|
||||
ZEND_BEGIN_MODULE_GLOBALS(my_input_filter)
|
||||
zval *post_array;
|
||||
@@ -153,6 +155,8 @@ PHP_FUNCTION(my_get_raw)
|
||||
int var_len;
|
||||
zval **tmp;
|
||||
zval *array_ptr = NULL;
|
||||
HashTable *hash_ptr;
|
||||
char *raw_var;
|
||||
|
||||
if(zend_parse_parameters(2 TSRMLS_CC, "ls", &arg, &var, &var_len) == FAILURE) {
|
||||
return;
|
||||
@@ -170,15 +174,23 @@ PHP_FUNCTION(my_get_raw)
|
||||
break;
|
||||
}
|
||||
|
||||
if(!array_ptr) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
if(!array_ptr) RETURN_FALSE;
|
||||
|
||||
if(zend_hash_find(HASH_OF(array_ptr), var, var_len+5, (void **)&tmp) == SUCCESS) {
|
||||
/*
|
||||
* I'm changing the variable name here because when running with register_globals on,
|
||||
* the variable will end up in the global symbol table
|
||||
*/
|
||||
raw_var = emalloc(var_len+5); /* RAW_ and a \0 */
|
||||
strcpy(raw_var, "RAW_");
|
||||
strlcat(raw_var,var,var_len+5);
|
||||
hash_ptr = HASH_OF(array_ptr);
|
||||
|
||||
if(zend_hash_find(hash_ptr, raw_var, var_len+5, (void **)&tmp) == SUCCESS) {
|
||||
*return_value = **tmp;
|
||||
zval_copy_ctor(return_value);
|
||||
} else {
|
||||
RETVAL_FALSE;
|
||||
}
|
||||
efree(raw_var);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
Things to do or at least think about doing in the future. Name in
|
||||
parenthesis means that person has taken on this project.
|
||||
|
||||
Zend
|
||||
----
|
||||
* Allow foreach ($array as $k => list($a, $b)) syntax for multi
|
||||
dimensional arrays.
|
||||
* Look at replacing c-lib call tolower().
|
||||
* Make hash API functions work with HASH_OF() to save time.
|
||||
* Native large number support (probably with GNU GMP)
|
||||
* Const'ify APIs. Right now, many functions leave parameters untouched,
|
||||
but don't declare those as const. This makes interaction with other
|
||||
interfaces difficult which pass const parameters to us.
|
||||
|
||||
|
||||
global
|
||||
------
|
||||
* Make sure that all ZTS globals get destructed. Most ts_allocate_id()
|
||||
calls should have a dtor entry.
|
||||
* on some platforms unimplemented function will just do nothing
|
||||
(e.g. symlink) they should print a warning or not even be defined!
|
||||
(DONE ?)
|
||||
* --enable-all in configure. (--enable-shared=max ...)
|
||||
* make configure print out a summary when it's done (like XEmacs)
|
||||
* replace standard functions which work on static data with
|
||||
reentrancy-safe functions (DONE?).
|
||||
* make SAPI conform to CGI/1.1. Currently, all SAPI modules
|
||||
define REMOTE_ADDR etc. themselves and reach only various level
|
||||
of compliance.
|
||||
* see what functions might need to be changed to use HashPosition, so
|
||||
that the internal array pointer is not affected.
|
||||
* Move most extensions and PEAR packages out of the PHP CVS tree,
|
||||
include them again during release packaging.
|
||||
|
||||
Other
|
||||
* use thread-safe resolver functions (either require BIND 8 or adns).
|
||||
* implement javadoc based function docs template system.
|
||||
* provide optional IPv6 support (seems to be done?).
|
||||
* find a better way to implement script timeouts. SIGVTALRM is used
|
||||
by some POSIX threads implementations (i.e. OpenBSD) and is not
|
||||
available in ZTS mode.
|
||||
* Implement flush feature suitable for nested output buffers.
|
||||
|
||||
Streams
|
||||
-------
|
||||
* Route filestat.c through the wrapper layer; isolate the statcache code
|
||||
so that it is independent of php functions and can be applied to any
|
||||
stream/path.
|
||||
* Implement generalized connection pool for stated protocols such as
|
||||
ftp and http/1.1 (using keep-alive) to avoid having to negotiate
|
||||
new command/request stream for each subsequent call; Possibly store
|
||||
resources in contexts (creating a default context if necessary) to
|
||||
allow segmentation of connection pools.
|
||||
* Add a method to take ownership of the memory buffer in memory streams so
|
||||
that generating string values for zvals doesn't require an estrdup.
|
||||
* bundle and use curl lib for fopen wrapper.
|
||||
|
||||
documentation
|
||||
-------------
|
||||
* Add remarks in the documentation which functions are not implemented
|
||||
on win32.
|
||||
* Add remarks in the documentation which functions are not binary-safe.
|
||||
* Update curl documentation (DONE?)
|
||||
* Add developer documentation.
|
||||
* Add detailed documentation for Java extension.
|
||||
|
||||
ext/curl
|
||||
--------
|
||||
* Have a warning scheme for when people use unsupported features.
|
||||
|
||||
ext/oci8
|
||||
--------
|
||||
* All OCIFetch*() functions should return 0 for no more data and false on
|
||||
error.
|
||||
* Have a flag that trims trailing spaces from CHAR fields on retrieval.
|
||||
* Make allow_call_time_pass_reference=Off working.
|
||||
* For additional todo information, see oci8.c, in ext/oci8
|
||||
|
||||
ext/odbc
|
||||
--------
|
||||
For PHP 4.3.0:
|
||||
* update all php_error calls to php_error_docref where valid
|
||||
* integrate EXPERIMENTAL ODBC update for use in PHP 5.0, use for
|
||||
testing purposes only.
|
||||
|
||||
For PHP 5.0.0
|
||||
* Activate EXPERIMENTAL ODBC codebase update
|
||||
|
||||
ext/pcre
|
||||
--------
|
||||
* Allow user to set PCRE_NOTEMPTY, PCRE_ANCHORED at execution time, maybe
|
||||
|
||||
ext/pcntl
|
||||
---------
|
||||
* Change internal callback handler to use TICKS
|
||||
* Remove all zend_extension code
|
||||
* Add object callback support to pcntl_signal()
|
||||
|
||||
ext/session
|
||||
-----------
|
||||
For PHP 4.3.0:
|
||||
* session_abort() to abort session. ie: Do not save session data.
|
||||
* Allow unset($_SESSION) or unset($HTTP_SESSION_VARS) to unset
|
||||
session vars regardless of register_globals setting.
|
||||
|
||||
Other:
|
||||
* Maybe implement finer-grained session variables that could be
|
||||
locked individually.
|
||||
* Write a network-transparent storage back-end with fallover
|
||||
facilities
|
||||
* Provide a callback facility which is executed upon encountering
|
||||
an unknown class name during deserialization
|
||||
|
||||
ext/standard
|
||||
------------
|
||||
* Add a version number to data serialized via serialize().
|
||||
* Possibly modify parsing of GPC data to automatically create arrays if
|
||||
variable name is seen more than once.
|
||||
* Implement regex-cache for url-functions.
|
||||
* Move socket related functions to fsock.c.
|
||||
|
||||
ext/wddx
|
||||
--------
|
||||
* See if we can support the remaining data types:
|
||||
binary
|
||||
|
||||
http://www.wddx.org/WDDX_SDK_10a/7__References/WDDX_DTD.htm
|
||||
(Andrei)
|
||||
|
||||
* implement wddx_packet_as_javascript(). (Andrei)
|
||||
|
||||
other cool stuff
|
||||
----------------
|
||||
* PVM extension
|
||||
|
||||
vim:et:sw=4:ts=4
|
||||
@@ -0,0 +1,4 @@
|
||||
Zend Engine
|
||||
-----------
|
||||
- Look at making zend_constant value member be a zval* instead of zval. (Andi)
|
||||
- Implement inheritance rules for type hints. (Marcus)
|
||||
@@ -0,0 +1,89 @@
|
||||
Component: Zend Engine 2
|
||||
|
||||
Important stuff to finish: PPP members/PPP methods,
|
||||
support of overloaded extensions, possibly differentiate
|
||||
between class and namespace as discussed with Stig in
|
||||
Germany.
|
||||
Responsibility: Zeev, Andi, Stas
|
||||
Time frame: Couple of months for first part and extensions will be
|
||||
ongoing while PHP is being fixed.
|
||||
Things to leave for later versions: Native aggregation
|
||||
support, accessing static members via object and not class.
|
||||
|
||||
|
||||
Component: Aggregation
|
||||
Responsibility: Andi, Stig?
|
||||
Time frame: ?
|
||||
|
||||
|
||||
Component: Redesign of API Versioning
|
||||
Responsibility: ?
|
||||
Time frame: 1 month
|
||||
|
||||
|
||||
Component: Thread Safety
|
||||
Identify the extensions that are not thread safe by design
|
||||
or due to dependant libraries and identify them as such.
|
||||
If possible try to resolve thread safety issue via code
|
||||
improvements (if php code or patches will be accepted by
|
||||
library maintainers). For situations where thread safety
|
||||
cannot easily be acheived a flag in the extension API is
|
||||
set so PHP can identify non-thread safe extensions. These
|
||||
extensions will not be loaded in a ZTS compiled binary
|
||||
(unless it is cli/cgi).
|
||||
|
||||
Responsibility: ?
|
||||
Time frame: ?
|
||||
|
||||
|
||||
Component: SAPI
|
||||
Environment variables defined in the CGI spec need to be
|
||||
verified in each SAPI module that they conform to the CGI
|
||||
spec correctly. If they do not, the SAPI module needs to
|
||||
fix the variable prior to script execution. Having this
|
||||
conformity will aid in having PHP scripts run correctly
|
||||
under different sapi modules.
|
||||
|
||||
Responsibility: Shane Caraveo & each sapi module owner
|
||||
Timeframe: ? (but shouldn't be much effort, most modules are probably ok)
|
||||
|
||||
|
||||
Component: RPC Abstraction Layer
|
||||
Porting java, com, dotnet, xmlrpc, corba, soap and python, srm
|
||||
(are there more ?) to work with the new oo api and preferably
|
||||
by using ext/rpc.
|
||||
Responsibility: Harald
|
||||
Time frame: 2 months (but i have to wait for a few engine features first)
|
||||
|
||||
|
||||
Component: OO Extensions
|
||||
Each OO extension has to be revised and rewritten to fit into
|
||||
the new OO model. We should decide which extensions are a must
|
||||
to have for the release and which can be ported by the maintainer
|
||||
later as a separate pecl release.
|
||||
A list of extensions to be extended that have to be investigated:
|
||||
* browscap
|
||||
* aggregate
|
||||
* all *sql extensions (*_fetch_object)
|
||||
* domxml (seems like christian is rewriting it anyways)
|
||||
* ming
|
||||
Responsibility: Harald (, extension maintainers)
|
||||
|
||||
|
||||
Component: Abstract Data Types (ADT)
|
||||
Responsibility: Sterling, Harald
|
||||
Time frame: ?
|
||||
|
||||
|
||||
Component: Test Suite
|
||||
Extending the test suite with atleast a test for every
|
||||
function in an extension that doesn't require external
|
||||
resources. Also developing an automated test thing which
|
||||
cvs ups's, compiles and tests the build on a daily base on
|
||||
as much platforms/extensions as possible.
|
||||
|
||||
The test suite will also be extended to support threaded
|
||||
testing and testing for differing sapi modules (via http
|
||||
calls or other methods).
|
||||
Reponsibility: Derick (, extension maintainers)
|
||||
Time frame: 3 months
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Thread Safe Resource Manager |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1999-2011, Andi Gutmans, Sascha Schumann, Zeev Suraski |
|
||||
| Copyright (c) 1999-2010, Andi Gutmans, Sascha Schumann, Zeev Suraski |
|
||||
| This source file is subject to the TSRM license, that is bundled |
|
||||
| with this package in the file LICENSE |
|
||||
+----------------------------------------------------------------------+
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Thread Safe Resource Manager |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1999-2011, Andi Gutmans, Sascha Schumann, Zeev Suraski |
|
||||
| Copyright (c) 1999-2010, Andi Gutmans, Sascha Schumann, Zeev Suraski |
|
||||
| This source file is subject to the TSRM license, that is bundled |
|
||||
| with this package in the file LICENSE |
|
||||
+----------------------------------------------------------------------+
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2011 The PHP Group |
|
||||
| Copyright (c) 1997-2010 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2011 The PHP Group |
|
||||
| Copyright (c) 1997-2010 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
+114
-255
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2011 The PHP Group |
|
||||
| Copyright (c) 1997-2010 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -14,7 +14,6 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Sascha Schumann <sascha@schumann.cx> |
|
||||
| Pierre Joye <pierre@php.net> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
@@ -39,18 +38,6 @@
|
||||
# ifndef IO_REPARSE_TAG_SYMLINK
|
||||
# define IO_REPARSE_TAG_SYMLINK 0xA000000C
|
||||
# endif
|
||||
|
||||
# ifndef VOLUME_NAME_NT
|
||||
# define VOLUME_NAME_NT 0x2
|
||||
# endif
|
||||
|
||||
# ifndef VOLUME_NAME_DOS
|
||||
# define VOLUME_NAME_DOS 0x0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef S_IFLNK
|
||||
# define S_IFLNK 0120000
|
||||
#endif
|
||||
|
||||
#ifdef NETWARE
|
||||
@@ -96,14 +83,14 @@ cwd_state main_cwd_state; /* True global */
|
||||
#include <tchar.h>
|
||||
#define tsrm_strtok_r(a,b,c) _tcstok((a),(b))
|
||||
#define TOKENIZER_STRING "/\\"
|
||||
|
||||
static int php_check_dots(const char *element, int n)
|
||||
|
||||
static int php_check_dots(const char *element, int n)
|
||||
{
|
||||
while (n-- > 0) if (element[n] != '.') break;
|
||||
|
||||
return (n != -1);
|
||||
}
|
||||
|
||||
|
||||
#define IS_DIRECTORY_UP(element, len) \
|
||||
(len >= 2 && !php_check_dots(element, len))
|
||||
|
||||
@@ -137,7 +124,7 @@ static int php_check_dots(const char *element, int n)
|
||||
|
||||
/* define this to check semantics */
|
||||
#define IS_DIR_OK(s) (1)
|
||||
|
||||
|
||||
#ifndef IS_DIR_OK
|
||||
#define IS_DIR_OK(state) (php_is_dir_ok(state) == 0)
|
||||
#endif
|
||||
@@ -150,7 +137,7 @@ static int php_check_dots(const char *element, int n)
|
||||
|
||||
#define CWD_STATE_FREE(s) \
|
||||
free((s)->cwd);
|
||||
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
|
||||
#ifdef CTL_CODE
|
||||
@@ -215,86 +202,21 @@ static inline time_t FileTimeToUnixTime(const FILETIME FileTime)
|
||||
return (time_t)UnixTime;
|
||||
}
|
||||
|
||||
CWD_API int php_sys_readlink(const char *link, char *target, size_t target_len){ /* {{{ */
|
||||
HINSTANCE kernel32;
|
||||
HANDLE hFile;
|
||||
DWORD dwRet;
|
||||
|
||||
typedef BOOL (WINAPI *gfpnh_func)(HANDLE, LPTSTR, DWORD, DWORD);
|
||||
gfpnh_func pGetFinalPathNameByHandle;
|
||||
|
||||
kernel32 = LoadLibrary("kernel32.dll");
|
||||
|
||||
if (kernel32) {
|
||||
pGetFinalPathNameByHandle = (gfpnh_func)GetProcAddress(kernel32, "GetFinalPathNameByHandleA");
|
||||
if (pGetFinalPathNameByHandle == NULL) {
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
|
||||
hFile = CreateFile(link, // file to open
|
||||
GENERIC_READ, // open for reading
|
||||
FILE_SHARE_READ, // share for reading
|
||||
NULL, // default security
|
||||
OPEN_EXISTING, // existing file only
|
||||
FILE_FLAG_BACKUP_SEMANTICS, // normal file
|
||||
NULL); // no attr. template
|
||||
|
||||
if( hFile == INVALID_HANDLE_VALUE) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
dwRet = pGetFinalPathNameByHandle(hFile, target, MAXPATHLEN, VOLUME_NAME_DOS);
|
||||
if(dwRet >= MAXPATHLEN) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
CloseHandle(hFile);
|
||||
|
||||
if(dwRet > 4) {
|
||||
/* Skip first 4 characters if they are "\??\" */
|
||||
if(target[0] == '\\' && target[1] == '\\' && target[2] == '?' && target[3] == '\\') {
|
||||
char tmp[MAXPATHLEN];
|
||||
unsigned int offset = 4;
|
||||
dwRet -= 4;
|
||||
|
||||
/* \??\UNC\ */
|
||||
if (dwRet > 7 && target[4] == 'U' && target[5] == 'N' && target[6] == 'C') {
|
||||
offset += 2;
|
||||
dwRet -= 2;
|
||||
target[offset] = '\\';
|
||||
}
|
||||
|
||||
memcpy(tmp, target + offset, dwRet);
|
||||
memcpy(target, tmp, dwRet);
|
||||
}
|
||||
}
|
||||
|
||||
target[dwRet] = '\0';
|
||||
return dwRet;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
CWD_API int php_sys_stat_ex(const char *path, struct stat *buf, int lstat) /* {{{ */
|
||||
CWD_API int php_sys_stat(const char *path, struct stat *buf) /* {{{ */
|
||||
{
|
||||
WIN32_FILE_ATTRIBUTE_DATA data;
|
||||
__int64 t;
|
||||
const size_t path_len = strlen(path);
|
||||
|
||||
if (!GetFileAttributesEx(path, GetFileExInfoStandard, &data)) {
|
||||
return stat(path, buf);
|
||||
}
|
||||
|
||||
if (path_len >= 1 && path[1] == ':') {
|
||||
if (path[1] == ':') {
|
||||
if (path[0] >= 'A' && path[0] <= 'Z') {
|
||||
buf->st_dev = buf->st_rdev = path[0] - 'A';
|
||||
} else {
|
||||
buf->st_dev = buf->st_rdev = path[0] - 'a';
|
||||
}
|
||||
} else if (IS_UNC_PATH(path, path_len)) {
|
||||
buf->st_dev = buf->st_rdev = 0;
|
||||
} else {
|
||||
char cur_path[MAXPATHLEN+1];
|
||||
DWORD len = sizeof(cur_path);
|
||||
@@ -323,56 +245,19 @@ CWD_API int php_sys_stat_ex(const char *path, struct stat *buf, int lstat) /* {{
|
||||
}
|
||||
if (tmp != cur_path) {
|
||||
free(tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buf->st_uid = buf->st_gid = buf->st_ino = 0;
|
||||
|
||||
if (lstat && data.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) {
|
||||
/* File is a reparse point. Get the target */
|
||||
HANDLE hLink = NULL;
|
||||
REPARSE_DATA_BUFFER * pbuffer;
|
||||
unsigned int retlength = 0;
|
||||
TSRM_ALLOCA_FLAG(use_heap_large);
|
||||
|
||||
hLink = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_FLAG_OPEN_REPARSE_POINT|FILE_FLAG_BACKUP_SEMANTICS, NULL);
|
||||
if(hLink == INVALID_HANDLE_VALUE) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
pbuffer = (REPARSE_DATA_BUFFER *)tsrm_do_alloca(MAXIMUM_REPARSE_DATA_BUFFER_SIZE, use_heap_large);
|
||||
if(!DeviceIoControl(hLink, FSCTL_GET_REPARSE_POINT, NULL, 0, pbuffer, MAXIMUM_REPARSE_DATA_BUFFER_SIZE, &retlength, NULL)) {
|
||||
tsrm_free_alloca(pbuffer, use_heap_large);
|
||||
CloseHandle(hLink);
|
||||
return -1;
|
||||
}
|
||||
|
||||
CloseHandle(hLink);
|
||||
|
||||
if(pbuffer->ReparseTag == IO_REPARSE_TAG_SYMLINK) {
|
||||
buf->st_mode = S_IFLNK;
|
||||
buf->st_mode |= (data.dwFileAttributes & FILE_ATTRIBUTE_READONLY) ? (S_IREAD|(S_IREAD>>3)|(S_IREAD>>6)) : (S_IREAD|(S_IREAD>>3)|(S_IREAD>>6)|S_IWRITE|(S_IWRITE>>3)|(S_IWRITE>>6));
|
||||
}
|
||||
|
||||
#if 0 /* Not used yet */
|
||||
else if(pbuffer->ReparseTag == IO_REPARSE_TAG_MOUNT_POINT) {
|
||||
buf->st_mode |=;
|
||||
}
|
||||
#endif
|
||||
tsrm_free_alloca(pbuffer, use_heap_large);
|
||||
} else {
|
||||
buf->st_mode = (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? (S_IFDIR|S_IEXEC|(S_IEXEC>>3)|(S_IEXEC>>6)) : S_IFREG;
|
||||
buf->st_mode |= (data.dwFileAttributes & FILE_ATTRIBUTE_READONLY) ? (S_IREAD|(S_IREAD>>3)|(S_IREAD>>6)) : (S_IREAD|(S_IREAD>>3)|(S_IREAD>>6)|S_IWRITE|(S_IWRITE>>3)|(S_IWRITE>>6));
|
||||
}
|
||||
|
||||
buf->st_mode = (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? (S_IFDIR|S_IEXEC|(S_IEXEC>>3)|(S_IEXEC>>6)) : S_IFREG;
|
||||
buf->st_mode |= (data.dwFileAttributes & FILE_ATTRIBUTE_READONLY) ? (S_IREAD|(S_IREAD>>3)|(S_IREAD>>6)) : (S_IREAD|(S_IREAD>>3)|(S_IREAD>>6)|S_IWRITE|(S_IWRITE>>3)|(S_IWRITE>>6));
|
||||
if ((data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) {
|
||||
int len = strlen(path);
|
||||
|
||||
if (path[len-4] == '.') {
|
||||
if (_memicmp(path+len-3, "exe", 3) == 0 ||
|
||||
_memicmp(path+len-3, "com", 3) == 0 ||
|
||||
_memicmp(path+len-3, "bat", 3) == 0 ||
|
||||
_memicmp(path+len-3, "cmd", 3) == 0) {
|
||||
_memicmp(path+len-3, "com", 3) == 0 ||
|
||||
_memicmp(path+len-3, "bat", 3) == 0 ||
|
||||
_memicmp(path+len-3, "cmd", 3) == 0) {
|
||||
buf->st_mode |= (S_IEXEC|(S_IEXEC>>3)|(S_IEXEC>>6));
|
||||
}
|
||||
}
|
||||
@@ -447,7 +332,7 @@ CWD_API void virtual_cwd_startup(void) /* {{{ */
|
||||
}
|
||||
}
|
||||
#else
|
||||
result = getcwd(cwd, sizeof(cwd));
|
||||
result = getcwd(cwd, sizeof(cwd));
|
||||
#endif
|
||||
if (!result) {
|
||||
cwd[0] = '\0';
|
||||
@@ -497,11 +382,8 @@ CWD_API char *virtual_getcwd_ex(size_t *length TSRMLS_DC) /* {{{ */
|
||||
|
||||
*length = 1;
|
||||
retval = (char *) malloc(2);
|
||||
if (retval == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
retval[0] = DEFAULT_SLASH;
|
||||
retval[1] = '\0';
|
||||
retval[1] = '\0';
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -512,9 +394,6 @@ CWD_API char *virtual_getcwd_ex(size_t *length TSRMLS_DC) /* {{{ */
|
||||
|
||||
*length = state->cwd_length+1;
|
||||
retval = (char *) malloc(*length+1);
|
||||
if (retval == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
memcpy(retval, state->cwd, *length);
|
||||
retval[0] = toupper(retval[0]);
|
||||
retval[*length-1] = DEFAULT_SLASH;
|
||||
@@ -614,7 +493,7 @@ CWD_API void realpath_cache_del(const char *path, int path_len TSRMLS_DC) /* {{{
|
||||
|
||||
while (*bucket != NULL) {
|
||||
if (key == (*bucket)->key && path_len == (*bucket)->path_len &&
|
||||
memcmp(path, (*bucket)->path, path_len) == 0) {
|
||||
memcmp(path, (*bucket)->path, path_len) == 0) {
|
||||
realpath_cache_bucket *r = *bucket;
|
||||
*bucket = (*bucket)->next;
|
||||
CWDG(realpath_cache_size) -= sizeof(realpath_cache_bucket) + r->path_len + 1 + r->realpath_len + 1;
|
||||
@@ -631,9 +510,9 @@ static inline void realpath_cache_add(const char *path, int path_len, const char
|
||||
{
|
||||
long size = sizeof(realpath_cache_bucket) + path_len + 1;
|
||||
int same = 1;
|
||||
|
||||
|
||||
if (realpath_len != path_len ||
|
||||
memcmp(path, realpath, path_len) != 0) {
|
||||
memcmp(path, realpath, path_len) != 0) {
|
||||
size += realpath_len + 1;
|
||||
same = 0;
|
||||
}
|
||||
@@ -642,10 +521,6 @@ static inline void realpath_cache_add(const char *path, int path_len, const char
|
||||
realpath_cache_bucket *bucket = malloc(size);
|
||||
unsigned long n;
|
||||
|
||||
if (bucket == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
bucket->key = realpath_cache_key(path, path_len TSRMLS_CC);
|
||||
#else
|
||||
@@ -695,7 +570,7 @@ static inline realpath_cache_bucket* realpath_cache_find(const char *path, int p
|
||||
CWDG(realpath_cache_size) -= sizeof(realpath_cache_bucket) + r->path_len + 1 + r->realpath_len + 1;
|
||||
free(r);
|
||||
} else if (key == (*bucket)->key && path_len == (*bucket)->path_len &&
|
||||
memcmp(path, (*bucket)->path, path_len) == 0) {
|
||||
memcmp(path, (*bucket)->path, path_len) == 0) {
|
||||
return *bucket;
|
||||
} else {
|
||||
bucket = &(*bucket)->next;
|
||||
@@ -707,21 +582,21 @@ static inline realpath_cache_bucket* realpath_cache_find(const char *path, int p
|
||||
|
||||
CWD_API realpath_cache_bucket* realpath_cache_lookup(const char *path, int path_len, time_t t TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
return realpath_cache_find(path, path_len, t TSRMLS_CC);
|
||||
return realpath_cache_find(path, path_len, t TSRMLS_CC);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
CWD_API int realpath_cache_size(TSRMLS_D)
|
||||
CWD_API int realpath_cache_size(TSRMLS_D)
|
||||
{
|
||||
return CWDG(realpath_cache_size);
|
||||
}
|
||||
|
||||
CWD_API int realpath_cache_max_buckets(TSRMLS_D)
|
||||
CWD_API int realpath_cache_max_buckets(TSRMLS_D)
|
||||
{
|
||||
return (sizeof(CWDG(realpath_cache)) / sizeof(CWDG(realpath_cache)[0]));
|
||||
}
|
||||
|
||||
CWD_API realpath_cache_bucket** realpath_cache_get_buckets(TSRMLS_D)
|
||||
CWD_API realpath_cache_bucket** realpath_cache_get_buckets(TSRMLS_D)
|
||||
{
|
||||
return CWDG(realpath_cache);
|
||||
}
|
||||
@@ -775,14 +650,14 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
|
||||
if (!start) {
|
||||
/* leading '..' must not be removed in case of relative path */
|
||||
if (j == 0 && path[0] == '.' && path[1] == '.' &&
|
||||
IS_SLASH(path[2])) {
|
||||
IS_SLASH(path[2])) {
|
||||
path[3] = '.';
|
||||
path[4] = '.';
|
||||
path[5] = DEFAULT_SLASH;
|
||||
j = 5;
|
||||
} else if (j > 0 &&
|
||||
path[j+1] == '.' && path[j+2] == '.' &&
|
||||
IS_SLASH(path[j+3])) {
|
||||
} else if (j > 0 &&
|
||||
path[j+1] == '.' && path[j+2] == '.' &&
|
||||
IS_SLASH(path[j+3])) {
|
||||
j += 4;
|
||||
path[j++] = '.';
|
||||
path[j++] = '.';
|
||||
@@ -798,7 +673,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
|
||||
path[len] = 0;
|
||||
|
||||
save = (use_realpath != CWD_EXPAND);
|
||||
@@ -808,18 +683,18 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
|
||||
if (!*t) {
|
||||
*t = time(0);
|
||||
}
|
||||
if ((bucket = realpath_cache_find(path, len, *t TSRMLS_CC)) != NULL) {
|
||||
if (is_dir && !bucket->is_dir) {
|
||||
if ((bucket = realpath_cache_find(path, len, *t TSRMLS_CC)) != NULL) {
|
||||
if (is_dir && !bucket->is_dir) {
|
||||
/* not a directory */
|
||||
return -1;
|
||||
} else {
|
||||
if (link_is_dir) {
|
||||
*link_is_dir = bucket->is_dir;
|
||||
}
|
||||
} else {
|
||||
if (link_is_dir) {
|
||||
*link_is_dir = bucket->is_dir;
|
||||
}
|
||||
memcpy(path, bucket->realpath, bucket->realpath_len + 1);
|
||||
return bucket->realpath_len;
|
||||
return bucket->realpath_len;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
@@ -831,7 +706,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
|
||||
/* continue resolution anyway but don't save result in the cache */
|
||||
save = 0;
|
||||
}
|
||||
|
||||
|
||||
if (save) {
|
||||
FindClose(hFind);
|
||||
}
|
||||
@@ -839,9 +714,9 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
|
||||
tmp = tsrm_do_alloca(len+1, use_heap);
|
||||
memcpy(tmp, path, len+1);
|
||||
|
||||
if(save &&
|
||||
!(IS_UNC_PATH(path, len) && len >= 3 && path[2] != '?') &&
|
||||
(data.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)) {
|
||||
if(save &&
|
||||
!(IS_UNC_PATH(path, len) && len >= 3 && path[2] != '?') &&
|
||||
(data.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)) {
|
||||
/* File is a reparse point. Get the target */
|
||||
HANDLE hLink = NULL;
|
||||
REPARSE_DATA_BUFFER * pbuffer;
|
||||
@@ -864,9 +739,6 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
|
||||
}
|
||||
|
||||
pbuffer = (REPARSE_DATA_BUFFER *)tsrm_do_alloca(MAXIMUM_REPARSE_DATA_BUFFER_SIZE, use_heap_large);
|
||||
if (pbuffer == NULL) {
|
||||
return -1;
|
||||
}
|
||||
if(!DeviceIoControl(hLink, FSCTL_GET_REPARSE_POINT, NULL, 0, pbuffer, MAXIMUM_REPARSE_DATA_BUFFER_SIZE, &retlength, NULL)) {
|
||||
tsrm_free_alloca(pbuffer, use_heap_large);
|
||||
CloseHandle(hLink);
|
||||
@@ -879,7 +751,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
|
||||
reparsetarget = pbuffer->SymbolicLinkReparseBuffer.ReparseTarget;
|
||||
printname_len = pbuffer->MountPointReparseBuffer.PrintNameLength / sizeof(WCHAR);
|
||||
isabsolute = (pbuffer->SymbolicLinkReparseBuffer.Flags == 0) ? 1 : 0;
|
||||
if (!WideCharToMultiByte(CP_THREAD_ACP, 0,
|
||||
if (!WideCharToMultiByte(CP_THREAD_ACP, 0,
|
||||
reparsetarget + pbuffer->MountPointReparseBuffer.PrintNameOffset / sizeof(WCHAR),
|
||||
printname_len + 1,
|
||||
printname, MAX_PATH, NULL, NULL
|
||||
@@ -891,7 +763,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
|
||||
printname[printname_len] = 0;
|
||||
|
||||
substitutename_len = pbuffer->MountPointReparseBuffer.SubstituteNameLength / sizeof(WCHAR);
|
||||
if (!WideCharToMultiByte(CP_THREAD_ACP, 0,
|
||||
if (!WideCharToMultiByte(CP_THREAD_ACP, 0,
|
||||
reparsetarget + pbuffer->MountPointReparseBuffer.SubstituteNameOffset / sizeof(WCHAR),
|
||||
substitutename_len + 1,
|
||||
substitutename, MAX_PATH, NULL, NULL
|
||||
@@ -905,7 +777,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
|
||||
isabsolute = 1;
|
||||
reparsetarget = pbuffer->MountPointReparseBuffer.ReparseTarget;
|
||||
printname_len = pbuffer->MountPointReparseBuffer.PrintNameLength / sizeof(WCHAR);
|
||||
if (!WideCharToMultiByte(CP_THREAD_ACP, 0,
|
||||
if (!WideCharToMultiByte(CP_THREAD_ACP, 0,
|
||||
reparsetarget + pbuffer->MountPointReparseBuffer.PrintNameOffset / sizeof(WCHAR),
|
||||
printname_len + 1,
|
||||
printname, MAX_PATH, NULL, NULL
|
||||
@@ -916,7 +788,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
|
||||
printname[pbuffer->MountPointReparseBuffer.PrintNameLength / sizeof(WCHAR)] = 0;
|
||||
|
||||
substitutename_len = pbuffer->MountPointReparseBuffer.SubstituteNameLength / sizeof(WCHAR);
|
||||
if (!WideCharToMultiByte(CP_THREAD_ACP, 0,
|
||||
if (!WideCharToMultiByte(CP_THREAD_ACP, 0,
|
||||
reparsetarget + pbuffer->MountPointReparseBuffer.SubstituteNameOffset / sizeof(WCHAR),
|
||||
substitutename_len + 1,
|
||||
substitutename, MAX_PATH, NULL, NULL
|
||||
@@ -931,31 +803,29 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
|
||||
}
|
||||
|
||||
if(isabsolute && substitutename_len > 4) {
|
||||
/* Do not resolve volumes (for now). A mounted point can
|
||||
/* Do not resolve volumes (for now). A mounted point can
|
||||
target a volume without a drive, it is not certain that
|
||||
all IO functions we use in php and its deps support
|
||||
all IO functions we use in php and its deps support
|
||||
path with volume GUID instead of the DOS way, like:
|
||||
d:\test\mnt\foo
|
||||
\\?\Volume{62d1c3f8-83b9-11de-b108-806e6f6e6963}\foo
|
||||
*/
|
||||
if (strncmp(substitutename, "\\??\\Volume{",11) == 0
|
||||
|| strncmp(substitutename, "\\\\?\\Volume{",11) == 0
|
||||
|| strncmp(substitutename, "\\??\\UNC\\", 8) == 0
|
||||
) {
|
||||
isVolume = TRUE;
|
||||
if (strncmp(substitutename, "\\??\\Volume{",11) == 0
|
||||
|| strncmp(substitutename, "\\\\?\\Volume{",11) == 0) {
|
||||
isVolume = TRUE;
|
||||
substitutename_off = 0;
|
||||
} else
|
||||
/* do not use the \??\ and \\?\ prefix*/
|
||||
if (strncmp(substitutename, "\\??\\", 4) == 0
|
||||
if (strncmp(substitutename, "\\??\\", 4) == 0
|
||||
|| strncmp(substitutename, "\\\\?\\", 4) == 0) {
|
||||
substitutename_off = 4;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isVolume) {
|
||||
char * tmp2 = substitutename + substitutename_off;
|
||||
char * tmp = substitutename + substitutename_off;
|
||||
for(bufindex = 0; bufindex < (substitutename_len - substitutename_off); bufindex++) {
|
||||
*(path + bufindex) = *(tmp2 + bufindex);
|
||||
*(path + bufindex) = *(tmp + bufindex);
|
||||
}
|
||||
|
||||
*(path + bufindex) = 0;
|
||||
@@ -1017,7 +887,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
|
||||
tmp = tsrm_do_alloca(len+1, use_heap);
|
||||
memcpy(tmp, path, len+1);
|
||||
#else
|
||||
if (save && php_sys_lstat(path, &st) < 0) {
|
||||
if (save && lstat(path, &st) < 0) {
|
||||
if (use_realpath == CWD_REALPATH) {
|
||||
/* file not found */
|
||||
return -1;
|
||||
@@ -1030,8 +900,8 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
|
||||
memcpy(tmp, path, len+1);
|
||||
|
||||
if (save && S_ISLNK(st.st_mode)) {
|
||||
if (++(*ll) > LINK_MAX || (j = php_sys_readlink(tmp, path, MAXPATHLEN)) < 0) {
|
||||
/* too many links or broken symlinks */
|
||||
if (++(*ll) > LINK_MAX || (j = readlink(tmp, path, MAXPATHLEN)) < 0) {
|
||||
/* too many links or broken symlinks */
|
||||
tsrm_free_alloca(tmp, use_heap);
|
||||
return -1;
|
||||
}
|
||||
@@ -1043,10 +913,10 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
if (i + j >= MAXPATHLEN-1) {
|
||||
if (i + j >= MAXPATHLEN-1) {
|
||||
tsrm_free_alloca(tmp, use_heap);
|
||||
return -1; /* buffer overflow */
|
||||
}
|
||||
}
|
||||
memmove(path+i, path, j+1);
|
||||
memcpy(path, tmp, i-1);
|
||||
path[i-1] = DEFAULT_SLASH;
|
||||
@@ -1118,7 +988,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
|
||||
|
||||
/* Resolve path relatively to state and put the real path into state */
|
||||
/* returns 0 for ok, 1 for error */
|
||||
CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func verify_path, int use_realpath TSRMLS_DC) /* {{{ */
|
||||
CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func verify_path, int use_realpath) /* {{{ */
|
||||
{
|
||||
int path_length = strlen(path);
|
||||
char resolved_path[MAXPATHLEN];
|
||||
@@ -1128,6 +998,7 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
|
||||
int ret;
|
||||
int add_slash;
|
||||
void *tmp;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
if (path_length == 0 || path_length >= MAXPATHLEN-1) {
|
||||
#ifdef TSRM_WIN32
|
||||
@@ -1167,18 +1038,18 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
|
||||
state_cwd_length = 2;
|
||||
while (IS_SLASH(state->cwd[state_cwd_length])) {
|
||||
state_cwd_length++;
|
||||
}
|
||||
}
|
||||
while (state->cwd[state_cwd_length] &&
|
||||
!IS_SLASH(state->cwd[state_cwd_length])) {
|
||||
!IS_SLASH(state->cwd[state_cwd_length])) {
|
||||
state_cwd_length++;
|
||||
}
|
||||
}
|
||||
while (IS_SLASH(state->cwd[state_cwd_length])) {
|
||||
state_cwd_length++;
|
||||
}
|
||||
}
|
||||
while (state->cwd[state_cwd_length] &&
|
||||
!IS_SLASH(state->cwd[state_cwd_length])) {
|
||||
!IS_SLASH(state->cwd[state_cwd_length])) {
|
||||
state_cwd_length++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1190,7 +1061,7 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
|
||||
memcpy(resolved_path + state_cwd_length + 1, path, path_length + 1);
|
||||
path_length += state_cwd_length + 1;
|
||||
}
|
||||
} else {
|
||||
} else {
|
||||
#ifdef TSRM_WIN32
|
||||
if (path_length > 2 && path[1] == ':' && !IS_SLASH(path[2])) {
|
||||
resolved_path[0] = path[0];
|
||||
@@ -1201,11 +1072,11 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
|
||||
} else
|
||||
#endif
|
||||
memcpy(resolved_path, path, path_length + 1);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
if (memchr(resolved_path, '*', path_length) ||
|
||||
memchr(resolved_path, '?', path_length)) {
|
||||
memchr(resolved_path, '?', path_length)) {
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
@@ -1255,12 +1126,12 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
|
||||
add_slash = (use_realpath != CWD_REALPATH) && path_length > 0 && IS_SLASH(resolved_path[path_length-1]);
|
||||
t = CWDG(realpath_cache_ttl) ? 0 : -1;
|
||||
path_length = tsrm_realpath_r(resolved_path, start, path_length, &ll, &t, use_realpath, 0, NULL TSRMLS_CC);
|
||||
|
||||
|
||||
if (path_length < 0) {
|
||||
errno = ENOENT;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
if (!start && !path_length) {
|
||||
resolved_path[path_length++] = '.';
|
||||
}
|
||||
@@ -1313,7 +1184,7 @@ verify:
|
||||
memcpy(state->cwd, resolved_path, state->cwd_length+1);
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
|
||||
#if VIRTUAL_CWD_DEBUG
|
||||
fprintf (stderr, "virtual_file_ex() = %s\n",state->cwd);
|
||||
#endif
|
||||
@@ -1323,7 +1194,7 @@ verify:
|
||||
|
||||
CWD_API int virtual_chdir(const char *path TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
return virtual_file_ex(&CWDG(cwd), path, php_is_dir_ok, CWD_REALPATH TSRMLS_CC)?-1:0;
|
||||
return virtual_file_ex(&CWDG(cwd), path, php_is_dir_ok, CWD_REALPATH)?-1:0;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1336,7 +1207,7 @@ CWD_API int virtual_chdir_file(const char *path, int (*p_chdir)(const char *path
|
||||
|
||||
if (length == 0) {
|
||||
return 1; /* Can't cd to empty string */
|
||||
}
|
||||
}
|
||||
while(--length >= 0 && !IS_SLASH(path[length])) {
|
||||
}
|
||||
|
||||
@@ -1370,28 +1241,20 @@ CWD_API char *virtual_realpath(const char *path, char *real_path TSRMLS_DC) /* {
|
||||
/* realpath("") returns CWD */
|
||||
if (!*path) {
|
||||
new_state.cwd = (char*)malloc(1);
|
||||
if (new_state.cwd == NULL) {
|
||||
retval = NULL;
|
||||
goto end;
|
||||
}
|
||||
new_state.cwd[0] = '\0';
|
||||
new_state.cwd_length = 0;
|
||||
if (VCWD_GETCWD(cwd, MAXPATHLEN)) {
|
||||
path = cwd;
|
||||
new_state.cwd_length = 0;
|
||||
if (VCWD_GETCWD(cwd, MAXPATHLEN)) {
|
||||
path = cwd;
|
||||
}
|
||||
} else if (!IS_ABSOLUTE_PATH(path, strlen(path))) {
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
} else {
|
||||
new_state.cwd = (char*)malloc(1);
|
||||
if (new_state.cwd == NULL) {
|
||||
retval = NULL;
|
||||
goto end;
|
||||
}
|
||||
new_state.cwd[0] = '\0';
|
||||
new_state.cwd_length = 0;
|
||||
new_state.cwd_length = 0;
|
||||
}
|
||||
|
||||
if (virtual_file_ex(&new_state, path, NULL, CWD_REALPATH TSRMLS_CC)==0) {
|
||||
if (virtual_file_ex(&new_state, path, NULL, CWD_REALPATH)==0) {
|
||||
int len = new_state.cwd_length>MAXPATHLEN-1?MAXPATHLEN-1:new_state.cwd_length;
|
||||
|
||||
memcpy(real_path, new_state.cwd, len);
|
||||
@@ -1402,7 +1265,7 @@ CWD_API char *virtual_realpath(const char *path, char *real_path TSRMLS_DC) /* {
|
||||
}
|
||||
|
||||
CWD_STATE_FREE(&new_state);
|
||||
end:
|
||||
|
||||
return retval;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1413,7 +1276,7 @@ CWD_API int virtual_filepath_ex(const char *path, char **filepath, verify_path_f
|
||||
int retval;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
retval = virtual_file_ex(&new_state, path, verify_path, CWD_FILEPATH TSRMLS_CC);
|
||||
retval = virtual_file_ex(&new_state, path, verify_path, CWD_FILEPATH);
|
||||
|
||||
*filepath = new_state.cwd;
|
||||
|
||||
@@ -1438,7 +1301,7 @@ CWD_API FILE *virtual_fopen(const char *path, const char *mode TSRMLS_DC) /* {{{
|
||||
}
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
if (virtual_file_ex(&new_state, path, NULL, CWD_FILEPATH TSRMLS_CC)) {
|
||||
if (virtual_file_ex(&new_state, path, NULL, CWD_FILEPATH)) {
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return NULL;
|
||||
}
|
||||
@@ -1454,21 +1317,21 @@ CWD_API int virtual_access(const char *pathname, int mode TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
cwd_state new_state;
|
||||
int ret;
|
||||
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
if (virtual_file_ex(&new_state, pathname, NULL, CWD_REALPATH TSRMLS_CC)) {
|
||||
if (virtual_file_ex(&new_state, pathname, NULL, CWD_REALPATH)) {
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return -1;
|
||||
}
|
||||
|
||||
#if defined(TSRM_WIN32)
|
||||
ret = tsrm_win32_access(new_state.cwd, mode TSRMLS_CC);
|
||||
ret = tsrm_win32_access(new_state.cwd, mode);
|
||||
#else
|
||||
ret = access(new_state.cwd, mode);
|
||||
#endif
|
||||
|
||||
|
||||
CWD_STATE_FREE(&new_state);
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1489,12 +1352,12 @@ static void UnixTimeToFileTime(time_t t, LPFILETIME pft) /* {{{ */
|
||||
TSRM_API int win32_utime(const char *filename, struct utimbuf *buf) /* {{{ */
|
||||
{
|
||||
FILETIME mtime, atime;
|
||||
HANDLE hFile;
|
||||
HANDLE hFile;
|
||||
|
||||
hFile = CreateFile(filename, GENERIC_WRITE, FILE_SHARE_WRITE|FILE_SHARE_READ, NULL,
|
||||
OPEN_ALWAYS, FILE_FLAG_BACKUP_SEMANTICS, NULL);
|
||||
|
||||
/* OPEN_ALWAYS mode sets the last error to ERROR_ALREADY_EXISTS but
|
||||
/* OPEN_ALWAYS mode sets the last error to ERROR_ALREADY_EXISTS but
|
||||
the CreateFile operation succeeds */
|
||||
if (GetLastError() == ERROR_ALREADY_EXISTS) {
|
||||
SetLastError(0);
|
||||
@@ -1529,7 +1392,7 @@ CWD_API int virtual_utime(const char *filename, struct utimbuf *buf TSRMLS_DC) /
|
||||
int ret;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
if (virtual_file_ex(&new_state, filename, NULL, CWD_REALPATH TSRMLS_CC)) {
|
||||
if (virtual_file_ex(&new_state, filename, NULL, CWD_REALPATH)) {
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return -1;
|
||||
}
|
||||
@@ -1552,7 +1415,7 @@ CWD_API int virtual_chmod(const char *filename, mode_t mode TSRMLS_DC) /* {{{ */
|
||||
int ret;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
if (virtual_file_ex(&new_state, filename, NULL, CWD_REALPATH TSRMLS_CC)) {
|
||||
if (virtual_file_ex(&new_state, filename, NULL, CWD_REALPATH)) {
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return -1;
|
||||
}
|
||||
@@ -1571,7 +1434,7 @@ CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group, int li
|
||||
int ret;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
if (virtual_file_ex(&new_state, filename, NULL, CWD_REALPATH TSRMLS_CC)) {
|
||||
if (virtual_file_ex(&new_state, filename, NULL, CWD_REALPATH)) {
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return -1;
|
||||
}
|
||||
@@ -1598,7 +1461,7 @@ CWD_API int virtual_open(const char *path TSRMLS_DC, int flags, ...) /* {{{ */
|
||||
int f;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
if (virtual_file_ex(&new_state, path, NULL, CWD_FILEPATH TSRMLS_CC)) {
|
||||
if (virtual_file_ex(&new_state, path, NULL, CWD_FILEPATH)) {
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return -1;
|
||||
}
|
||||
@@ -1614,7 +1477,7 @@ CWD_API int virtual_open(const char *path TSRMLS_DC, int flags, ...) /* {{{ */
|
||||
f = open(new_state.cwd, flags, mode);
|
||||
} else {
|
||||
f = open(new_state.cwd, flags);
|
||||
}
|
||||
}
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return f;
|
||||
}
|
||||
@@ -1626,7 +1489,7 @@ CWD_API int virtual_creat(const char *path, mode_t mode TSRMLS_DC) /* {{{ */
|
||||
int f;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
if (virtual_file_ex(&new_state, path, NULL, CWD_FILEPATH TSRMLS_CC)) {
|
||||
if (virtual_file_ex(&new_state, path, NULL, CWD_FILEPATH)) {
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return -1;
|
||||
}
|
||||
@@ -1645,14 +1508,14 @@ CWD_API int virtual_rename(char *oldname, char *newname TSRMLS_DC) /* {{{ */
|
||||
int retval;
|
||||
|
||||
CWD_STATE_COPY(&old_state, &CWDG(cwd));
|
||||
if (virtual_file_ex(&old_state, oldname, NULL, CWD_EXPAND TSRMLS_CC)) {
|
||||
if (virtual_file_ex(&old_state, oldname, NULL, CWD_EXPAND)) {
|
||||
CWD_STATE_FREE(&old_state);
|
||||
return -1;
|
||||
}
|
||||
oldname = old_state.cwd;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
if (virtual_file_ex(&new_state, newname, NULL, CWD_EXPAND TSRMLS_CC)) {
|
||||
if (virtual_file_ex(&new_state, newname, NULL, CWD_EXPAND)) {
|
||||
CWD_STATE_FREE(&old_state);
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return -1;
|
||||
@@ -1681,7 +1544,7 @@ CWD_API int virtual_stat(const char *path, struct stat *buf TSRMLS_DC) /* {{{ */
|
||||
int retval;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
if (virtual_file_ex(&new_state, path, NULL, CWD_REALPATH TSRMLS_CC)) {
|
||||
if (virtual_file_ex(&new_state, path, NULL, CWD_REALPATH)) {
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return -1;
|
||||
}
|
||||
@@ -1693,23 +1556,25 @@ CWD_API int virtual_stat(const char *path, struct stat *buf TSRMLS_DC) /* {{{ */
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
#if !defined(TSRM_WIN32)
|
||||
CWD_API int virtual_lstat(const char *path, struct stat *buf TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
cwd_state new_state;
|
||||
int retval;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
if (virtual_file_ex(&new_state, path, NULL, CWD_EXPAND TSRMLS_CC)) {
|
||||
if (virtual_file_ex(&new_state, path, NULL, CWD_EXPAND)) {
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return -1;
|
||||
}
|
||||
|
||||
retval = php_sys_lstat(new_state.cwd, buf);
|
||||
retval = lstat(new_state.cwd, buf);
|
||||
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return retval;
|
||||
}
|
||||
/* }}} */
|
||||
#endif
|
||||
|
||||
CWD_API int virtual_unlink(const char *path TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
@@ -1717,7 +1582,7 @@ CWD_API int virtual_unlink(const char *path TSRMLS_DC) /* {{{ */
|
||||
int retval;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
if (virtual_file_ex(&new_state, path, NULL, CWD_EXPAND TSRMLS_CC)) {
|
||||
if (virtual_file_ex(&new_state, path, NULL, CWD_EXPAND)) {
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return -1;
|
||||
}
|
||||
@@ -1735,7 +1600,7 @@ CWD_API int virtual_mkdir(const char *pathname, mode_t mode TSRMLS_DC) /* {{{ */
|
||||
int retval;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
if (virtual_file_ex(&new_state, pathname, NULL, CWD_FILEPATH TSRMLS_CC)) {
|
||||
if (virtual_file_ex(&new_state, pathname, NULL, CWD_FILEPATH)) {
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return -1;
|
||||
}
|
||||
@@ -1756,7 +1621,7 @@ CWD_API int virtual_rmdir(const char *pathname TSRMLS_DC) /* {{{ */
|
||||
int retval;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
if (virtual_file_ex(&new_state, pathname, NULL, CWD_EXPAND TSRMLS_CC)) {
|
||||
if (virtual_file_ex(&new_state, pathname, NULL, CWD_EXPAND)) {
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return -1;
|
||||
}
|
||||
@@ -1778,7 +1643,7 @@ CWD_API DIR *virtual_opendir(const char *pathname TSRMLS_DC) /* {{{ */
|
||||
DIR *retval;
|
||||
|
||||
CWD_STATE_COPY(&new_state, &CWDG(cwd));
|
||||
if (virtual_file_ex(&new_state, pathname, NULL, CWD_REALPATH TSRMLS_CC)) {
|
||||
if (virtual_file_ex(&new_state, pathname, NULL, CWD_REALPATH)) {
|
||||
CWD_STATE_FREE(&new_state);
|
||||
return NULL;
|
||||
}
|
||||
@@ -1793,7 +1658,7 @@ CWD_API DIR *virtual_opendir(const char *pathname TSRMLS_DC) /* {{{ */
|
||||
#ifdef TSRM_WIN32
|
||||
CWD_API FILE *virtual_popen(const char *command, const char *type TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
return popen_ex(command, type, CWDG(cwd).cwd, NULL TSRMLS_CC);
|
||||
return popen_ex(command, type, CWDG(cwd).cwd, NULL);
|
||||
}
|
||||
/* }}} */
|
||||
#elif defined(NETWARE)
|
||||
@@ -1873,7 +1738,7 @@ CWD_API FILE *virtual_popen(const char *command, const char *type TSRMLS_DC) /*
|
||||
}
|
||||
*ptr++ = '\'';
|
||||
}
|
||||
|
||||
|
||||
*ptr++ = ' ';
|
||||
*ptr++ = ';';
|
||||
*ptr++ = ' ';
|
||||
@@ -1895,28 +1760,22 @@ CWD_API char *tsrm_realpath(const char *path, char *real_path TSRMLS_DC) /* {{{
|
||||
/* realpath("") returns CWD */
|
||||
if (!*path) {
|
||||
new_state.cwd = (char*)malloc(1);
|
||||
if (new_state.cwd == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
new_state.cwd[0] = '\0';
|
||||
new_state.cwd_length = 0;
|
||||
if (VCWD_GETCWD(cwd, MAXPATHLEN)) {
|
||||
path = cwd;
|
||||
new_state.cwd_length = 0;
|
||||
if (VCWD_GETCWD(cwd, MAXPATHLEN)) {
|
||||
path = cwd;
|
||||
}
|
||||
} else if (!IS_ABSOLUTE_PATH(path, strlen(path)) &&
|
||||
VCWD_GETCWD(cwd, MAXPATHLEN)) {
|
||||
VCWD_GETCWD(cwd, MAXPATHLEN)) {
|
||||
new_state.cwd = strdup(cwd);
|
||||
new_state.cwd_length = strlen(cwd);
|
||||
} else {
|
||||
new_state.cwd = (char*)malloc(1);
|
||||
if (new_state.cwd == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
new_state.cwd[0] = '\0';
|
||||
new_state.cwd_length = 0;
|
||||
new_state.cwd_length = 0;
|
||||
}
|
||||
|
||||
if (virtual_file_ex(&new_state, path, NULL, CWD_REALPATH TSRMLS_CC)) {
|
||||
if (virtual_file_ex(&new_state, path, NULL, CWD_REALPATH)) {
|
||||
free(new_state.cwd);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+12
-16
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2011 The PHP Group |
|
||||
| Copyright (c) 1997-2010 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -14,7 +14,6 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Andi Gutmans <andi@zend.com> |
|
||||
| Sascha Schumann <sascha@schumann.cx> |
|
||||
| Pierre Joye <pierre@php.net> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
@@ -108,7 +107,7 @@ typedef unsigned short mode_t;
|
||||
#define COPY_WHEN_ABSOLUTE(path) 0
|
||||
#endif
|
||||
|
||||
#ifndef IS_ABSOLUTE_PATH
|
||||
#ifndef IS_ABSOLUTE_PATH
|
||||
#define IS_ABSOLUTE_PATH(path, len) \
|
||||
(IS_SLASH(path[0]))
|
||||
#endif
|
||||
@@ -130,16 +129,9 @@ typedef unsigned short mode_t;
|
||||
#endif
|
||||
|
||||
#ifdef TSRM_WIN32
|
||||
CWD_API int php_sys_stat_ex(const char *path, struct stat *buf, int lstat);
|
||||
# define php_sys_stat(path, buf) php_sys_stat_ex(path, buf, 0)
|
||||
# define php_sys_lstat(path, buf) php_sys_stat_ex(path, buf, 1)
|
||||
CWD_API int php_sys_readlink(const char *link, char *target, size_t target_len);
|
||||
CWD_API int php_sys_stat(const char *path, struct stat *buf);
|
||||
#else
|
||||
# define php_sys_stat stat
|
||||
# define php_sys_lstat lstat
|
||||
# ifdef HAVE_SYMLINK
|
||||
# define php_sys_readlink(link, target, target_len) readlink(link, target, target_len)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
typedef struct _cwd_state {
|
||||
@@ -163,7 +155,9 @@ CWD_API int virtual_open(const char *path TSRMLS_DC, int flags, ...);
|
||||
CWD_API int virtual_creat(const char *path, mode_t mode TSRMLS_DC);
|
||||
CWD_API int virtual_rename(char *oldname, char *newname TSRMLS_DC);
|
||||
CWD_API int virtual_stat(const char *path, struct stat *buf TSRMLS_DC);
|
||||
#if !defined(TSRM_WIN32)
|
||||
CWD_API int virtual_lstat(const char *path, struct stat *buf TSRMLS_DC);
|
||||
#endif
|
||||
CWD_API int virtual_unlink(const char *path TSRMLS_DC);
|
||||
CWD_API int virtual_mkdir(const char *pathname, mode_t mode TSRMLS_DC);
|
||||
CWD_API int virtual_rmdir(const char *pathname TSRMLS_DC);
|
||||
@@ -194,14 +188,14 @@ CWD_API int virtual_chmod(const char *filename, mode_t mode TSRMLS_DC);
|
||||
CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group, int link TSRMLS_DC);
|
||||
#endif
|
||||
|
||||
/* One of the following constants must be used as the last argument
|
||||
/* One of the following constants must be used as the last argument
|
||||
in virtual_file_ex() call. */
|
||||
|
||||
#define CWD_EXPAND 0 /* expand "." and ".." but dont resolve symlinks */
|
||||
#define CWD_FILEPATH 1 /* resolve symlinks if file is exist otherwise expand */
|
||||
#define CWD_REALPATH 2 /* call realpath(), resolve symlinks. File must exist */
|
||||
|
||||
CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func verify_path, int use_realpath TSRMLS_DC);
|
||||
CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func verify_path, int use_realpath);
|
||||
|
||||
CWD_API char *tsrm_realpath(const char *path, char *real_path TSRMLS_DC);
|
||||
|
||||
@@ -222,7 +216,7 @@ typedef struct _realpath_cache_bucket {
|
||||
unsigned char is_wvalid;
|
||||
unsigned char is_writable;
|
||||
#endif
|
||||
struct _realpath_cache_bucket *next;
|
||||
struct _realpath_cache_bucket *next;
|
||||
} realpath_cache_bucket;
|
||||
|
||||
typedef struct _virtual_cwd_globals {
|
||||
@@ -250,7 +244,7 @@ CWD_API realpath_cache_bucket** realpath_cache_get_buckets(TSRMLS_D);
|
||||
|
||||
/* The actual macros to be used in programs using TSRM
|
||||
* If the program defines VIRTUAL_DIR it will use the
|
||||
* virtual_* functions
|
||||
* virtual_* functions
|
||||
*/
|
||||
|
||||
#ifdef VIRTUAL_DIR
|
||||
@@ -267,7 +261,9 @@ CWD_API realpath_cache_bucket** realpath_cache_get_buckets(TSRMLS_D);
|
||||
#define VCWD_REALPATH(path, real_path) virtual_realpath(path, real_path TSRMLS_CC)
|
||||
#define VCWD_RENAME(oldname, newname) virtual_rename(oldname, newname TSRMLS_CC)
|
||||
#define VCWD_STAT(path, buff) virtual_stat(path, buff TSRMLS_CC)
|
||||
#if !defined(TSRM_WIN32)
|
||||
# define VCWD_LSTAT(path, buff) virtual_lstat(path, buff TSRMLS_CC)
|
||||
#endif
|
||||
#define VCWD_UNLINK(path) virtual_unlink(path TSRMLS_CC)
|
||||
#define VCWD_MKDIR(pathname, mode) virtual_mkdir(pathname, mode TSRMLS_CC)
|
||||
#define VCWD_RMDIR(pathname) virtual_rmdir(pathname TSRMLS_CC)
|
||||
@@ -310,7 +306,7 @@ CWD_API realpath_cache_bucket** realpath_cache_get_buckets(TSRMLS_D);
|
||||
#define VCWD_OPENDIR(pathname) opendir(pathname)
|
||||
#define VCWD_POPEN(command, type) popen(command, type)
|
||||
#if defined(TSRM_WIN32)
|
||||
#define VCWD_ACCESS(pathname, mode) tsrm_win32_access(pathname, mode TSRMLS_CC)
|
||||
#define VCWD_ACCESS(pathname, mode) tsrm_win32_access(pathname, mode)
|
||||
#else
|
||||
#define VCWD_ACCESS(pathname, mode) access(pathname, mode)
|
||||
#endif
|
||||
|
||||
+8
-6
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2011 The PHP Group |
|
||||
| Copyright (c) 1997-2010 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -190,7 +190,7 @@ Finished:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
TSRM_API int tsrm_win32_access(const char *pathname, int mode TSRMLS_DC)
|
||||
TSRM_API int tsrm_win32_access(const char *pathname, int mode)
|
||||
{
|
||||
time_t t;
|
||||
HANDLE thread_token;
|
||||
@@ -208,6 +208,8 @@ TSRM_API int tsrm_win32_access(const char *pathname, int mode TSRMLS_DC)
|
||||
realpath_cache_bucket * bucket = NULL;
|
||||
char * real_path = NULL;
|
||||
|
||||
TSRMLS_FETCH();
|
||||
|
||||
if (mode == 1 /*X_OK*/) {
|
||||
DWORD type;
|
||||
return GetBinaryType(pathname, &type) ? 0 : -1;
|
||||
@@ -446,12 +448,10 @@ static HANDLE dupHandle(HANDLE fh, BOOL inherit) {
|
||||
|
||||
TSRM_API FILE *popen(const char *command, const char *type)
|
||||
{
|
||||
TSRMLS_FETCH();
|
||||
|
||||
return popen_ex(command, type, NULL, NULL TSRMLS_CC);
|
||||
return popen_ex(command, type, NULL, NULL);
|
||||
}
|
||||
|
||||
TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd, char *env TSRMLS_DC)
|
||||
TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd, char *env)
|
||||
{
|
||||
FILE *stream = NULL;
|
||||
int fno, type_len = strlen(type), read, mode;
|
||||
@@ -469,6 +469,8 @@ TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd,
|
||||
HANDLE token_user = NULL;
|
||||
BOOL asuser = TRUE;
|
||||
|
||||
TSRMLS_FETCH();
|
||||
|
||||
if (!type) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+3
-3
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2011 The PHP Group |
|
||||
| Copyright (c) 1997-2010 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -95,10 +95,10 @@ char * tsrm_win32_get_path_sid_key(const char *pathname TSRMLS_DC);
|
||||
TSRM_API void tsrm_win32_startup(void);
|
||||
TSRM_API void tsrm_win32_shutdown(void);
|
||||
|
||||
TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd, char *env TSRMLS_DC);
|
||||
TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd, char *env);
|
||||
TSRM_API FILE *popen(const char *command, const char *type);
|
||||
TSRM_API int pclose(FILE *stream);
|
||||
TSRM_API int tsrm_win32_access(const char *pathname, int mode TSRMLS_DC);
|
||||
TSRM_API int tsrm_win32_access(const char *pathname, int mode);
|
||||
TSRM_API int win32_utime(const char *filename, struct utimbuf *buf);
|
||||
|
||||
TSRM_API int shmget(int key, int size, int flags);
|
||||
|
||||
@@ -1,25 +1,23 @@
|
||||
$Id$
|
||||
|
||||
UPGRADE NOTES - PHP X.Y
|
||||
UPGRADE NOTES - PHP 5.3
|
||||
|
||||
1. Changes made to default configuration
|
||||
2. Reserved words and classes
|
||||
3. Changes made to engine behaviour
|
||||
4. Changes made to existing functions
|
||||
5. Changes made to existing methods
|
||||
6. Changes made to existing classes
|
||||
7. Deprecated
|
||||
8. Removed
|
||||
9. Extensions:
|
||||
1. Reserved words and classes
|
||||
2. Changes made to existing functions
|
||||
3. Changes made to existing methods
|
||||
4. Changes made to existing classes
|
||||
5. Deprecated
|
||||
6. Undeprecated
|
||||
7. Extensions:
|
||||
a. moved out to PECL and actively maintained there
|
||||
b. no longer maintained
|
||||
c. with changed behaviour
|
||||
d. no longer possible to disable
|
||||
10. Changes in SAPI support
|
||||
11. Changes in INI directives
|
||||
12. Syntax additions
|
||||
13. Windows support
|
||||
14. New in PHP X.Y:
|
||||
8. Changes in SAPI support
|
||||
9. Changes in INI directives
|
||||
10. Syntax additions
|
||||
11. Windows support
|
||||
12. New in PHP 5.3:
|
||||
a. New libraries
|
||||
b. New extensions
|
||||
c. New stream wrappers
|
||||
@@ -29,409 +27,642 @@ UPGRADE NOTES - PHP X.Y
|
||||
g. New classes
|
||||
h. New methods
|
||||
i. New class constants
|
||||
j. New hash algorithms
|
||||
|
||||
========================================
|
||||
1. Changes made to default configuration
|
||||
========================================
|
||||
|
||||
- The default_charset setting now defaults to UTF-8.
|
||||
It was ISO-88590-1 before, so if you were relying
|
||||
on the default, you will need to add:
|
||||
|
||||
default_charset = iso-8859-1
|
||||
|
||||
to your php.ini to preserve pre-PHPX.Y behavior.
|
||||
|
||||
- We now check at compile time if /dev/urandom or /dev/arandom
|
||||
are present to provide non-blocking entropy to session id
|
||||
generation. If either is present, session.entropy_file
|
||||
now defaults to that file and session.entropy_length defaults
|
||||
to 32. If you do not want extra entropy for your session ids
|
||||
for some reason, add:
|
||||
|
||||
session.entropy_file=
|
||||
session.entropy_length=0
|
||||
|
||||
to your php.ini to preserve pre-PHPX.Y behavior.
|
||||
|
||||
- Deprecated ini directives will now throw an E_CORE_WARNING's
|
||||
instead of the previous E_WARNING's.
|
||||
|
||||
The following directives are marked as deprecated:
|
||||
- magic_quotes_gpc
|
||||
- magic_quotes_runtime
|
||||
- magic_quotes_sybase
|
||||
|
||||
- The following directives, which indicates a removed feature
|
||||
in PHP will now throw an E_CORE_ERROR upon startup like the
|
||||
deprecation warnings.
|
||||
|
||||
The following directives are no longer available:
|
||||
- allow_call_time_pass_reference
|
||||
- define_syslog_variables
|
||||
- highlight.bg
|
||||
- register_globals
|
||||
- register_long_arrays
|
||||
- safe_mode
|
||||
- safe_mode_gid
|
||||
- safe_mode_include_dir
|
||||
- safe_mode_exec_dir
|
||||
- safe_mode_allowed_env_vars
|
||||
- safe_mode_protected_env_vars
|
||||
- zend.ze1_compatibility_mode
|
||||
|
||||
=============================
|
||||
2. Reserved words and classes
|
||||
1. Reserved words and classes
|
||||
=============================
|
||||
|
||||
-
|
||||
- **namespace** and **goto** are now reserved keywords.
|
||||
|
||||
=============================
|
||||
3. Changes made to engine behaviour
|
||||
=============================
|
||||
|
||||
- Turning null, false or empty string into an object by adding a property
|
||||
will now emit a warning instead of an E_STRICT error.
|
||||
|
||||
$test = null;
|
||||
$test->baz = 1;
|
||||
|
||||
To create a generic object you can use StdClass:
|
||||
$test = new StdClass;
|
||||
$text->baz = 1;
|
||||
- **Closure** is now a reserved class. (Used by lambda and closure.)
|
||||
|
||||
=====================================
|
||||
4. Changes made to existing functions
|
||||
2. Changes made to existing functions
|
||||
=====================================
|
||||
|
||||
- array_combine now returns array() instead of FALSE when two empty arrays are
|
||||
provided as parameters.
|
||||
- Added an extra parameter to dns_get_record(), which allows requesting DNS
|
||||
records by numeric type and makes the result include only the raw data of
|
||||
the response.
|
||||
- call_user_func_array no longer allows call-time pass by reference.
|
||||
- htmlentities/htmlspecialchars are stricter in the code units they accept for
|
||||
the asian encodings. For Big5-HKSCS, the octets 0x80 and 0xFF are rejected.
|
||||
For GB2312/EUC-CN, the octets 0x8E, 0x8F, 0xA0 and 0xFF are rejected. For
|
||||
SJIS, the octets 0x80, 0xA0, 0xFD, 0xFE and 0xFF are rejected, except maybe
|
||||
after a valid starting byte. For EUC-JP, the octets 0xA0 and 0xFF are
|
||||
rejected.
|
||||
- htmlentities now emits an E_STRICT warning when used with asian characters,
|
||||
as in that case htmlentities has (and already had before this version) the
|
||||
same functionality as htmlspecialchars.
|
||||
- htmlentities no longer numerically encodes high characters for single-byte
|
||||
encodings (except when there's actually a corresponding named entity). This
|
||||
behavior was not documented and was inconsistent with that for "UTF-8".
|
||||
- html_entity_decode/htmlspecialchars_decode behave more consistently, now
|
||||
decoding entities in malformed strings such as "&&" or "&#&".
|
||||
- htmlentities/htmlspecialchars/html_entity_decode/htmlspecialchars_decode:
|
||||
Added the flags ENT_HTML401, ENT_XML1, ENT_XHTML, and ENT_HTML5. The
|
||||
behavior of these functions including, but not limited to, the characters
|
||||
that are encoded and the entities that are decoded depend on the document
|
||||
type that is specified by those flags.
|
||||
- htmlentities/htmlspecialchars with !$double_encode do more strict checks on
|
||||
the validity of the entities. Numerical entities are checked for a valid
|
||||
range (0 to 0x10FFFF); if the flag ENT_DISALLOWED is given, the validity of
|
||||
such numerical entity in the target document type is also checked. Named
|
||||
entities are checked for necessary existence in the target document type
|
||||
instead of only checking whether they were constituted by alphanumeric
|
||||
characters.
|
||||
- The flag ENT_DISALLOWED was added. In addition to the behavior described in
|
||||
the item before, it also makes htmlentities/htmlspecialchars substitute
|
||||
characters that appear literally in the argument string and which are not
|
||||
allowed in the target document type with U+FFFD (UTF-8) or �.
|
||||
- The flag ENT_SUBSTITUTE was added. This flag makes invalid multibyte
|
||||
sequences be replaced by U+FFFD (UTF-8) or &#FFFD; by htmlspecialchars and
|
||||
htmlentities. It is an alternative to the default behavior, which just
|
||||
returns an empty string and to ENT_IGNORE, which is a security risk. The
|
||||
behavior follows the recommendations of Unicode Technical Report #36.
|
||||
- htmlspecialchars_decode/html_entity_decode now decode ' if the document
|
||||
type is ENT_XML1, ENT_XHTML, or ENT_HTML5.
|
||||
- Charset detection with $charset == '' no longer turns to mbstring's
|
||||
internal encoding defined through mb_internal_encoding(). Only the encoding
|
||||
defined through the ini setting mbstring.internal_encoding is considered.
|
||||
- number_format() no longer truncates multibyte decimal points and thousand
|
||||
separators to the first byte.
|
||||
- The third parameter ($matches) to preg_match_all() is now optional. If
|
||||
omitted, the function will simply return the number of times the pattern was
|
||||
matched in the subject and will have no other side effects.
|
||||
- The second argument of scandir() now accepts SCANDIR_SORT_NONE (2) as a
|
||||
possible value. This value results in scandir() performing no sorting: on
|
||||
local filesystems, this allows files to be returned in native filesystem
|
||||
order.
|
||||
- stream_select() now preserves the keys of the passed array, be they numeric or
|
||||
strings. This breaks code that iterated the resulting stream array using a
|
||||
numeric index, but makes easier to identify which of the passed streams are
|
||||
present in the result.
|
||||
- stream_set_write_buffer() no longer disables the read buffer of a plain
|
||||
stream when 0 is given as the second argument.
|
||||
- stream_set_write_buffer() no longer changes the chunk size in socket streams.
|
||||
- fclose() closes streams with resource refcount > 1; it doesn't merely
|
||||
decrement the resource refcount.
|
||||
- socket_set_options() and socket_get_options() now support multicast options.
|
||||
- The HTTP stream wrapper now considers all status codes from 200 to 399 to be
|
||||
successful.
|
||||
|
||||
- The array functions natsort(), natcasesort(), usort(), uasort(), uksort(),
|
||||
array_flip(), and array_unique() no longer accept objects passed as arguments.
|
||||
If you need to use them to access an object's properties, you must cast the
|
||||
object to an array first.
|
||||
|
||||
- var_dump() output now includes private object members.
|
||||
|
||||
- session_start() now returns FALSE when the session startup fails.
|
||||
|
||||
- property_exists() now checks the existence of a property independent of
|
||||
accessibility (like method_exists()).
|
||||
|
||||
- The $initial parameter for array_reduce can now be of any type.
|
||||
|
||||
- clearstatcache() no longer clears the realpath cache by default.
|
||||
|
||||
- realpath() is no longer system-dependent and works identically on all
|
||||
platforms.
|
||||
|
||||
- call_user_func() now propagates $this even if the callee is the parent class.
|
||||
|
||||
- The filesystem functions opendir(), scandir(), and dir() now use the default
|
||||
context if no context argument is passed.
|
||||
|
||||
- The behaviour of functions with by-reference parameters called by value has
|
||||
changed. Where previously the function would accept the by-value argument, a
|
||||
warning is now emitted and all by-ref parameters are set to NULL.
|
||||
|
||||
- There is now native support for the following math functions: asinh(),
|
||||
acosh(), atanh(), log1p(), and expm1().
|
||||
|
||||
- In the GD extension, there is now pixelation support available through
|
||||
the imagefilter() function.
|
||||
|
||||
- crypt() now has Blowfish and extended DES support, and crypt() features are
|
||||
now 100% portable. PHP has its own internal crypt implementation which drops
|
||||
into place when system support for crypt or crypt_r() is not found.
|
||||
|
||||
- get_cfg_var() is now able to return "array" INI options.
|
||||
|
||||
- Stream wrappers can now be used by the include_path INI directive.
|
||||
|
||||
- These functions now take new parameters:
|
||||
clearstatcache(): $clear_realpath_cache and $filename.
|
||||
copy(): $context
|
||||
fgetcsv(): $escape
|
||||
ini_get_all(): $details
|
||||
json_encode(): $options
|
||||
json_decode(): $depth
|
||||
nl2br(): $is_xhtml
|
||||
parse_ini_file(): $scanner_mode
|
||||
round(): $mode
|
||||
stream_context_create(): $params
|
||||
strstr(), stristr(): $before_needle
|
||||
sybase_connect(): $new
|
||||
|
||||
- And new mode option for fopen: 'n' (O_NONBLOCK)
|
||||
|
||||
- The new mysqlnd library necessitates using MySQL's newer 41-byte password
|
||||
format. Continued use of the old 16 byte passwords will cause mysql_connect()
|
||||
and other related functions to produce the following error message:
|
||||
"mysqlnd cannot connect to MySQL 4.1+ using old authentication"
|
||||
|
||||
- The dl() function is now disabled by default, and only available under the
|
||||
cli, cgi, and embed SAPIs.
|
||||
|
||||
- mail() now supports the logging of sent mail.
|
||||
|
||||
- stream_select(), stream_set_blocking(), stream_set_timeout(), and
|
||||
stream_set_write_buffer() now work with user-space stream wrappers.
|
||||
|
||||
- getopt() accepts "long options" now on all platforms.
|
||||
Optional values and using = as a separator for short options are now
|
||||
supported.
|
||||
|
||||
|
||||
===================================
|
||||
5. Changes made to existing methods
|
||||
3. Changes made to existing methods
|
||||
===================================
|
||||
|
||||
-
|
||||
- The magic methods __get(), __set(), __isset(), __unset(), and __call() should
|
||||
always be public and can no longer be static. Method signatures are enforced.
|
||||
|
||||
- The __call() magic method is now invoked on access to private and protected
|
||||
methods.
|
||||
|
||||
- The __toString() magic method can no longer accept arguments.
|
||||
|
||||
- There is a new magic method, __callStatic().
|
||||
|
||||
- Internal count() vs. count_elements() handler resolution rules have changed.
|
||||
(This could potentially break custom PHP extensions.)
|
||||
|
||||
- The trailing / has been removed from SplFileInfo and other related directory
|
||||
classes.
|
||||
|
||||
- SplFileInfo::getpathinfo() now returns information about the path name.
|
||||
|
||||
- There are new parameters in:
|
||||
Exception::__construct(): $previous
|
||||
|
||||
===================================
|
||||
6. Changes made to existing classes
|
||||
4. Changes made to existing classes
|
||||
===================================
|
||||
|
||||
- Classes that implement stream wrappers can define a method called
|
||||
stream_truncate that will respond to truncation, e.g. through ftruncate.
|
||||
Strictly speaking, this is an addition to the user-space stream wrapper
|
||||
template, not a change to an actual class.
|
||||
- Constructors of userspace subclasses of the following SPL classes are now
|
||||
required to call the parent constructor and not clear any exceptions they
|
||||
throw (replacing the thrown exception by another one is permitted):
|
||||
SplFileInfo, DirectoryIterator, FilesystemIterator, GlobIterator,
|
||||
SplFileObject, SplTempFileObject, RecursiveDirectoryIterator,
|
||||
IteratorIterator, FilterIterator, RecursiveFilterIterator, ParentIterator,
|
||||
LimitIterator, CachingIterator, RecursiveCachingIterator, NoRewindIterator,
|
||||
AppendIterator, InfiniteIterator, RegexIterator, RecursiveRegexIterator, and
|
||||
RecursiveTreeIterator.
|
||||
It is no longer possible to defer the parent constructor call until after the
|
||||
object is constructed.
|
||||
|
||||
- SplObjectStorage now has ArrayAccess support. It is also now possible to
|
||||
store associative information with objects in SplObjectStorage.
|
||||
|
||||
=============
|
||||
7. Deprecated
|
||||
5. Deprecated
|
||||
=============
|
||||
|
||||
==========
|
||||
8. Removed
|
||||
==========
|
||||
- define_syslog_variables() is deprecated.
|
||||
|
||||
a. removed features
|
||||
- set_socket_blocking() is deprecated.
|
||||
|
||||
- register_globals
|
||||
- register_long_arrays
|
||||
- Safe mode
|
||||
- Session extension bug compatibility mode
|
||||
- y2k_compliance mode
|
||||
- call_user_method() and call_user_method_array() are now deprecated. Use
|
||||
call_user_func() and call_user_func_array() instead.
|
||||
|
||||
b. removed ini directives
|
||||
- dl() is deprecated.
|
||||
|
||||
- define_syslog_variables
|
||||
- register_globals
|
||||
- register_long_arrays
|
||||
- safe_mode
|
||||
- safe_mode_gid
|
||||
- safe_mode_include_dir
|
||||
- safe_mode_exec_dir
|
||||
- safe_mode_allowed_env_vars
|
||||
- safe_mode_protected_env_vars
|
||||
- session.bug_compat42
|
||||
- session.bug_compat_warn
|
||||
- y2k_compliance
|
||||
- The set_magic_quotes_runtime() function is now deprecated.
|
||||
|
||||
c. removed functions
|
||||
- mysql_listtables(), mysql_dropdb(), mysql_createdb(), mysql_list_tables(),
|
||||
mysql_drop_db(), and mysql_create_db() are now deprecated.
|
||||
|
||||
- define_syslog_variables()
|
||||
- import_request_variables()
|
||||
- session_is_registered()
|
||||
- session_register()
|
||||
- session_unregister()
|
||||
- mysqli_bind_param() (alias of mysqli_stmt_bind_param())
|
||||
- mysqli_bind_result() (alias of mysqli_stmt_bind_result())
|
||||
- mysqli_client_encoding() (alias of mysqli_character_set_name())
|
||||
- mysqli_fetch() (alias of mysqli_stmt_fetch())
|
||||
- mysqli_param_count() (alias of mysqli_stmt_param_count())
|
||||
- mysqli_get_metadata() (alias of mysqli_stmt_result_metadata())
|
||||
- mysqli_send_long_data() (alias of mysqli_stmt_send_long_data())
|
||||
- mysqli::client_encoding() (alias of mysqli::character_set_name)
|
||||
- mysqli_stmt::stmt() (never worked/always throws, undocumented)
|
||||
- All ereg functions are now deprecated and emit E_DEPRECATED errors:
|
||||
sql_regcase(), spliti(), split(), ereg_replace(), eregi(),
|
||||
ereg_replace(), and ereg().
|
||||
Use the PCRE family of functions (preg_*()) instead.
|
||||
|
||||
d. removed syntax
|
||||
- mcrypt_generic_end() is deprecated.
|
||||
|
||||
- break $var;
|
||||
- continue $var;
|
||||
- mysql_db_query() is deprecated.
|
||||
|
||||
=============
|
||||
9. Extensions
|
||||
=============
|
||||
- mysql_escape_string() is deprecated.
|
||||
|
||||
- session_register(), session_unregister(), and session_is_registered() are now
|
||||
deprecated. Use the $_SESSION superglobal array instead.
|
||||
|
||||
- Comments starting with '#' are now deprecated in .INI files.
|
||||
|
||||
- The following INI directives will now emit an E_DEPRECATED warning
|
||||
upon startup if they are activated:
|
||||
|
||||
- define_syslog_variables
|
||||
- register_globals
|
||||
- register_long_arrays
|
||||
- safe_mode
|
||||
- magic_quotes_gpc
|
||||
- magic_quotes_runtime
|
||||
- magic_quotes_sybase
|
||||
|
||||
- The is_dst parameter to mktime() is deprecated.
|
||||
|
||||
- Assigning the return value of "new" by reference is deprecated
|
||||
|
||||
- Call-time pass-by-reference has been deprecated
|
||||
|
||||
- Usage of {} to access string offsets is deprecated
|
||||
|
||||
- Passing locale category name as string to setlocale() is deprecated.
|
||||
|
||||
===============
|
||||
6. Undeprecated
|
||||
===============
|
||||
|
||||
- By popular request, is_a() is no longer deprecated.
|
||||
|
||||
==============
|
||||
7. Extensions:
|
||||
==============
|
||||
|
||||
a. moved out to PECL and actively maintained there
|
||||
|
||||
-
|
||||
- fdf
|
||||
- ming
|
||||
- ncurses
|
||||
|
||||
b. no longer maintained
|
||||
|
||||
- ext/sqlite
|
||||
- dbase
|
||||
- fbsql
|
||||
- msql
|
||||
- sybase (use sybase_ct, which is still in PHP core)
|
||||
- mhash (hash has full BC layer)
|
||||
- mime_magic (use fileinfo, has full BC layer)
|
||||
|
||||
c. with changed behaviour
|
||||
|
||||
- The session extension now can hook into the file upload feature
|
||||
in order to provide upload progress information through session
|
||||
variables.
|
||||
- SNMP extension
|
||||
- Functions in SNMP extension now returns FALSE on every error
|
||||
condition including SNMP-related (no such instance, end of MIB,
|
||||
etc). Thus, in patricular, breaks previous behaviour of get/walk
|
||||
functions returning an empty string on SNMP-related errors.
|
||||
- Multi OID get/getnext/set queries are now supported.
|
||||
- New constants added for use in snmp_set_oid_output_format()
|
||||
function.
|
||||
- Added feature-rich OO API (SNMP class)
|
||||
- Dropped UCD-SNMP compatibility code. Consider upgrading to
|
||||
net-snmp v5.3+. Net-SNMP v5.4+ is required for Windows version.
|
||||
|
||||
- dns: dns_check_record() will now return an extra "entries" index,
|
||||
containing the TXT elements.
|
||||
|
||||
- datetime: date/time functions will no longer use the TZ environment
|
||||
variable to guess which timezone should be used.
|
||||
|
||||
- cURL now supports SSH
|
||||
|
||||
- hash: The SHA-224 and salsa hash algorithms are now supported.
|
||||
|
||||
- mbstring: Now supports CP850 encoding.
|
||||
|
||||
- oci8: Database Resident Connection Pooling (DRCP) and Fast Application
|
||||
Notification (FAN) are now supported.
|
||||
|
||||
Oracle External Authentication is now supported (except on Windows).
|
||||
|
||||
The oci8 function oci_bind_by_name() now supports SQLT_AFC (aka the
|
||||
CHAR datatype).
|
||||
|
||||
Calling oci_close() on a persistent connection, or when the variable
|
||||
that references a persistent connection goes out of scope, will now
|
||||
trigger a roll back of an uncommitted transaction. To avoid unexpected
|
||||
behavior explicitly issue a commit or roll back as needed. The old
|
||||
behavior can be enabled with the INI directive
|
||||
oci8.old_oci_close_semantics.
|
||||
|
||||
- openssl: OpenSSL digest and cipher functions are now supported.
|
||||
It is also now possible to access the internal values of DSA, RSA and
|
||||
DH keys.
|
||||
|
||||
- session: Sessions will no longer store session-files in "/tmp" when
|
||||
open_basedir restrictions apply, unless "/tmp" is explicitly added to
|
||||
the list of allowed paths.
|
||||
|
||||
- SOAP: Now supports sending user-supplied HTTP headers.
|
||||
|
||||
- MySQLi: Now supports persistent connections by prepending the hostname
|
||||
with "p:".
|
||||
|
||||
d. no longer possible to disable
|
||||
|
||||
-
|
||||
- PCRE
|
||||
- Reflection
|
||||
- SPL
|
||||
|
||||
==========================
|
||||
10. Changes in SAPI support
|
||||
8. Changes in SAPI support
|
||||
==========================
|
||||
|
||||
- The REQUEST_TIME value inside server now returns a floating point number
|
||||
indicating the time with microsecond precision. All SAPIs providing this
|
||||
value should be returning float and not time_t.
|
||||
- A new "litespeed" SAPI is now available.
|
||||
|
||||
=============================
|
||||
11. Changes in INI directives
|
||||
=============================
|
||||
- FastCGI is now always enabled and can not be disabled. See sapi/cgi/CHANGES
|
||||
for more details.
|
||||
|
||||
- A new CGI SAPI option, -T, can be used to measure execution time of a script
|
||||
repeated several times.
|
||||
|
||||
- CGI/FastCGI now has support for .htaccess style user-defined php.ini files.
|
||||
See the new user_ini.filename and user_ini.cache_ttl INI directives.
|
||||
|
||||
============================
|
||||
9. Changes in INI directives
|
||||
============================
|
||||
|
||||
- zend_extension_debug and zend_extension_ts have been removed. Always use the
|
||||
zend_extension directive to load Zend Extensions.
|
||||
|
||||
- zend.ze1_compatibility_mode has been removed. If this INI directive is set to
|
||||
on, then an E_ERROR is emitted at startup.
|
||||
|
||||
- There is now support for special sections: [PATH=/opt/httpd/www.example.com/]
|
||||
and [HOST=www.example.com]. Directives set in these sections cannot be
|
||||
overridden by user-defined INI files or at runtime.
|
||||
|
||||
- Added mbstring.http_output_conv_mimetype. This directive specifies the
|
||||
regex pattern of content types for which mb_output_handler() is activated.
|
||||
|
||||
- It is now possible to use the full path to load modules using the "extension"
|
||||
directive.
|
||||
|
||||
- "INI variables" can now be used almost anywhere in a php.ini file.
|
||||
|
||||
- It is now possible to use alphanumeric or variable indices in INI option
|
||||
arrays.
|
||||
|
||||
- open_basedir is now PHP_INI_ALL
|
||||
|
||||
- Runtime tightening of open_basedir restrictions is now possible.
|
||||
|
||||
- The default value of session.use_only_cookies has changed to "1".
|
||||
|
||||
- The default value of oci8.default_prefetch has been changed from 10 to 100.
|
||||
|
||||
- A new directive, request_order, controls the behavior of $_REQUEST
|
||||
independently of variables_order.
|
||||
|
||||
- New INI directives:
|
||||
- mail.add_x_header
|
||||
- user_ini.filename
|
||||
- user_ini.cache_ttl
|
||||
- exit_on_timeout
|
||||
- mysqli.allow_persistent
|
||||
- mysqli.default_host
|
||||
- mysqli.default_socket
|
||||
- mysqli.allow_local_infile
|
||||
- mysqli.cache_size
|
||||
- oci8.connection_class
|
||||
- oci8.events
|
||||
- pdo_mysql.default_socket
|
||||
- pdo_mysql.cache_size
|
||||
- sqlite3.extension_dir
|
||||
- mysql.default_socket
|
||||
- mysql.allow_local_infile
|
||||
- mysql.cache_size
|
||||
- mysqlnd.collect_statistics
|
||||
- mysqlnd.collect_memory_statistics
|
||||
- mysqlnd.net_cmd_buffer_size
|
||||
- mysqlnd.net_read_buffer_size
|
||||
- mysqlnd.log_mask
|
||||
|
||||
- Added session.upload_progress.enabled, session.upload_progress.cleanup,
|
||||
session.upload_progress.prefix, session.upload_progress.name,
|
||||
session.upload_progress.freq, session.upload_progress.min_freq.
|
||||
- Added zend.multibyte directive as a replacement of PHP compile time
|
||||
configuration option --enable-zend-multibyte. Now ZE always contains code for
|
||||
multibyte support, but may enable or disable it by zend.multibyte. It doesn't
|
||||
make a lot of sense to enable this option without ext/mbstring, because the
|
||||
most functionality is implemented by mbstrings callbacks.
|
||||
- Added enable_post_data_reading, which is enable by default. When it's
|
||||
disabled, the POST data is not read (and processed); the behavior is similar
|
||||
to that of other request methods with body, like PUT. This allows reading the
|
||||
raw POST data in multipart requests and read/process the POST data in a
|
||||
stream fashion (through php://input), without having it copied in memory two/
|
||||
three times.
|
||||
|
||||
====================
|
||||
12. Syntax additions
|
||||
10. Syntax additions
|
||||
====================
|
||||
|
||||
- Array dereferencing.
|
||||
e.g.
|
||||
foo()[0]
|
||||
$foo->bar()[0]
|
||||
- NOWDOC: Similar to HEREDOC, but with single quotes:
|
||||
|
||||
<<<'LABEL' ...
|
||||
|
||||
Static HEREDOCs can be used to initialize static variables and class members
|
||||
or constants:
|
||||
|
||||
static $foo = <<<LABEL
|
||||
No variables here...
|
||||
LABEL;
|
||||
|
||||
- HEREDOC now supports wrapping the identifier with double-quotes, to complement
|
||||
the NOWDOC syntax:
|
||||
|
||||
<<<"LABEL" ...
|
||||
|
||||
- The ?: operator has been introduced:
|
||||
|
||||
var_dump(0 ?: 'Hello!');
|
||||
|
||||
- Namespaces were added:
|
||||
|
||||
namespace my\name;
|
||||
$obj = new \my\name\MyClass;
|
||||
|
||||
- Dynamic access to static methods is now possible:
|
||||
|
||||
$foo::myFunc();
|
||||
|
||||
- Exceptions can now be nested:
|
||||
|
||||
class MyCustomException extends Exception {}
|
||||
try {
|
||||
throw new MyCustomException("Something happend", 112);
|
||||
} catch(Exception $e) {
|
||||
throw new InvalidArgumentException("You are doing it wrong!", 911, $e);
|
||||
}
|
||||
|
||||
- Exceptions can now be handled in destructors.
|
||||
|
||||
- A garbage collector has been added and is enabled by default.
|
||||
|
||||
===================
|
||||
13. Windows support
|
||||
11. Windows support
|
||||
===================
|
||||
|
||||
- is_link now works properly for symbolic links on Windows Vista
|
||||
or later. Earlier systems do not support symbolic links.
|
||||
- The minimum Windows version is now Windows 2000. (Windows 98, ME and NT4 are
|
||||
no longer supported).
|
||||
|
||||
- PHP Windows binaries target i586 or later. i386 and i486 are not supported.
|
||||
|
||||
- Support for the IIS SAPI has been dropped. Use the FastCGI SAPI instead
|
||||
(available for IIS5 and later)). FastCGI is the recommended way to use PHP
|
||||
with IIS (see http://php.iis.net/).
|
||||
|
||||
- A new build is available based on the latest Visual C++ Compiler (VC9).
|
||||
Its use is recommended with FastCGI or CLI. Apache's Windows binaries are not
|
||||
compatible with VC9; however, you can use Apache Lounge's build
|
||||
(http://apachelounge.com).
|
||||
|
||||
- The x64 binaries are for experimental usage only. They are not meant to be
|
||||
used in production.
|
||||
|
||||
- A new site is available to download Windows releases as well as Windows-only
|
||||
releases: http://windows.php.net. Windows-specific releases will be made to
|
||||
fix security issues in the bundled libraries (libpng, openssl, etc.). Please
|
||||
note that this site does not replace the main PHP site as a source of PHP
|
||||
news, resources, or documentation.
|
||||
|
||||
- Windows support has been added for the following functions: getopt(),
|
||||
imagecolorclosesthwb(), mcrypt_create_iv(), inet_ntop(), inet_pton(),
|
||||
getmxrr(), checkdnsrr(), dns_get_record(), linkinfo(), readlink(),
|
||||
symlink(), link(), fnmatch(), stream_socket_pair(), time_nanosleep(),
|
||||
time_sleep_until(), and socket_create_pair().
|
||||
|
||||
- Crypt supports now all available algorithms on Windows (blowfish included).
|
||||
|
||||
- Improved portability of stat(), touch(), filemtime(), filesize() and related
|
||||
functions (100% portable for the available data).
|
||||
|
||||
- It is now possible to create hard links on Windows using the link() function,
|
||||
and symbolic links using the symlink() function. Hard links are available
|
||||
as of Windows 2000 and symbolic links as of Windows Vista.
|
||||
|
||||
- The PDO_OCI php_pdo_oci8.dll library (for use with Oracle version 8 client
|
||||
libraries) is no longer being built. Instead, use php_pdo_oci.dll (note no
|
||||
'8') with Oracle 10 or 11 client libraries. Connection to other database
|
||||
versions is still supported.
|
||||
|
||||
- For the OCI8 extension, a new library php_oci8_11g.dll is available in
|
||||
addition to php_oci8.dll. Only one can be enabled at any time. Use
|
||||
php_oci8.dll with Oracle 10.2 client libraries. Use php_oci8_11g.dll with
|
||||
Oracle 11 client libraries. Connection to other database versions is still
|
||||
supported.
|
||||
|
||||
- Firebird and SNMP support are no longer available on Windows. Firebird support
|
||||
may be reintroduced in the future.
|
||||
|
||||
===================
|
||||
14. New in PHP X.Y:
|
||||
12. New in PHP 5.3:
|
||||
===================
|
||||
|
||||
a. New libraries
|
||||
|
||||
-
|
||||
- mysqlnd is a new core library shipped with PHP. It is a PHP-specific
|
||||
replacement for libmysql and is recommended for all installations for
|
||||
increased performance.
|
||||
|
||||
b. New extensions
|
||||
|
||||
-
|
||||
- enchant
|
||||
- fileinfo (replaces mime_magic)
|
||||
- intl
|
||||
- Phar
|
||||
- SQLite3
|
||||
|
||||
c. New stream wrappers
|
||||
|
||||
-
|
||||
- glob:// stream wrapper
|
||||
- phar:// stream wrapper for accessing phar archives
|
||||
|
||||
d. New stream filters
|
||||
|
||||
-
|
||||
- "dechunk" (HTTP/1.1 chunked transfer encoding)
|
||||
- The bz2.decompress filter now supports concatenation
|
||||
|
||||
e. New functions
|
||||
|
||||
- Core:
|
||||
- get_declared_traits()
|
||||
- http_response_code()
|
||||
- trait_exists()
|
||||
- stream_set_chunk_size()
|
||||
- socket_import_stream()
|
||||
- Core: gc_collect_cycles()
|
||||
gc_enabled()
|
||||
gc_enable()
|
||||
gc_disable()
|
||||
class_alias()
|
||||
get_called_class()
|
||||
forward_static_call()
|
||||
forward_static_call_array()
|
||||
str_getcsv()
|
||||
quoted_printable_encode()
|
||||
lcfirst()
|
||||
- Array: array_replace()
|
||||
array_replace_recursive()
|
||||
- Date: date_add()
|
||||
date_sub()
|
||||
date_diff()
|
||||
date_parse_from_format()
|
||||
date_create_from_format()
|
||||
date_get_last_errors()
|
||||
timezone_version_get()
|
||||
- INI: parse_ini_string()
|
||||
- GMP: gmp_testbit()
|
||||
- Hash: hash_copy()
|
||||
- IMAP: imap_gc()
|
||||
imap_utf8_to_mutf7()
|
||||
imap_mutf7_to_utf8()
|
||||
- JSON: json_last_error()
|
||||
- libxml: libxml_disable_entity_loader
|
||||
- MySQLi: mysqli_fetch_all()
|
||||
mysqli_get_connection_stats()
|
||||
mysqli_poll()
|
||||
mysqli_reap_async_query()
|
||||
- Network: gethostname()
|
||||
header_remove()
|
||||
- OpenSSL: openssl_random_pseudo_bytes()
|
||||
- PCNTL: pcntl_signal_dispatch()
|
||||
pcntl_sigprocmask()
|
||||
pcntl_sigwaitinfo()
|
||||
pcntl_sigtimedwait()
|
||||
- PCRE: preg_filter()
|
||||
- SHM: msg_queue_exists()
|
||||
shm_has_var()
|
||||
- Streams: stream_supports_lock()
|
||||
stream_context_set_default()
|
||||
stream_context_get_params()
|
||||
- Userspace stream wrappers:
|
||||
stream_cast()
|
||||
stream_set_options()
|
||||
|
||||
f. New global constants
|
||||
|
||||
- JSON_PRETTY_PRINT
|
||||
- JSON_UNESCAPED_SLASHES
|
||||
- ENT_SUBSTITUTE
|
||||
- ENT_ALLOWED
|
||||
- ENT_HTML401
|
||||
- ENT_XML1
|
||||
- ENT_XHTML
|
||||
- ENT_HTML5
|
||||
- SCANDIR_SORT_ASCENDING
|
||||
- SCANDIR_SORT_DESCENDING
|
||||
- SCANDIR_SORT_NONE
|
||||
- MCAST_JOIN_GROUP
|
||||
- MCAST_LEAVE_GROUP
|
||||
- MCAST_BLOCK_SOURCE
|
||||
- MCAST_UNBLOCK_SOURCE
|
||||
- MCAST_JOIN_SOURCE_GROUP
|
||||
- MCAST_LEAVE_SOURCE_GROUP
|
||||
- IP_MULTICAST_IF
|
||||
- IP_MULTICAST_TTL
|
||||
- IP_MULTICAST_LOOP
|
||||
- IPV6_MULTICAST_IF
|
||||
- IPV6_MULTICAST_HOPS
|
||||
- IPV6_MULTICAST_LOOP
|
||||
- IPPROTO_IP
|
||||
- IPPROTO_IPV6
|
||||
- Core: E_DEPRECATED
|
||||
E_USER_DEPRECATED
|
||||
__DIR__
|
||||
__NAMESPACE__
|
||||
PHP_MAXPATHLEN
|
||||
PHP_WINDOWS_VERSION_MAJOR
|
||||
PHP_WINDOWS_VERSION_MINOR
|
||||
PHP_WINDOWS_VERSION_BUILD
|
||||
PHP_WINDOWS_VERSION_PLATFORM
|
||||
PHP_WINDOWS_VERSION_SP_MAJOR
|
||||
PHP_WINDOWS_VERSION_SP_MINOR
|
||||
PHP_WINDOWS_VERSION_SUITEMASK
|
||||
PHP_WINDOWS_VERSION_PRODUCTTYPE
|
||||
PHP_WINDOWS_NT_DOMAIN_CONTROLLER
|
||||
PHP_WINDOWS_NT_SERVER
|
||||
PHP_WINDOWS_NT_WORKSTATION
|
||||
- INI: INI_SCANNER_NORMAL
|
||||
INI_SCANNER_RAW
|
||||
- cURL CURLOPT_PROGRESSFUNCTION
|
||||
- GD: IMG_FILTER_PIXELATE
|
||||
- JSON: JSON_ERROR_NONE
|
||||
JSON_ERROR_DEPTH
|
||||
JSON_ERROR_STATE_MISMATCH
|
||||
JSON_ERROR_CTRL_CHAR
|
||||
JSON_ERROR_SYNTAX
|
||||
JSON_FORCE_OBJECT
|
||||
JSON_HEX_TAG
|
||||
JSON_HEX_AMP
|
||||
JSON_HEX_APOS
|
||||
JSON_HEX_QUOT
|
||||
- LDAP: LDAP_OPT_NETWORK_TIMEOUT
|
||||
- libxml: LIBXML_LOADED_VERSION
|
||||
- PCRE: PREG_BAD_UTF8_OFFSET_ERROR
|
||||
- PCNTL: SIG_BLOCK
|
||||
SIG_UNBLOCK
|
||||
SIG_SETMASK
|
||||
SI_USER
|
||||
SI_NOINFO
|
||||
SI_KERNEL
|
||||
SI_QUEUE
|
||||
SI_TIMER
|
||||
SI_MESGQ
|
||||
SI_ASYNCIO
|
||||
SI_SIGIO
|
||||
SI_TKILL
|
||||
CLD_EXITED
|
||||
CLD_KILLED
|
||||
CLD_DUMPED
|
||||
CLD_TRAPPED
|
||||
CLD_STOPPED
|
||||
CLD_CONTINUED
|
||||
TRAP_BRKPT
|
||||
TRAP_TRACE
|
||||
POLL_IN
|
||||
POLL_OUT
|
||||
POLL_MSG
|
||||
POLL_ERR
|
||||
POLL_PRI
|
||||
POLL_HUP
|
||||
ILL_ILLOPC
|
||||
ILL_ILLOPN
|
||||
ILL_ILLADR
|
||||
ILL_ILLTRP
|
||||
ILL_PRVOPC
|
||||
ILL_PRVREG
|
||||
ILL_COPROC
|
||||
ILL_BADSTK
|
||||
FPE_INTDIV
|
||||
FPE_INTOVF
|
||||
FPE_FLTDIV
|
||||
FPE_FLTOVF
|
||||
FPE_FLTUND
|
||||
FPE_FLTRES
|
||||
FPE_FLTINV
|
||||
FPE_FLTSUB
|
||||
SEGV_MAPERR
|
||||
SEGV_ACCERR
|
||||
BUS_ADRALN
|
||||
BUS_ADRERR
|
||||
BUS_OBJERR
|
||||
|
||||
g. New classes
|
||||
|
||||
- Reflection:
|
||||
- ReflectionZendExtension
|
||||
|
||||
- Intl:
|
||||
- Transliterator
|
||||
|
||||
- SNMP:
|
||||
- SNMP
|
||||
|
||||
- SPL:
|
||||
- CallbackFilterIterator
|
||||
- RecursiveCallbackFilterIterator
|
||||
- Date: DateInterval
|
||||
DatePeriod
|
||||
- Phar: Phar
|
||||
PharData
|
||||
PharFileInfo
|
||||
PharException
|
||||
- SPL SplDoublyLinkedList
|
||||
SplStack
|
||||
SplQueue
|
||||
SplHeap
|
||||
SplMinHeap
|
||||
SplMaxHeap
|
||||
SplPriorityQueue
|
||||
SplFixedArray
|
||||
FilesystemIterator
|
||||
GlobIterator
|
||||
RecursiveTreeIterator
|
||||
MultipleIterator
|
||||
|
||||
h. New methods
|
||||
|
||||
- DirectoryIterator
|
||||
- DirectoryIterator::getExtension()
|
||||
|
||||
- Reflection:
|
||||
- ReflectionClass::isCloneable()
|
||||
- ReflectionClass::getTraits()
|
||||
- ReflectionClass::getTraitNames()
|
||||
- ReflectionClass::getTraitAliases()
|
||||
- ReflectionParameter::canBePassedByValue()
|
||||
|
||||
- RegexIterator
|
||||
- RegexIterator::getRegex()
|
||||
|
||||
- PDO_dblib
|
||||
- PDO::newRowset()
|
||||
|
||||
- SplFileInfo
|
||||
- SplFileInfo::getExtension()
|
||||
|
||||
- SplFileObject
|
||||
- SplFileObject::fputcsv()
|
||||
- Date: DateTime::diff()
|
||||
DateTime::add()
|
||||
DateTime::sub()
|
||||
DateTime::createFromFormat()
|
||||
DateTime::getLastErrors()
|
||||
- DOM: DOMNode::getLineNo()
|
||||
- Exception: Exception::getPrevious()
|
||||
- PDO_Firebird: PDO::setAttribute()
|
||||
- Reflection: ReflectionProperty::setAccessible()
|
||||
ReflectionFunction::inNamespace()
|
||||
ReflectionFunction::getNamespaceName()
|
||||
ReflectionFunction::getShortName()
|
||||
ReflectionClass::inNamespace()
|
||||
ReflectionClass::getNamespaceName()
|
||||
ReflectionClass::getShortName()
|
||||
- SPL SplObjectStorage::addAll()
|
||||
SplObjectStorage::removeAll()
|
||||
- XSL: XSLTProcessor::setProfiling()
|
||||
|
||||
i. New class constants
|
||||
|
||||
-
|
||||
|
||||
j. New Hash algorithms
|
||||
|
||||
- fnv132
|
||||
- fnv164
|
||||
- joaat
|
||||
|
||||
|
||||
- PDO_Firebird: PDO::FB_ATTR_DATE_FORMAT
|
||||
PDO::FB_ATTR_TIME_FORMAT
|
||||
PDO::FB_ATTR_TIMESTAMP_FORMAT
|
||||
@@ -1,203 +0,0 @@
|
||||
$Id$
|
||||
|
||||
UPGRADE NOTES - PHP X.Y
|
||||
|
||||
1. Internal API changes
|
||||
a. virtual_file_ex
|
||||
b. stat/lstat support
|
||||
c. readlink support
|
||||
d. layout of some core ZE structures (zend_op_array, zend_class_entry, ...)
|
||||
e. Zend\zend_fast_cache.h has been removed
|
||||
f. streams that enclose private streams
|
||||
g. leak_variable
|
||||
h. API Signature changes
|
||||
|
||||
2. Build system changes
|
||||
a. Unix build system changes
|
||||
b. Windows build system changes
|
||||
|
||||
|
||||
========================
|
||||
1. Internal API changes
|
||||
========================
|
||||
|
||||
a. virtual_file_ex
|
||||
|
||||
virtual_file_ex takes now a TSRM context as last parameter:
|
||||
CWD_API int virtual_file_ex(cwd_state *state, const char *path,
|
||||
verify_path_func verify_path, int use_realpath TSRLS_DC);
|
||||
|
||||
|
||||
b. stat/lstat support
|
||||
|
||||
lstat is now available on all platforms. On unix-like platform
|
||||
php_sys_lstat is an alias to lstat (when avaible). On Windows it is now
|
||||
available using php_sys_lstat. php_sys_stat and php_sys_lstat usage is recommended
|
||||
instead of calling lstat directly, to ensure portability.
|
||||
|
||||
|
||||
c. readlink support
|
||||
|
||||
readlink is now available on all platforms. On unix-like platform
|
||||
php_sys_readlink is an alias to readlink (when avaible). On Windows it is now
|
||||
available using php_sys_readlink. php_sys_readlink usage is recommended
|
||||
instead of calling readlink directly, to ensure portability.
|
||||
|
||||
|
||||
d. layout of some core ZE structures (zend_op_array, zend_class_entry, ...)
|
||||
|
||||
. zend_function.pass_rest_by_reference is replaced by
|
||||
ZEND_ACC_PASS_REST_BY_REFERENCE in zend_function.fn_flags
|
||||
. zend_function.return_reference is replaced by ZEND_ACC_RETURN_REFERENCE
|
||||
in zend_function.fn_flags
|
||||
. zend_arg_info.required_num_args removed. it was needed only for internal
|
||||
functions. Now the first arg_info for internal function (which has special
|
||||
meaning) is represented by zend_internal_function_info structure.
|
||||
. zend_op_array.size, size_var, size_literal, current_brk_cont,
|
||||
backpatch_count moved into CG(context), because they are used only during
|
||||
compilation.
|
||||
. zend_op_array.start_op is moved into EG(start_op), because it's used
|
||||
only for 'interactive' execution of single top-level op-array.
|
||||
. zend_op_array.done_pass_two is replaced by ZEND_ACC_DONE_PASS_TWO in
|
||||
zend_op_array.fn_flags.
|
||||
. op_array.vars array is trimmed (reallocated) during pass_two.
|
||||
. zend_class_entry.constants_updated is replaced by
|
||||
ZEND_ACC_CONSTANTS_UPDATED in zend_class_entry.ce_flags
|
||||
. the size of zend_class_entry is reduced by sharing the same memory space
|
||||
by different information for internal and user classes.
|
||||
See zend_class_inttry.info union.
|
||||
|
||||
|
||||
e. Zend\zend_fast_cache.h
|
||||
|
||||
It should not have been used anymore since php5, but now this header has
|
||||
been removed. The following macros are not available anymore:
|
||||
|
||||
ZEND_FAST_ALLOC(p, type, fc_type)
|
||||
ZEND_FAST_FREE(p, fc_type)
|
||||
ZEND_FAST_ALLOC_REL(p, type, fc_type)
|
||||
ZEND_FAST_FREE_REL(p, fc_type)
|
||||
|
||||
Use emalloc, emalloc_rel, efree or efree_rel instead.
|
||||
|
||||
|
||||
f. Streams that enclose private streams
|
||||
|
||||
Some streams, like the temp:// stream, may enclose private streams. If the
|
||||
outer stream leaks due to a programming error or is not exposed through a
|
||||
zval (and therefore is not deleted when all the zvals are gone), it will
|
||||
be destroyed on shutdown.
|
||||
The problem is that the outer usually wants itself to close the inner stream,
|
||||
so that it may do any other shutdown action that requires the inner stream to
|
||||
be live (e.g. commit data to it). If the outer stream is exposed through a
|
||||
zval and the inner one isn't, this is not a problem because the outer stream
|
||||
will be freed when the zval is destroyed, which happens before the resources
|
||||
are destroyed on shutdown.
|
||||
On resource list shutdown, the cleanup happens in reverse order of resource
|
||||
creation, so if the inner stream was created in the opener of the outer stream,
|
||||
it will be destroyed first.
|
||||
The following functions were added to the streams API to force a predictable
|
||||
destruction order:
|
||||
|
||||
PHPAPI php_stream *php_stream_encloses(php_stream *enclosing, php_stream *enclosed);
|
||||
#define php_stream_free_enclosed(stream_enclosed, close_options)
|
||||
PHPAPI int _php_stream_free_enclosed(php_stream *stream_enclosed, int close_options TSRMLS_DC);
|
||||
|
||||
Additionally, the following member was added to php_stream:
|
||||
|
||||
struct _php_stream *enclosing_stream;
|
||||
|
||||
and the following macro was added:
|
||||
|
||||
#define PHP_STREAM_FREE_IGNORE_ENCLOSING 32
|
||||
|
||||
The function php_stream_encloses declares the first stream encloses the second.
|
||||
This has the effect that, when the inner stream is closed from a resource
|
||||
destructor it will abort and try to free its enclosing stream instead.
|
||||
To prevent this from happening when the inner stream is freed from the outer
|
||||
stream, the macro php_stream_free_enclosed should be used instead of
|
||||
php_stream_free/php_stream_close/php_stream_pclose, or the flag
|
||||
PHP_STREAM_FREE_IGNORE_ENCLOSING should be directly passed to php_stream_free.
|
||||
The outer stream cannot abstain, in its close callback, from closing the inner
|
||||
stream or clear the enclosing_stream pointer in its enclosed stream by calling
|
||||
php_stream_encloses with the 2nd argument NULL. If this is not done, there will
|
||||
be problems, so observe this requirement when using php_stream_encloses.
|
||||
|
||||
|
||||
g. leak_variable
|
||||
|
||||
The function leak_variable(variable [, leak_data]) was added. It is only
|
||||
available on debug builds. It increments the refcount of a zval or, if the
|
||||
second argument is true and the variable is either an object or a resource
|
||||
it increments the refcounts of those objects instead.
|
||||
|
||||
|
||||
h. API Signature changes
|
||||
|
||||
. zend_list_insert
|
||||
ZEND_API int zend_list_insert(void *ptr, int type TSRMLS_DC);
|
||||
call: zend_list_insert(a, SOMETYPE TSRMLS_CC);
|
||||
NB: If zend_list_insert is used to register a resource,
|
||||
ZEND_REGISTER_RESOURCE could be used instead.
|
||||
|
||||
. php_le_stream_context(TSRMLS_C)
|
||||
PHPAPI php_stream_context *php_stream_context_alloc(TSRMLS_D)
|
||||
call: context = php_stream_context_alloc(TSRMLS_C);
|
||||
|
||||
. php_stream_context_alloc
|
||||
PHPAPI php_stream_context *php_stream_context_alloc(TSRMLS_D);
|
||||
call: context = php_stream_context_alloc(TSRMLS_C);
|
||||
|
||||
. sapi_get_request_time(TSRMLS_D);
|
||||
SAPI_API double sapi_get_request_time(TSRMLS_D);
|
||||
|
||||
. sapi_register_default_post_reader
|
||||
SAPI_API int sapi_register_default_post_reader(void (*default_post_reader)(TSRMLS_D) TSRMLS_DC);
|
||||
|
||||
. sapi_register_treat_data
|
||||
SAPI_API int sapi_register_treat_data(void (*treat_data)(int arg, char *str, zval *destArray TSRMLS_DC) TSRMLS_DC);
|
||||
|
||||
. sapi_register_input_filter
|
||||
SAPI_API int sapi_register_input_filter(unsigned int (*input_filter)(int arg, char *var, char **val, unsigned int val_len, unsigned int *new_val_len TSRMLS_DC), unsigned int (*input_filter_init)(TSRMLS_D) TSRMLS_DC);
|
||||
|
||||
. tsrm_win32_access
|
||||
TSRM_API int tsrm_win32_access(const char *pathname, int mode TSRMLS_DC);
|
||||
|
||||
. popen_ex (win32)
|
||||
TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd, char *env TSRMLS_DC);
|
||||
|
||||
. php_get_current_user
|
||||
PHPAPI php_get_current_user(TSRMLS_D)
|
||||
Call: char *user = php_get_current_user(TSRMLS_C);
|
||||
|
||||
. php_idate
|
||||
PHPAPI php_idate(char format, time_t ts, int localtime TSRMLS_DC)
|
||||
Call: int ret = php_idate(format, ts, localtime TSRMLS_CC)
|
||||
|
||||
. php_escape_html_entities
|
||||
(size_t parameters were ints, previous "quote_style" (now flags) has expanded meaning)
|
||||
PHPAPI char *php_escape_html_entities(unsigned char *old, size_t oldlen, size_t *newlen, int all, int flags, char *hint_charset TSRMLS_DC);
|
||||
|
||||
. php_escape_html_entities_ex
|
||||
PHPAPI char *php_escape_html_entities_ex(unsigned char *old, size_t oldlen, size_t *newlen, int all, int flags, char *hint_charset, zend_bool double_encode TSRMLS_DC);
|
||||
|
||||
. php_unescape_html_entities
|
||||
PHPAPI char *php_unescape_html_entities(unsigned char *old, size_t oldlen, size_t *newlen, int all, int flags, char *hint_charset TSRMLS_DC);
|
||||
|
||||
|
||||
========================
|
||||
2. Build system changes
|
||||
========================
|
||||
|
||||
a. Unix build system changes
|
||||
|
||||
- Changes in SAPI module build:
|
||||
. When adding new binary SAPI (executable, like CLI/CGI/FPM) use CLI config.m4 and Makefile.frag files as templates and replace CLI/cli with your SAPI name.
|
||||
|
||||
- New macros:
|
||||
. PHP_INIT_DTRACE(providerdesc, header-file, sources [, module])
|
||||
|
||||
|
||||
b. Windows build system changes
|
||||
-
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ libZend_la_SOURCES=\
|
||||
zend_objects_API.c zend_ts_hash.c zend_stream.c \
|
||||
zend_default_classes.c \
|
||||
zend_iterators.c zend_interfaces.c zend_exceptions.c \
|
||||
zend_strtod.c zend_closures.c zend_float.c zend_string.c
|
||||
zend_strtod.c zend_closures.c zend_float.c
|
||||
|
||||
libZend_la_LDFLAGS =
|
||||
libZend_la_LIBADD = @ZEND_EXTRA_LIBS@
|
||||
|
||||
+4
-8
@@ -243,10 +243,6 @@ SOURCE=.\zend_stream.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_string.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_strtod.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -319,6 +315,10 @@ SOURCE=.\zend_extensions.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_fast_cache.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_globals.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -411,10 +411,6 @@ SOURCE=.\zend_stream.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_string.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_strtod.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
+14
-7
@@ -176,6 +176,13 @@ AC_ARG_ENABLE(inline-optimization,
|
||||
ZEND_INLINE_OPTIMIZATION=yes
|
||||
])
|
||||
|
||||
AC_ARG_ENABLE(zend-multibyte,
|
||||
[ --enable-zend-multibyte Compile with zend multibyte support], [
|
||||
ZEND_MULTIBYTE=$enableval
|
||||
],[
|
||||
ZEND_MULTIBYTE=no
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING([virtual machine dispatch method])
|
||||
AC_MSG_RESULT($PHP_ZEND_VM)
|
||||
|
||||
@@ -188,6 +195,9 @@ AC_MSG_RESULT($ZEND_INLINE_OPTIMIZATION)
|
||||
AC_MSG_CHECKING(whether to enable Zend debugging)
|
||||
AC_MSG_RESULT($ZEND_DEBUG)
|
||||
|
||||
AC_MSG_CHECKING(whether to enable Zend multibyte)
|
||||
AC_MSG_RESULT($ZEND_MULTIBYTE)
|
||||
|
||||
case $PHP_ZEND_VM in
|
||||
SWITCH)
|
||||
AC_DEFINE(ZEND_VM_KIND,ZEND_VM_KIND_SWITCH,[virtual machine dispatch method])
|
||||
@@ -222,6 +232,10 @@ if test "$ZEND_MAINTAINER_ZTS" = "yes"; then
|
||||
LIBZEND_CPLUSPLUS_CHECKS
|
||||
fi
|
||||
|
||||
if test "$ZEND_MULTIBYTE" = "yes"; then
|
||||
AC_DEFINE(ZEND_MULTIBYTE, 1, [ ])
|
||||
fi
|
||||
|
||||
changequote({,})
|
||||
if test -n "$GCC" && test "$ZEND_INLINE_OPTIMIZATION" != "yes"; then
|
||||
INLINE_CFLAGS=`echo $ac_n "$CFLAGS $ac_c" | sed s/-O[0-9s]*//`
|
||||
@@ -405,11 +419,4 @@ if test -r "/dev/urandom" && test -c "/dev/urandom"; then
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_CHECKING(whether /dev/arandom exists)
|
||||
if test -r "/dev/arandom" && test -c "/dev/arandom"; then
|
||||
AC_DEFINE([HAVE_DEV_ARANDOM], 1, [Define if the target system has /dev/arandom device])
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
fi
|
||||
+4
-8
@@ -273,10 +273,6 @@ SOURCE=.\zend_stream.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_string.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_strtod.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -349,6 +345,10 @@ SOURCE=.\zend_extensions.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_fast_cache.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_globals.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -445,10 +445,6 @@ SOURCE=.\zend_stream.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_string.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\zend_strtod.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Zend Engine |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1998-2011 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
| Copyright (c) 1998-2010 Zend Technologies Ltd. (http://www.zend.com) |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.00 of the Zend license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ dnl This file contains local autoconf functions.
|
||||
|
||||
AC_DEFUN([LIBZEND_BISON_CHECK],[
|
||||
# we only support certain bison versions
|
||||
bison_version_list="1.28 1.35 1.75 1.875 2.0 2.1 2.2 2.3 2.4 2.4.1 2.4.2 2.4.3"
|
||||
bison_version_list="1.28 1.35 1.75 1.875 2.0 2.1 2.2 2.3 2.4 2.4.1 2.4.2"
|
||||
|
||||
# for standalone build of Zend Engine
|
||||
test -z "$SED" && SED=sed
|
||||
|
||||
@@ -3,6 +3,7 @@ if (function_exists("date_default_timezone_set")) {
|
||||
date_default_timezone_set("UTC");
|
||||
}
|
||||
|
||||
date_default_timezone_set('UTC');
|
||||
function simple() {
|
||||
$a = 0;
|
||||
for ($i = 0; $i < 1000000; $i++)
|
||||
|
||||
@@ -1,321 +0,0 @@
|
||||
<?php
|
||||
|
||||
function hallo() {
|
||||
}
|
||||
|
||||
function simpleucall($n) {
|
||||
for ($i = 0; $i < $n; $i++)
|
||||
hallo();
|
||||
}
|
||||
|
||||
function simpleudcall($n) {
|
||||
for ($i = 0; $i < $n; $i++)
|
||||
hallo2();
|
||||
}
|
||||
|
||||
function hallo2() {
|
||||
}
|
||||
|
||||
function simpleicall($n) {
|
||||
for ($i = 0; $i < $n; $i++)
|
||||
func_num_args();
|
||||
}
|
||||
|
||||
class Foo {
|
||||
static $a = 0;
|
||||
public $b = 0;
|
||||
const TEST = 0;
|
||||
|
||||
static function read_static($n) {
|
||||
for ($i = 0; $i < $n; ++$i) {
|
||||
$x = self::$a;
|
||||
}
|
||||
}
|
||||
|
||||
static function write_static($n) {
|
||||
for ($i = 0; $i < $n; ++$i) {
|
||||
self::$a = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static function isset_static($n) {
|
||||
for ($i = 0; $i < $n; ++$i) {
|
||||
$x = isset(self::$a);
|
||||
}
|
||||
}
|
||||
|
||||
static function empty_static($n) {
|
||||
for ($i = 0; $i < $n; ++$i) {
|
||||
$x = empty(self::$a);
|
||||
}
|
||||
}
|
||||
|
||||
static function f() {
|
||||
}
|
||||
|
||||
static function call_static($n) {
|
||||
for ($i = 0; $i < $n; ++$i) {
|
||||
self::f();
|
||||
}
|
||||
}
|
||||
|
||||
function read_prop($n) {
|
||||
for ($i = 0; $i < $n; ++$i) {
|
||||
$x = $this->b;
|
||||
}
|
||||
}
|
||||
|
||||
function write_prop($n) {
|
||||
for ($i = 0; $i < $n; ++$i) {
|
||||
$this->b = 0;
|
||||
}
|
||||
}
|
||||
|
||||
function assign_add_prop($n) {
|
||||
for ($i = 0; $i < $n; ++$i) {
|
||||
$this->b += 2;
|
||||
}
|
||||
}
|
||||
|
||||
function pre_inc_prop($n) {
|
||||
for ($i = 0; $i < $n; ++$i) {
|
||||
++$this->b;
|
||||
}
|
||||
}
|
||||
|
||||
function pre_dec_prop($n) {
|
||||
for ($i = 0; $i < $n; ++$i) {
|
||||
--$this->b;
|
||||
}
|
||||
}
|
||||
|
||||
function post_inc_prop($n) {
|
||||
for ($i = 0; $i < $n; ++$i) {
|
||||
$this->b++;
|
||||
}
|
||||
}
|
||||
|
||||
function post_dec_prop($n) {
|
||||
for ($i = 0; $i < $n; ++$i) {
|
||||
$this->b--;
|
||||
}
|
||||
}
|
||||
|
||||
function isset_prop($n) {
|
||||
for ($i = 0; $i < $n; ++$i) {
|
||||
$x = isset($this->b);
|
||||
}
|
||||
}
|
||||
|
||||
function empty_prop($n) {
|
||||
for ($i = 0; $i < $n; ++$i) {
|
||||
$x = empty($this->b);
|
||||
}
|
||||
}
|
||||
|
||||
function g() {
|
||||
}
|
||||
|
||||
function call($n) {
|
||||
for ($i = 0; $i < $n; ++$i) {
|
||||
$this->g();
|
||||
}
|
||||
}
|
||||
|
||||
function read_const($n) {
|
||||
for ($i = 0; $i < $n; ++$i) {
|
||||
$x = $this::TEST;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function read_static($n) {
|
||||
for ($i = 0; $i < $n; ++$i) {
|
||||
$x = Foo::$a;
|
||||
}
|
||||
}
|
||||
|
||||
function write_static($n) {
|
||||
for ($i = 0; $i < $n; ++$i) {
|
||||
Foo::$a = 0;
|
||||
}
|
||||
}
|
||||
|
||||
function isset_static($n) {
|
||||
for ($i = 0; $i < $n; ++$i) {
|
||||
$x = isset(Foo::$a);
|
||||
}
|
||||
}
|
||||
|
||||
function empty_static($n) {
|
||||
for ($i = 0; $i < $n; ++$i) {
|
||||
$x = empty(Foo::$a);
|
||||
}
|
||||
}
|
||||
|
||||
function call_static($n) {
|
||||
for ($i = 0; $i < $n; ++$i) {
|
||||
Foo::f();
|
||||
}
|
||||
}
|
||||
|
||||
function create_object($n) {
|
||||
for ($i = 0; $i < $n; ++$i) {
|
||||
$x = new Foo();
|
||||
}
|
||||
}
|
||||
|
||||
define('TEST', null);
|
||||
|
||||
function read_const($n) {
|
||||
for ($i = 0; $i < $n; ++$i) {
|
||||
$x = TEST;
|
||||
}
|
||||
}
|
||||
|
||||
function read_auto_global($n) {
|
||||
for ($i = 0; $i < $n; ++$i) {
|
||||
$x = $_GET;
|
||||
}
|
||||
}
|
||||
|
||||
$g_var = 0;
|
||||
|
||||
function read_global_var($n) {
|
||||
for ($i = 0; $i < $n; ++$i) {
|
||||
$x = $GLOBALS['g_var'];
|
||||
}
|
||||
}
|
||||
|
||||
function read_hash($n) {
|
||||
$hash = array('test' => 0);
|
||||
for ($i = 0; $i < $n; ++$i) {
|
||||
$x = $hash['test'];
|
||||
}
|
||||
}
|
||||
|
||||
function read_str_offset($n) {
|
||||
$str = "test";
|
||||
for ($i = 0; $i < $n; ++$i) {
|
||||
$x = $str[1];
|
||||
}
|
||||
}
|
||||
|
||||
/*****/
|
||||
|
||||
function empty_loop($n) {
|
||||
for ($i = 0; $i < $n; ++$i) {
|
||||
}
|
||||
}
|
||||
|
||||
function getmicrotime()
|
||||
{
|
||||
$t = gettimeofday();
|
||||
return ($t['sec'] + $t['usec'] / 1000000);
|
||||
}
|
||||
|
||||
function start_test()
|
||||
{
|
||||
ob_start();
|
||||
return getmicrotime();
|
||||
}
|
||||
|
||||
function end_test($start, $name, $overhead = null)
|
||||
{
|
||||
global $total;
|
||||
global $last_time;
|
||||
$end = getmicrotime();
|
||||
ob_end_clean();
|
||||
$last_time = $end-$start;
|
||||
$total += $last_time;
|
||||
$num = number_format($last_time,3);
|
||||
$pad = str_repeat(" ", 24-strlen($name)-strlen($num));
|
||||
if (is_null($overhead)) {
|
||||
echo $name.$pad.$num."\n";
|
||||
} else {
|
||||
$num2 = number_format($last_time - $overhead,3);
|
||||
echo $name.$pad.$num." ".$num2."\n";
|
||||
}
|
||||
ob_start();
|
||||
return getmicrotime();
|
||||
}
|
||||
|
||||
function total()
|
||||
{
|
||||
global $total;
|
||||
$pad = str_repeat("-", 24);
|
||||
echo $pad."\n";
|
||||
$num = number_format($total,3);
|
||||
$pad = str_repeat(" ", 24-strlen("Total")-strlen($num));
|
||||
echo "Total".$pad.$num."\n";
|
||||
}
|
||||
|
||||
const N = 5000000;
|
||||
|
||||
$t0 = $t = start_test();
|
||||
empty_loop(N);
|
||||
$t = end_test($t, 'empty_loop');
|
||||
$overhead = $last_time;
|
||||
simpleucall(N);
|
||||
$t = end_test($t, 'func()', $overhead);
|
||||
simpleudcall(N);
|
||||
$t = end_test($t, 'undef_func()', $overhead);
|
||||
simpleicall(N);
|
||||
$t = end_test($t, 'int_func()', $overhead);
|
||||
Foo::read_static(N);
|
||||
$t = end_test($t, '$x = self::$x', $overhead);
|
||||
Foo::write_static(N);
|
||||
$t = end_test($t, 'self::$x = 0', $overhead);
|
||||
Foo::isset_static(N);
|
||||
$t = end_test($t, 'isset(self::$x)', $overhead);
|
||||
Foo::empty_static(N);
|
||||
$t = end_test($t, 'empty(self::$x)', $overhead);
|
||||
read_static(N);
|
||||
$t = end_test($t, '$x = Foo::$x', $overhead);
|
||||
write_static(N);
|
||||
$t = end_test($t, 'Foo::$x = 0', $overhead);
|
||||
isset_static(N);
|
||||
$t = end_test($t, 'isset(Foo::$x)', $overhead);
|
||||
empty_static(N);
|
||||
$t = end_test($t, 'empty(Foo::$x)', $overhead);
|
||||
Foo::call_static(N);
|
||||
$t = end_test($t, 'self::f()', $overhead);
|
||||
call_static(N);
|
||||
$t = end_test($t, 'Foo::f()', $overhead);
|
||||
$x = new Foo();
|
||||
$x->read_prop(N);
|
||||
$t = end_test($t, '$x = $this->x', $overhead);
|
||||
$x->write_prop(N);
|
||||
$t = end_test($t, '$this->x = 0', $overhead);
|
||||
$x->assign_add_prop(N);
|
||||
$t = end_test($t, '$this->x += 2', $overhead);
|
||||
$x->pre_inc_prop(N);
|
||||
$t = end_test($t, '++$this->x', $overhead);
|
||||
$x->pre_dec_prop(N);
|
||||
$t = end_test($t, '--$this->x', $overhead);
|
||||
$x->post_inc_prop(N);
|
||||
$t = end_test($t, '$this->x++', $overhead);
|
||||
$x->post_dec_prop(N);
|
||||
$t = end_test($t, '$this->x--', $overhead);
|
||||
$x->isset_prop(N);
|
||||
$t = end_test($t, 'isset($this->x)', $overhead);
|
||||
$x->empty_prop(N);
|
||||
$t = end_test($t, 'empty($this->x)', $overhead);
|
||||
$x->call(N);
|
||||
$t = end_test($t, '$this->f()', $overhead);
|
||||
$x->read_const(N);
|
||||
$t = end_test($t, '$x = Foo::TEST', $overhead);
|
||||
create_object(N);
|
||||
$t = end_test($t, 'new Foo()', $overhead);
|
||||
read_const(N);
|
||||
$t = end_test($t, '$x = TEST', $overhead);
|
||||
read_auto_global(N);
|
||||
$t = end_test($t, '$x = $_GET', $overhead);
|
||||
read_global_var(N);
|
||||
$t = end_test($t, '$x = $GLOBALS[\'v\']', $overhead);
|
||||
read_hash(N);
|
||||
$t = end_test($t, '$x = $hash[\'v\']', $overhead);
|
||||
read_str_offset(N);
|
||||
$t = end_test($t, '$x = $str[0]', $overhead);
|
||||
total($t0, "Total");
|
||||
+1
-1
@@ -21,5 +21,5 @@ print "ok\n";
|
||||
Notice: Trying to get property of non-object in %s on line %d
|
||||
ok
|
||||
|
||||
Warning: Creating default object from empty value in %s on line %d
|
||||
Strict Standards: Creating default object from empty value in %s on line %d
|
||||
ok
|
||||
+2
-2
@@ -26,6 +26,6 @@ Notice: Undefined variable: arr in %s on line %d
|
||||
|
||||
Notice: Trying to get property of non-object in %s on line %d
|
||||
|
||||
Warning: Creating default object from empty value in %s on line %d
|
||||
Strict Standards: Creating default object from empty value in %s on line %d
|
||||
|
||||
Warning: Creating default object from empty value in %s on line %d
|
||||
Strict Standards: Creating default object from empty value in %s on line %d
|
||||
@@ -12,4 +12,4 @@ foo(123);
|
||||
--EXPECTF--
|
||||
3
|
||||
|
||||
Catchable fatal error: Argument 1 passed to foo() must be of the type array, integer given, called in %sarray_type_hint_001.php on line 7 and defined in %sarray_type_hint_001.php on line 2
|
||||
Catchable fatal error: Argument 1 passed to foo() must be an array, integer given, called in %sarray_type_hint_001.php on line 7 and defined in %sarray_type_hint_001.php on line 2
|
||||
@@ -23,6 +23,7 @@ echo isset($simpleString[0])?"ok\n":"bug\n";
|
||||
echo isset($simpleString["0"])?"ok\n":"bug\n";
|
||||
echo isset($simpleString["16"])?"ok\n":"bug\n";
|
||||
echo isset($simpleString["17"])?"bug\n":"ok\n";
|
||||
echo isset($simpleString["wrong"][0])?"bug\n":"ok\n";
|
||||
echo $simpleString->wrong === null?"ok\n":"bug\n";
|
||||
echo $simpleString["wrong"] === "B"?"ok\n":"bug\n";
|
||||
echo $simpleString["0"] === "B"?"ok\n":"bug\n";
|
||||
@@ -43,6 +44,7 @@ ok
|
||||
ok
|
||||
ok
|
||||
ok
|
||||
ok
|
||||
|
||||
Notice: Trying to get property of non-object in %sbug31098.php on line %d
|
||||
ok
|
||||
|
||||
@@ -4,6 +4,7 @@ Bug #35655 (whitespace following end of heredoc is lost)
|
||||
highlight.string = #DD0000
|
||||
highlight.comment = #FF8000
|
||||
highlight.keyword = #007700
|
||||
highlight.bg = #FFFFFF
|
||||
highlight.default = #0000BB
|
||||
highlight.html = #000000
|
||||
--FILE--
|
||||
|
||||
@@ -63,18 +63,10 @@ print "\nDone\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
|
||||
Notice: Uninitialized string offset: %i in %s on line 6
|
||||
|
||||
Notice: Uninitialized string offset: 0 in %s on line 10
|
||||
|
||||
Notice: Uninitialized string offset: 0 in %s on line 12
|
||||
|
||||
Notice: Uninitialized string offset: %i in %s on line 14
|
||||
|
||||
Notice: Uninitialized string offset: %i in %s on line 16
|
||||
|
||||
Notice: Uninitialized string offset: 0 in %s on line 18
|
||||
|
||||
Notice: Uninitialized string offset: 4 in %s on line 28
|
||||
|
||||
Notice: Uninitialized string offset: 4 in %s on line 34
|
||||
@@ -85,8 +77,6 @@ Notice: Uninitialized string offset: 4 in %s on line 42
|
||||
|
||||
Notice: Uninitialized string offset: 4 in %s on line 46
|
||||
|
||||
Notice: Uninitialized string offset: 12 in %s on line 50
|
||||
|
||||
Notice: Uninitialized string offset: 12 in %s on line 52
|
||||
b
|
||||
Done
|
||||
@@ -1,7 +1,5 @@
|
||||
--TEST--
|
||||
Bug #39304 (Segmentation fault with list unpacking of string offset)
|
||||
--SKIPIF--
|
||||
<?php if (version_compare(zend_version(), '2.4.0', '>=')) die('skip ZendEngine 2.4 needed'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$s = "";
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
--TEST--
|
||||
Bug #39304 (Segmentation fault with list unpacking of string offset)
|
||||
--SKIPIF--
|
||||
<?php if (version_compare(zend_version(), '2.4.0', '<')) die('skip ZendEngine 2.4 needed'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$s = "";
|
||||
list($a, $b) = $s[0];
|
||||
var_dump($a,$b);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Notice: Uninitialized string offset: 0 in %sbug39304_2_4.php on line 3
|
||||
|
||||
Notice: Uninitialized string offset: 1 in %sbug39304_2_4.php on line 3
|
||||
|
||||
Notice: Uninitialized string offset: 0 in %sbug39304_2_4.php on line 3
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
@@ -4,6 +4,7 @@ Bug #42767 (highlight_string() truncates trailing comments)
|
||||
highlight.string = #DD0000
|
||||
highlight.comment = #FF8000
|
||||
highlight.keyword = #007700
|
||||
highlight.bg = #FFFFFF
|
||||
highlight.default = #0000BB
|
||||
highlight.html = #000000
|
||||
--FILE--
|
||||
|
||||
@@ -43,11 +43,11 @@ __call:
|
||||
string(3) "ABC"
|
||||
__call:
|
||||
string(3) "ABC"
|
||||
__call:
|
||||
__callstatic:
|
||||
string(3) "XYZ"
|
||||
__call:
|
||||
__callstatic:
|
||||
string(3) "WWW"
|
||||
__call:
|
||||
__callstatic:
|
||||
string(3) "ABC"
|
||||
__callstatic:
|
||||
string(1) "A"
|
||||
@@ -58,4 +58,4 @@ string(1) "C"
|
||||
__callstatic:
|
||||
string(3) "FOO"
|
||||
__callstatic:
|
||||
string(3) "FOO"
|
||||
string(3) "FOO"
|
||||
@@ -35,17 +35,17 @@ call_user_func('self::y');
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
__call:
|
||||
__callstatic:
|
||||
string(3) "ABC"
|
||||
__call:
|
||||
__callstatic:
|
||||
string(3) "ABC"
|
||||
__call:
|
||||
string(3) "xyz"
|
||||
__call:
|
||||
__callstatic:
|
||||
string(3) "www"
|
||||
__call:
|
||||
string(1) "y"
|
||||
__call:
|
||||
__callstatic:
|
||||
string(1) "y"
|
||||
ok
|
||||
__callstatic:
|
||||
|
||||
@@ -27,6 +27,6 @@ $foo->start();
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
instance
|
||||
instance
|
||||
instance
|
||||
static
|
||||
static
|
||||
static
|
||||
@@ -1,18 +0,0 @@
|
||||
--TEST--
|
||||
Bug #51421 (Abstract __construct constructor argument list not enforced)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class ExampleClass {}
|
||||
|
||||
abstract class TestInterface {
|
||||
abstract public function __construct(ExampleClass $var);
|
||||
}
|
||||
|
||||
class Test extends TestInterface {
|
||||
public function __construct() {}
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Declaration of Test::__construct() must be compatible with that of TestInterface::__construct() in %s on line %d
|
||||
+12
-37
@@ -13,63 +13,38 @@ foo()->a->b++;
|
||||
foo()->a += 2;
|
||||
foo()->a->b += 2;
|
||||
|
||||
foo()[0] = 1;
|
||||
foo()[0][0] = 2;
|
||||
foo()[0]++;
|
||||
foo()[0][0]++;
|
||||
foo()[0] += 2;
|
||||
foo()[0][0] += 2;
|
||||
|
||||
//foo()[0] = 1;
|
||||
//foo()[0][0] = 2;
|
||||
//foo()[0]++;
|
||||
//foo()[0][0]++;
|
||||
//foo()[0] += 2;
|
||||
//foo()[0][0] += 2;
|
||||
var_dump(foo());
|
||||
?>
|
||||
--EXPECTF--
|
||||
Notice: Undefined variable: x in %sbug52041.php on line 3
|
||||
|
||||
Warning: Creating default object from empty value in %sbug52041.php on line 6
|
||||
Strict Standards: Creating default object from empty value in %sbug52041.php on line 6
|
||||
|
||||
Notice: Undefined variable: x in %sbug52041.php on line 3
|
||||
|
||||
Warning: Creating default object from empty value in %sbug52041.php on line 7
|
||||
Strict Standards: Creating default object from empty value in %sbug52041.php on line 7
|
||||
|
||||
Notice: Undefined variable: x in %sbug52041.php on line 3
|
||||
|
||||
Warning: Creating default object from empty value in %sbug52041.php on line 8
|
||||
Strict Standards: Creating default object from empty value in %sbug52041.php on line 8
|
||||
|
||||
Notice: Undefined variable: x in %sbug52041.php on line 3
|
||||
|
||||
Warning: Creating default object from empty value in %sbug52041.php on line 9
|
||||
Strict Standards: Creating default object from empty value in %sbug52041.php on line 9
|
||||
|
||||
Notice: Undefined variable: x in %sbug52041.php on line 3
|
||||
|
||||
Warning: Creating default object from empty value in %sbug52041.php on line 10
|
||||
Strict Standards: Creating default object from empty value in %sbug52041.php on line 10
|
||||
|
||||
Notice: Undefined variable: x in %sbug52041.php on line 3
|
||||
|
||||
Warning: Creating default object from empty value in %sbug52041.php on line 11
|
||||
|
||||
Notice: Undefined variable: x in %sbug52041.php on line 3
|
||||
|
||||
Notice: Undefined variable: x in %sbug52041.php on line 3
|
||||
|
||||
Notice: Undefined variable: x in %stests/bug52041.php on line 3
|
||||
|
||||
Notice: Undefined offset: 0 in %sbug52041.php on line 15
|
||||
|
||||
Notice: Undefined variable: x in %sbug52041.php on line 3
|
||||
|
||||
Notice: Undefined offset: 0 in %sbug52041.php on line 16
|
||||
|
||||
Notice: Undefined offset: 0 in %sbug52041.php on line 16
|
||||
|
||||
Notice: Undefined variable: x in %sbug52041.php on line 3
|
||||
|
||||
Notice: Undefined offset: 0 in %sbug52041.php on line 17
|
||||
|
||||
Notice: Undefined variable: x in %sbug52041.php on line 3
|
||||
|
||||
Notice: Undefined offset: 0 in %sbug52041.php on line 18
|
||||
|
||||
Notice: Undefined offset: 0 in %sbug52041.php on line 18
|
||||
Strict Standards: Creating default object from empty value in %sbug52041.php on line 11
|
||||
|
||||
Notice: Undefined variable: x in %sbug52041.php on line 3
|
||||
NULL
|
||||
@@ -7,6 +7,5 @@ preg_match('//', '', $data->info);
|
||||
var_dump($data);
|
||||
?>
|
||||
--EXPECTF--
|
||||
|
||||
Warning: Attempt to modify property of non-object in %sbug52237.php on line 3
|
||||
string(4) "test"
|
||||
@@ -1,35 +0,0 @@
|
||||
--TEST--
|
||||
Bug #52361 (Throwing an exception in a destructor causes invalid catching)
|
||||
--FILE--
|
||||
<?php
|
||||
class aaa {
|
||||
public function __destruct() {
|
||||
try {
|
||||
throw new Exception(__CLASS__);
|
||||
} catch(Exception $ex) {
|
||||
echo "1. $ex\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
function bbb() {
|
||||
$a = new aaa();
|
||||
throw new Exception(__FUNCTION__);
|
||||
}
|
||||
try {
|
||||
bbb();
|
||||
echo "must be skipped !!!";
|
||||
} catch(Exception $ex) {
|
||||
echo "2. $ex\n";
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
1. exception 'Exception' with message 'aaa' in %sbug52361.php:5
|
||||
Stack trace:
|
||||
#0 %sbug52361.php(16): aaa->__destruct()
|
||||
#1 %sbug52361.php(16): bbb()
|
||||
#2 {main}
|
||||
2. exception 'Exception' with message 'bbb' in %sbug52361.php:13
|
||||
Stack trace:
|
||||
#0 %sbug52361.php(16): bbb()
|
||||
#1 {main}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
--TEST--
|
||||
Bug #52484 (__set() ignores setting properties with empty names)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class A {
|
||||
function __unset($prop) {
|
||||
unset($this->$prop);
|
||||
}
|
||||
}
|
||||
|
||||
$a = new A();
|
||||
$prop = null;
|
||||
|
||||
unset($a->$prop);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Cannot access empty property in %s on line %d
|
||||
@@ -1,19 +0,0 @@
|
||||
--TEST--
|
||||
Bug #52484.2 (__set() ignores setting properties with empty names)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class A {
|
||||
function __set($prop, $val) {
|
||||
$this->$prop = $val;
|
||||
}
|
||||
}
|
||||
|
||||
$a = new A();
|
||||
$prop = null;
|
||||
|
||||
$a->$prop = 2;
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Cannot access empty property in %s on line %d
|
||||
@@ -1,19 +0,0 @@
|
||||
--TEST--
|
||||
Bug #52484.3 (__set() ignores setting properties with empty names)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class A {
|
||||
function __get($prop) {
|
||||
var_dump($this->$prop);
|
||||
}
|
||||
}
|
||||
|
||||
$a = new A();
|
||||
$prop = null;
|
||||
|
||||
var_dump($a->$prop);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Cannot access empty property in %s on line %d
|
||||
@@ -1,20 +0,0 @@
|
||||
--TEST--
|
||||
Bug #52508 (newline problem with parse_ini_file+INI_SCANNER_RAW)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$file = dirname(__FILE__) .'/bug52508.ini';
|
||||
|
||||
file_put_contents($file, "a = 1");
|
||||
|
||||
$ini_array = parse_ini_file($file, true, INI_SCANNER_RAW);
|
||||
var_dump($ini_array);
|
||||
|
||||
unlink($file);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
array(1) {
|
||||
["a"]=>
|
||||
string(1) "1"
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
--TEST--
|
||||
Bug #52614 (Memory leak when writing on uninitialized variable returned from method call)
|
||||
--FILE--
|
||||
<?php
|
||||
class foo {
|
||||
public $a1;
|
||||
public $a2 = array();
|
||||
public $a3;
|
||||
public $o1;
|
||||
public $o2;
|
||||
|
||||
public function f1() {
|
||||
return $this->a1;
|
||||
}
|
||||
|
||||
public function f2() {
|
||||
return $this->a2;
|
||||
}
|
||||
|
||||
public function f3() {
|
||||
$this->a3 = array();
|
||||
return $this->a3;
|
||||
}
|
||||
|
||||
public function f4() {
|
||||
return $this->o1;
|
||||
}
|
||||
|
||||
public function f5() {
|
||||
$this->o2 = new stdClass;
|
||||
return $this->o2;
|
||||
}
|
||||
|
||||
public function &f6() {
|
||||
return $this->a1;
|
||||
}
|
||||
|
||||
public function f7(&$x) {
|
||||
$x = 2;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$foo = new foo;
|
||||
|
||||
$foo->f1()[0] = 1;
|
||||
var_dump($foo->a1);
|
||||
|
||||
$foo->f2()[0] = 1;
|
||||
var_dump($foo->a2);
|
||||
|
||||
$foo->f3()[0] = 1;
|
||||
var_dump($foo->a3);
|
||||
|
||||
$foo->f4()->a = 1;
|
||||
var_dump($foo->o1);
|
||||
|
||||
$foo->f5()->a = 1;
|
||||
var_dump($foo->o2);
|
||||
|
||||
$foo->a1[0] = 1;
|
||||
$foo->f7($foo->f6()[0]);
|
||||
var_dump($foo->a1[0]);
|
||||
$foo->f1()[0]++;
|
||||
var_dump($foo->a1[0]);
|
||||
$foo->f6()[0]++;
|
||||
var_dump($foo->a1[0]);
|
||||
--EXPECTF--
|
||||
NULL
|
||||
array(0) {
|
||||
}
|
||||
array(0) {
|
||||
}
|
||||
|
||||
Warning: Creating default object from empty value in %sbug52614.php on line 52
|
||||
NULL
|
||||
object(stdClass)#%d (1) {
|
||||
["a"]=>
|
||||
int(1)
|
||||
}
|
||||
int(2)
|
||||
int(2)
|
||||
int(3)
|
||||
@@ -1,16 +0,0 @@
|
||||
--TEST--
|
||||
Bug #52879 (Objects unreferenced in __get, __set, __isset or __unset can be freed too early)
|
||||
--FILE--
|
||||
<?php
|
||||
class MyClass {
|
||||
public $myRef;
|
||||
public function __set($property,$value) {
|
||||
$this->myRef = $value;
|
||||
}
|
||||
}
|
||||
$myGlobal=new MyClass($myGlobal);
|
||||
$myGlobal->myRef=&$myGlobal;
|
||||
$myGlobal->myNonExistentProperty="ok\n";
|
||||
echo $myGlobal;
|
||||
--EXPECT--
|
||||
ok
|
||||
@@ -1,40 +0,0 @@
|
||||
--TEST--
|
||||
Bug #52939 (zend_call_function_array does not respect ZEND_SEND_PREFER_REF)
|
||||
--FILE--
|
||||
<?php
|
||||
$ar1 = array("row1" => 2, "row2" => 1);
|
||||
var_dump(array_multisort($ar1));
|
||||
var_dump($ar1);
|
||||
|
||||
$ar1 = array("row1" => 2, "row2" => 1);
|
||||
$args = array(&$ar1);
|
||||
var_dump(call_user_func_array("array_multisort", $args));
|
||||
var_dump($ar1);
|
||||
|
||||
$ar1 = array("row1" => 2, "row2" => 1);
|
||||
$args = array($ar1);
|
||||
var_dump(call_user_func_array("array_multisort", $args));
|
||||
var_dump($ar1);
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
array(2) {
|
||||
["row2"]=>
|
||||
int(1)
|
||||
["row1"]=>
|
||||
int(2)
|
||||
}
|
||||
bool(true)
|
||||
array(2) {
|
||||
["row2"]=>
|
||||
int(1)
|
||||
["row1"]=>
|
||||
int(2)
|
||||
}
|
||||
bool(true)
|
||||
array(2) {
|
||||
["row1"]=>
|
||||
int(2)
|
||||
["row2"]=>
|
||||
int(1)
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
--TEST--
|
||||
Bug #52940 (call_user_func_array still allows call-time pass-by-reference)
|
||||
--FILE--
|
||||
<?php
|
||||
function foo($a) {
|
||||
$a++;
|
||||
var_dump($a);
|
||||
}
|
||||
function bar(&$a) {
|
||||
$a++;
|
||||
var_dump($a);
|
||||
}
|
||||
$a = 1;
|
||||
call_user_func_array("foo", array(&$a));
|
||||
var_dump($a);
|
||||
call_user_func_array("bar", array(&$a));
|
||||
var_dump($a);
|
||||
?>
|
||||
--EXPECT--
|
||||
int(2)
|
||||
int(1)
|
||||
int(2)
|
||||
int(2)
|
||||
@@ -1,19 +0,0 @@
|
||||
--TEST--
|
||||
Bug #53305 (E_NOTICE when defining a constant starts with __COMPILER_HALT_OFFSET__)
|
||||
--FILE--
|
||||
<?php
|
||||
error_reporting(E_ALL);
|
||||
|
||||
define('__COMPILER_HALT_OFFSET__1', 1);
|
||||
define('__COMPILER_HALT_OFFSET__2', 2);
|
||||
define('__COMPILER_HALT_OFFSET__', 3);
|
||||
define('__COMPILER_HALT_OFFSET__1'.chr(0), 4);
|
||||
|
||||
var_dump(__COMPILER_HALT_OFFSET__1);
|
||||
var_dump(constant('__COMPILER_HALT_OFFSET__1'.chr(0)));
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Notice: Constant __COMPILER_HALT_OFFSET__ already defined in %s on line %d
|
||||
int(1)
|
||||
int(4)
|
||||
@@ -1,17 +0,0 @@
|
||||
--TEST--
|
||||
Bug #53347 Segfault accessing static method
|
||||
--FILE--
|
||||
<?php class ezcConsoleOutput
|
||||
{
|
||||
protected static $color = array( 'gray' => 30 );
|
||||
|
||||
public static function isValidFormatCode( $type, $key )
|
||||
{
|
||||
return isset( self::${$type}[$key] );
|
||||
}
|
||||
}
|
||||
|
||||
var_dump( ezcConsoleOutput::isValidFormatCode( 'color', 'gray' ) );
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
@@ -1,33 +0,0 @@
|
||||
--TEST--
|
||||
Bug #53511 (Exceptions are lost in case an exception is thrown in catch operator)
|
||||
--FILE--
|
||||
<?php
|
||||
class Foo {
|
||||
function __destruct() {
|
||||
throw new Exception("ops 1");
|
||||
}
|
||||
}
|
||||
|
||||
function test() {
|
||||
$e = new Foo();
|
||||
try {
|
||||
throw new Exception("ops 2");
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage()."\n";
|
||||
}
|
||||
}
|
||||
|
||||
test();
|
||||
echo "bug\n";
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught exception 'Exception' with message 'ops 2' in %sbug53511.php:11
|
||||
Stack trace:
|
||||
#0 %sbug53511.php(17): test()
|
||||
#1 {main}
|
||||
|
||||
Next exception 'Exception' with message 'ops 1' in %sbug53511.php:4
|
||||
Stack trace:
|
||||
#0 %sbug53511.php(12): Foo->__destruct()
|
||||
#1 %sbug53511.php(17): test()
|
||||
#2 {main}
|
||||
thrown in %sbug53511.php on line 4
|
||||
@@ -1,31 +0,0 @@
|
||||
--TEST--
|
||||
Bug #53629 (memory leak inside highlight_string())
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$str = '
|
||||
<?php
|
||||
class foo {
|
||||
public $bar = <<<EOT
|
||||
bar
|
||||
EOT;
|
||||
}
|
||||
?>
|
||||
';
|
||||
$str2 = '
|
||||
<?php
|
||||
var_dump(array(<<<EOD
|
||||
foobar!
|
||||
EOD
|
||||
));
|
||||
?>
|
||||
';
|
||||
|
||||
highlight_string($str, true);
|
||||
highlight_string($str2, true);
|
||||
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
Done
|
||||
@@ -1,10 +0,0 @@
|
||||
--TEST--
|
||||
zend_strtod() hangs with 2.2250738585072011e-308
|
||||
--FILE--
|
||||
<?php
|
||||
$d = 2.2250738585072011e-308;
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Done
|
||||
@@ -1,39 +0,0 @@
|
||||
--TEST--
|
||||
Bug #53748 (Using traits lead to a segmentation fault)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
trait Singleton {
|
||||
protected static $instances=array();
|
||||
abstract protected function __construct($config);
|
||||
public static function getInstance($config) {
|
||||
if (!isset(self::$instances[$serialize = serialize($config)])) {
|
||||
self::$instances[$serialize] = new self($config);
|
||||
}
|
||||
return self::$instances[$serialize];
|
||||
}
|
||||
}
|
||||
|
||||
class MyHelloWorld {
|
||||
use Singleton;
|
||||
public function __construct($config)
|
||||
{
|
||||
var_dump( $config);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$o= myHelloWorld::getInstance(1);
|
||||
$o= myHelloWorld::getInstance(1);
|
||||
$o= myHelloWorld::getInstance(2);
|
||||
$o= myHelloWorld::getInstance(array(1=>2));
|
||||
$o= myHelloWorld::getInstance(array(1=>2));
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(1)
|
||||
int(2)
|
||||
array(1) {
|
||||
[1]=>
|
||||
int(2)
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
--TEST--
|
||||
Bug #53958 (Closures can't 'use' shared variables by value and by reference)
|
||||
--FILE--
|
||||
<?php
|
||||
// TEST 1
|
||||
$a = 1;
|
||||
$fn1 = function() use ($a) {echo "$a\n"; $a++;};
|
||||
$fn2 = function() use ($a) {echo "$a\n"; $a++;};
|
||||
$a = 5;
|
||||
$fn1(); // 1
|
||||
$fn2(); // 1
|
||||
$fn1(); // 1
|
||||
$fn2(); // 1
|
||||
|
||||
// TEST 2
|
||||
$b = 1;
|
||||
$fn1 = function() use (&$b) {echo "$b\n"; $b++;};
|
||||
$fn2 = function() use (&$b) {echo "$b\n"; $b++;};
|
||||
$b = 5;
|
||||
$fn1(); // 5
|
||||
$fn2(); // 6
|
||||
$fn1(); // 7
|
||||
$fn2(); // 8
|
||||
|
||||
// TEST 3
|
||||
$c = 1;
|
||||
$fn1 = function() use (&$c) {echo "$c\n"; $c++;};
|
||||
$fn2 = function() use ($c) {echo "$c\n"; $c++;};
|
||||
$c = 5;
|
||||
$fn1(); // 5
|
||||
$fn2(); // 1
|
||||
$fn1(); // 6
|
||||
$fn2(); // 1
|
||||
|
||||
// TEST 4
|
||||
$d = 1;
|
||||
$fn1 = function() use ($d) {echo "$d\n"; $d++;};
|
||||
$fn2 = function() use (&$d) {echo "$d\n"; $d++;};
|
||||
$d = 5;
|
||||
$fn1(); // 1
|
||||
$fn2(); // 5
|
||||
$fn1(); // 1
|
||||
$fn2(); // 6
|
||||
?>
|
||||
--EXPECT--
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
5
|
||||
1
|
||||
6
|
||||
1
|
||||
1
|
||||
5
|
||||
1
|
||||
6
|
||||
@@ -1,11 +0,0 @@
|
||||
--TEST--
|
||||
Bug #53971 (isset() and empty() produce apparently spurious runtime error)
|
||||
--FILE--
|
||||
<?php
|
||||
$s = "";
|
||||
var_dump(isset($s[0][0]));
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
--TEST--
|
||||
Bug #54013 (ReflectionParam for duplicate parameter contains garbage)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class a
|
||||
{
|
||||
function b($aaaaaaaa, $aaaaaaaa)
|
||||
{
|
||||
$params = func_get_args();
|
||||
}
|
||||
}
|
||||
|
||||
$c = new a;
|
||||
$c->b('waa?', 'meukee!');
|
||||
|
||||
$reflectionClass = new ReflectionClass($c);
|
||||
$params = $reflectionClass->getMethod('b')->getParameters();
|
||||
|
||||
var_dump($params[0], $params[1]);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(ReflectionParameter)#%d (1) {
|
||||
["name"]=>
|
||||
string(8) "aaaaaaaa"
|
||||
}
|
||||
object(ReflectionParameter)#%d (1) {
|
||||
["name"]=>
|
||||
string(8) "aaaaaaaa"
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
--TEST--
|
||||
Bug #54039 (use() of static variables in lambda functions can break staticness)
|
||||
--FILE--
|
||||
<?php
|
||||
function test_1() {
|
||||
static $v = 0;
|
||||
++$v;
|
||||
echo "Outer function increments \$v to $v\n";
|
||||
$f = function() use($v) {
|
||||
echo "Inner function reckons \$v is $v\n";
|
||||
};
|
||||
return $f;
|
||||
}
|
||||
|
||||
$f = test_1(); $f();
|
||||
$f = test_1(); $f();
|
||||
|
||||
function test_2() {
|
||||
static $v = 0;
|
||||
$f = function() use($v) {
|
||||
echo "Inner function reckons \$v is $v\n";
|
||||
};
|
||||
++$v;
|
||||
echo "Outer function increments \$v to $v\n";
|
||||
return $f;
|
||||
}
|
||||
|
||||
$f = test_2(); $f();
|
||||
$f = test_2(); $f();
|
||||
|
||||
function test_3() {
|
||||
static $v = "";
|
||||
$v .= 'b';
|
||||
echo "Outer function catenates 'b' onto \$v to give $v\n";
|
||||
$f = function() use($v) {
|
||||
echo "Inner function reckons \$v is $v\n";
|
||||
};
|
||||
$v .= 'a';
|
||||
echo "Outer function catenates 'a' onto \$v to give $v\n";
|
||||
return $f;
|
||||
}
|
||||
$f = test_3(); $f();
|
||||
$f = test_3(); $f();
|
||||
--EXPECT--
|
||||
Outer function increments $v to 1
|
||||
Inner function reckons $v is 1
|
||||
Outer function increments $v to 2
|
||||
Inner function reckons $v is 2
|
||||
Outer function increments $v to 1
|
||||
Inner function reckons $v is 0
|
||||
Outer function increments $v to 2
|
||||
Inner function reckons $v is 1
|
||||
Outer function catenates 'b' onto $v to give b
|
||||
Outer function catenates 'a' onto $v to give ba
|
||||
Inner function reckons $v is b
|
||||
Outer function catenates 'b' onto $v to give bab
|
||||
Outer function catenates 'a' onto $v to give baba
|
||||
Inner function reckons $v is bab
|
||||
@@ -1,17 +0,0 @@
|
||||
--TEST--
|
||||
Bug #54262 (Crash when assigning value to a dimension in a non-array)
|
||||
--FILE--
|
||||
<?php
|
||||
$a = '0';
|
||||
var_dump(isset($a['b']));
|
||||
$simpleString = preg_match('//', '', $a->a);
|
||||
$simpleString["wrong"] = "f";
|
||||
echo "ok\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
|
||||
Warning: Attempt to modify property of non-object in %s/Zend/tests/bug54262.php on line 4
|
||||
|
||||
Warning: Cannot use a scalar value as an array in %s/Zend/tests/bug54262.php on line 5
|
||||
ok
|
||||
@@ -1,17 +0,0 @@
|
||||
--TEST--
|
||||
Bug #54265 (crash when variable gets reassigned in error handler)
|
||||
--FILE--
|
||||
<?php
|
||||
function my_errorhandler($errno,$errormsg) {
|
||||
global $my_var;
|
||||
$my_var = 0;
|
||||
echo "EROOR: $errormsg\n";
|
||||
}
|
||||
set_error_handler("my_errorhandler");
|
||||
$my_var = str_repeat("A",$my_var[0]->errormsg = "xyz");
|
||||
echo "ok\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
EROOR: Creating default object from empty value
|
||||
ok
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
--TEST--
|
||||
Bug #54268 (Double free when destroy_zend_class fails)
|
||||
--INI--
|
||||
memory_limit=8M
|
||||
--SKIPIF--
|
||||
<?php
|
||||
$zend_mm_enabled = getenv("USE_ZEND_ALLOC");
|
||||
if ($zend_mm_enabled === "0") {
|
||||
die("skip Zend MM disabled");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
class DestructableObject
|
||||
{
|
||||
public function __destruct()
|
||||
{
|
||||
DestructableObject::__destruct();
|
||||
}
|
||||
}
|
||||
class DestructorCreator
|
||||
{
|
||||
public function __destruct()
|
||||
{
|
||||
$this->test = new DestructableObject;
|
||||
}
|
||||
}
|
||||
class Test
|
||||
{
|
||||
public static $mystatic;
|
||||
}
|
||||
$x = new Test();
|
||||
Test::$mystatic = new DestructorCreator();
|
||||
--EXPECTF--
|
||||
Fatal error: Allowed memory size of %s bytes exhausted%s(tried to allocate %s bytes) in %s on line %d
|
||||
@@ -1,39 +0,0 @@
|
||||
--TEST--
|
||||
Bug #54358 (Closure, use and reference)
|
||||
--FILE--
|
||||
<?php
|
||||
class asserter {
|
||||
public function call($function) {
|
||||
}
|
||||
}
|
||||
|
||||
$asserter = new asserter();
|
||||
|
||||
$closure = function() use ($asserter, &$function) {
|
||||
$asserter->call($function = 'md5');
|
||||
};
|
||||
|
||||
$closure();
|
||||
|
||||
var_dump($function);
|
||||
|
||||
$closure = function() use ($asserter, $function) {
|
||||
$asserter->call($function);
|
||||
};
|
||||
|
||||
$closure();
|
||||
|
||||
var_dump($function);
|
||||
|
||||
$closure = function() use ($asserter, $function) {
|
||||
$asserter->call($function);
|
||||
};
|
||||
|
||||
$closure();
|
||||
|
||||
var_dump($function);
|
||||
?>
|
||||
--EXPECT--
|
||||
string(3) "md5"
|
||||
string(3) "md5"
|
||||
string(3) "md5"
|
||||
@@ -1,24 +0,0 @@
|
||||
--TEST--
|
||||
Bug #54367 (Use of closure causes problem in ArrayAccess)
|
||||
--FILE--
|
||||
<?php
|
||||
class MyObjet implements ArrayAccess
|
||||
{
|
||||
public function offsetSet($offset, $value) { }
|
||||
public function offsetExists($offset) { }
|
||||
public function offsetUnset($offset) { }
|
||||
|
||||
public function offsetGet ($offset)
|
||||
{
|
||||
return function ($var) use ($offset) { // here is the problem
|
||||
var_dump($offset, $var);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
$a = new MyObjet();
|
||||
echo $a['p']('foo');
|
||||
?>
|
||||
--EXPECT--
|
||||
string(1) "p"
|
||||
string(3) "foo"
|
||||
@@ -1,23 +0,0 @@
|
||||
--TEST--
|
||||
Bug #54372 (Crash accessing global object itself returned from its __get() handle)
|
||||
--FILE--
|
||||
<?php
|
||||
class test_class
|
||||
{
|
||||
public function __get($name)
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function b()
|
||||
{
|
||||
echo "ok\n";
|
||||
}
|
||||
}
|
||||
|
||||
global $test3;
|
||||
$test3 = new test_class();
|
||||
$test3->a->b();
|
||||
?>
|
||||
--EXPECT--
|
||||
ok
|
||||
@@ -1,15 +0,0 @@
|
||||
--TEST--
|
||||
Bug #54585 (track_errors causes segfault)
|
||||
--INI--
|
||||
track_errors=On
|
||||
--FILE--
|
||||
<?php
|
||||
function testing($source) {
|
||||
unset($source[$cos]);
|
||||
}
|
||||
testing($_GET);
|
||||
echo "ok\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Notice: Undefined variable: cos in %sbug54585.php on line 3
|
||||
ok
|
||||
@@ -28,9 +28,9 @@ foo::BAZ();
|
||||
--EXPECT--
|
||||
nonstatic
|
||||
string(6) "fOoBaR"
|
||||
nonstatic
|
||||
static
|
||||
string(6) "foOBAr"
|
||||
nonstatic
|
||||
static
|
||||
string(6) "fOOBAr"
|
||||
static
|
||||
string(3) "bAr"
|
||||
|
||||
@@ -30,5 +30,5 @@ a::Foo();
|
||||
--EXPECT--
|
||||
__callstatic: Test
|
||||
__call: Test
|
||||
__call: Bar
|
||||
__callstatic: Bar
|
||||
__callstatic: Foo
|
||||
@@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Checking if exists interface, trait, abstract and final class
|
||||
Checking if exists interface, abstract and final class
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -9,16 +9,12 @@ abstract class b { }
|
||||
|
||||
final class c { }
|
||||
|
||||
trait d {}
|
||||
|
||||
var_dump(class_exists('a'));
|
||||
var_dump(class_exists('b'));
|
||||
var_dump(class_exists('c'));
|
||||
var_dump(class_exists('d'));
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(false)
|
||||
@@ -1,74 +0,0 @@
|
||||
--TEST--
|
||||
Closure 005: Lambda inside class, lifetime of $this
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class A {
|
||||
private $x;
|
||||
|
||||
function __construct($x) {
|
||||
$this->x = $x;
|
||||
}
|
||||
|
||||
function __destruct() {
|
||||
echo "Destroyed\n";
|
||||
}
|
||||
|
||||
function getIncer($val) {
|
||||
return function() use ($val) {
|
||||
$this->x += $val;
|
||||
};
|
||||
}
|
||||
|
||||
function getPrinter() {
|
||||
return function() {
|
||||
echo $this->x."\n";
|
||||
};
|
||||
}
|
||||
|
||||
function getError() {
|
||||
return static function() {
|
||||
echo $this->x."\n";
|
||||
};
|
||||
}
|
||||
|
||||
function printX() {
|
||||
echo $this->x."\n";
|
||||
}
|
||||
}
|
||||
|
||||
$a = new A(3);
|
||||
$incer = $a->getIncer(2);
|
||||
$printer = $a->getPrinter();
|
||||
$error = $a->getError();
|
||||
|
||||
$a->printX();
|
||||
$printer();
|
||||
$incer();
|
||||
$a->printX();
|
||||
$printer();
|
||||
|
||||
unset($a);
|
||||
|
||||
$incer();
|
||||
$printer();
|
||||
|
||||
unset($incer);
|
||||
$printer();
|
||||
|
||||
unset($printer);
|
||||
|
||||
$error();
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
3
|
||||
3
|
||||
5
|
||||
5
|
||||
7
|
||||
7
|
||||
Destroyed
|
||||
|
||||
Fatal error: Using $this when not in object context in %sclosure_005.php on line 28
|
||||
@@ -1,38 +0,0 @@
|
||||
--TEST--
|
||||
Closure 007: Nested lambdas in classes
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class A {
|
||||
private $x = 0;
|
||||
|
||||
function getClosureGetter () {
|
||||
return function () {
|
||||
return function () {
|
||||
$this->x++;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
function printX () {
|
||||
echo $this->x."\n";
|
||||
}
|
||||
}
|
||||
|
||||
$a = new A;
|
||||
$a->printX();
|
||||
$getClosure = $a->getClosureGetter();
|
||||
$a->printX();
|
||||
$closure = $getClosure();
|
||||
$a->printX();
|
||||
$closure();
|
||||
$a->printX();
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
0
|
||||
0
|
||||
0
|
||||
1
|
||||
Done
|
||||
@@ -23,18 +23,16 @@ var_dump($y()->test);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(foo)#%d (2) {
|
||||
object(foo)#%d (%d) {
|
||||
["test":"foo":private]=>
|
||||
int(3)
|
||||
["a"]=>
|
||||
object(Closure)#%d (2) {
|
||||
object(Closure)#%d (1) {
|
||||
["static"]=>
|
||||
array(1) {
|
||||
["a"]=>
|
||||
*RECURSION*
|
||||
}
|
||||
["this"]=>
|
||||
*RECURSION*
|
||||
}
|
||||
}
|
||||
bool(true)
|
||||
|
||||
@@ -1,26 +1,16 @@
|
||||
--TEST--
|
||||
Closure 024: Clone the Closure object
|
||||
Closure 024: Trying to clone the Closure object
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$a = 1;
|
||||
$c = function($add) use(&$a) { return $a+$add; };
|
||||
$a = function () {
|
||||
return clone function () {
|
||||
return 1;
|
||||
};
|
||||
};
|
||||
|
||||
$cc = clone $c;
|
||||
$a();
|
||||
|
||||
echo $c(10)."\n";
|
||||
echo $cc(10)."\n";
|
||||
|
||||
$a++;
|
||||
|
||||
echo $c(10)."\n";
|
||||
echo $cc(10)."\n";
|
||||
|
||||
echo "Done.\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
11
|
||||
11
|
||||
12
|
||||
12
|
||||
Done.
|
||||
Fatal error: Trying to clone an uncloneable object of class Closure in %s on line %d
|
||||
@@ -32,9 +32,7 @@ object(foo)#%d (1) {
|
||||
["a"]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
object(Closure)#%d (1) {
|
||||
["this"]=>
|
||||
*RECURSION*
|
||||
object(Closure)#%d (0) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43,12 +41,7 @@ int(1)
|
||||
string(1) "a"
|
||||
array(1) {
|
||||
[0]=>
|
||||
object(Closure)#%d (1) {
|
||||
["this"]=>
|
||||
object(foo)#%d (1) {
|
||||
["a"]=>
|
||||
*RECURSION*
|
||||
}
|
||||
object(Closure)#%d (0) {
|
||||
}
|
||||
}
|
||||
int(1)
|
||||
@@ -1,33 +0,0 @@
|
||||
--TEST--
|
||||
Closure 036: Rebinding closures
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class A {
|
||||
private $x;
|
||||
|
||||
public function __construct($v) {
|
||||
$this->x = $v;
|
||||
}
|
||||
|
||||
public function getIncrementor() {
|
||||
return function() { return ++$this->x; };
|
||||
}
|
||||
}
|
||||
|
||||
$a = new A(0);
|
||||
$b = new A(10);
|
||||
|
||||
$ca = $a->getIncrementor();
|
||||
$cb = $ca->bindTo($b);
|
||||
$cb2 = Closure::bind($b, $ca);
|
||||
|
||||
var_dump($ca());
|
||||
var_dump($cb());
|
||||
var_dump($cb2());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(1)
|
||||
int(11)
|
||||
int(12)
|
||||
@@ -1,47 +0,0 @@
|
||||
--TEST--
|
||||
Closure 037: self:: and static:: within closures
|
||||
--FILE--
|
||||
<?php
|
||||
class A {
|
||||
private $x = 0;
|
||||
|
||||
function getClosure () {
|
||||
return function () {
|
||||
$this->x++;
|
||||
self::printX();
|
||||
self::print42();
|
||||
static::print42();
|
||||
};
|
||||
}
|
||||
|
||||
function printX () {
|
||||
echo $this->x."\n";
|
||||
}
|
||||
|
||||
function print42() {
|
||||
echo "42\n";
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
function print42() {
|
||||
echo "forty two\n";
|
||||
}
|
||||
}
|
||||
|
||||
$a = new A;
|
||||
$closure = $a->getClosure();
|
||||
$closure();
|
||||
$b = new B;
|
||||
$closure = $b->getClosure();
|
||||
$closure();
|
||||
?>
|
||||
Done.
|
||||
--EXPECTF--
|
||||
1
|
||||
42
|
||||
42
|
||||
1
|
||||
42
|
||||
forty two
|
||||
Done.
|
||||
@@ -1,133 +0,0 @@
|
||||
--TEST--
|
||||
debug_backtrace limit
|
||||
--FILE--
|
||||
<?php
|
||||
function a() {
|
||||
b();
|
||||
}
|
||||
|
||||
function b() {
|
||||
c();
|
||||
}
|
||||
|
||||
function c() {
|
||||
print_r(debug_backtrace(0, 1));
|
||||
print_r(debug_backtrace(0, 2));
|
||||
print_r(debug_backtrace(0, 0));
|
||||
print_r(debug_backtrace(0, 4));
|
||||
}
|
||||
|
||||
a();
|
||||
?>
|
||||
--EXPECTF--
|
||||
Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[file] => %s/debug_backtrace_limit.php
|
||||
[line] => 7
|
||||
[function] => c
|
||||
[args] => Array
|
||||
(
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[file] => %s/debug_backtrace_limit.php
|
||||
[line] => 7
|
||||
[function] => c
|
||||
[args] => Array
|
||||
(
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
[1] => Array
|
||||
(
|
||||
[file] => %s/debug_backtrace_limit.php
|
||||
[line] => 3
|
||||
[function] => b
|
||||
[args] => Array
|
||||
(
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[file] => %s/debug_backtrace_limit.php
|
||||
[line] => 7
|
||||
[function] => c
|
||||
[args] => Array
|
||||
(
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
[1] => Array
|
||||
(
|
||||
[file] => %s/debug_backtrace_limit.php
|
||||
[line] => 3
|
||||
[function] => b
|
||||
[args] => Array
|
||||
(
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
[2] => Array
|
||||
(
|
||||
[file] => %s/debug_backtrace_limit.php
|
||||
[line] => 17
|
||||
[function] => a
|
||||
[args] => Array
|
||||
(
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
)
|
||||
Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[file] => %s/debug_backtrace_limit.php
|
||||
[line] => 7
|
||||
[function] => c
|
||||
[args] => Array
|
||||
(
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
[1] => Array
|
||||
(
|
||||
[file] => %s/debug_backtrace_limit.php
|
||||
[line] => 3
|
||||
[function] => b
|
||||
[args] => Array
|
||||
(
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
[2] => Array
|
||||
(
|
||||
[file] => %s/debug_backtrace_limit.php
|
||||
[line] => 17
|
||||
[function] => a
|
||||
[args] => Array
|
||||
(
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
)
|
||||
@@ -1,397 +0,0 @@
|
||||
--TEST--
|
||||
debug_backtrace options
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function backtrace_print($opt = null)
|
||||
{
|
||||
if(is_null($opt)) {
|
||||
print_r(debug_backtrace());
|
||||
} else {
|
||||
print_r(debug_backtrace($opt));
|
||||
}
|
||||
}
|
||||
|
||||
function doit($a, $b, $how)
|
||||
{
|
||||
echo "==default\n";
|
||||
$how();
|
||||
echo "==true\n";
|
||||
$how(true);
|
||||
echo "==false\n";
|
||||
$how(false);
|
||||
echo "==DEBUG_BACKTRACE_PROVIDE_OBJECT\n";
|
||||
$how(DEBUG_BACKTRACE_PROVIDE_OBJECT);
|
||||
echo "==DEBUG_BACKTRACE_IGNORE_ARGS\n";
|
||||
$how(DEBUG_BACKTRACE_IGNORE_ARGS);
|
||||
echo "==both\n";
|
||||
$how(DEBUG_BACKTRACE_PROVIDE_OBJECT|DEBUG_BACKTRACE_IGNORE_ARGS);
|
||||
}
|
||||
|
||||
class foo {
|
||||
protected function doCall($dowhat, $how)
|
||||
{
|
||||
$dowhat('a','b', $how);
|
||||
}
|
||||
static function statCall($dowhat, $how)
|
||||
{
|
||||
$obj = new self();
|
||||
$obj->doCall($dowhat, $how);
|
||||
}
|
||||
}
|
||||
foo::statCall("doit", "debug_print_backtrace");
|
||||
foo::statCall("doit", "backtrace_print");
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
==default
|
||||
#0 doit(a, b, debug_print_backtrace) called at [%sdebug_backtrace_options.php:%d]
|
||||
#1 foo->doCall(doit, debug_print_backtrace) called at [%sdebug_backtrace_options.php:%d]
|
||||
#2 foo::statCall(doit, debug_print_backtrace) called at [%sdebug_backtrace_options.php:%d]
|
||||
==true
|
||||
#0 doit(a, b, debug_print_backtrace) called at [%sdebug_backtrace_options.php:%d]
|
||||
#1 foo->doCall(doit, debug_print_backtrace) called at [%sdebug_backtrace_options.php:%d]
|
||||
#2 foo::statCall(doit, debug_print_backtrace) called at [%sdebug_backtrace_options.php:%d]
|
||||
==false
|
||||
#0 doit(a, b, debug_print_backtrace) called at [%sdebug_backtrace_options.php:%d]
|
||||
#1 foo->doCall(doit, debug_print_backtrace) called at [%sdebug_backtrace_options.php:%d]
|
||||
#2 foo::statCall(doit, debug_print_backtrace) called at [%sdebug_backtrace_options.php:%d]
|
||||
==DEBUG_BACKTRACE_PROVIDE_OBJECT
|
||||
#0 doit(a, b, debug_print_backtrace) called at [%sdebug_backtrace_options.php:%d]
|
||||
#1 foo->doCall(doit, debug_print_backtrace) called at [%sdebug_backtrace_options.php:%d]
|
||||
#2 foo::statCall(doit, debug_print_backtrace) called at [%sdebug_backtrace_options.php:%d]
|
||||
==DEBUG_BACKTRACE_IGNORE_ARGS
|
||||
#0 doit() called at [%sdebug_backtrace_options.php:%d]
|
||||
#1 foo->doCall() called at [%sdebug_backtrace_options.php:%d]
|
||||
#2 foo::statCall() called at [%sdebug_backtrace_options.php:%d]
|
||||
==both
|
||||
#0 doit() called at [%sdebug_backtrace_options.php:%d]
|
||||
#1 foo->doCall() called at [%sdebug_backtrace_options.php:%d]
|
||||
#2 foo::statCall() called at [%sdebug_backtrace_options.php:%d]
|
||||
==default
|
||||
Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[file] => %sdebug_backtrace_options.php
|
||||
[line] => %d
|
||||
[function] => backtrace_print
|
||||
[args] => Array
|
||||
(
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
[1] => Array
|
||||
(
|
||||
[file] => %sdebug_backtrace_options.php
|
||||
[line] => %d
|
||||
[function] => doit
|
||||
[args] => Array
|
||||
(
|
||||
[0] => a
|
||||
[1] => b
|
||||
[2] => backtrace_print
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
[2] => Array
|
||||
(
|
||||
[file] => %sdebug_backtrace_options.php
|
||||
[line] => %d
|
||||
[function] => doCall
|
||||
[class] => foo
|
||||
[object] => foo Object
|
||||
(
|
||||
)
|
||||
|
||||
[type] => ->
|
||||
[args] => Array
|
||||
(
|
||||
[0] => doit
|
||||
[1] => backtrace_print
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
[3] => Array
|
||||
(
|
||||
[file] => %sdebug_backtrace_options.php
|
||||
[line] => %d
|
||||
[function] => statCall
|
||||
[class] => foo
|
||||
[type] => ::
|
||||
[args] => Array
|
||||
(
|
||||
[0] => doit
|
||||
[1] => backtrace_print
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
)
|
||||
==true
|
||||
Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[file] => %sdebug_backtrace_options.php
|
||||
[line] => 17
|
||||
[function] => backtrace_print
|
||||
[args] => Array
|
||||
(
|
||||
[0] => 1
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
[1] => Array
|
||||
(
|
||||
[file] => %sdebug_backtrace_options.php
|
||||
[line] => %d
|
||||
[function] => doit
|
||||
[args] => Array
|
||||
(
|
||||
[0] => a
|
||||
[1] => b
|
||||
[2] => backtrace_print
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
[2] => Array
|
||||
(
|
||||
[file] => %sdebug_backtrace_options.php
|
||||
[line] => %d
|
||||
[function] => doCall
|
||||
[class] => foo
|
||||
[object] => foo Object
|
||||
(
|
||||
)
|
||||
|
||||
[type] => ->
|
||||
[args] => Array
|
||||
(
|
||||
[0] => doit
|
||||
[1] => backtrace_print
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
[3] => Array
|
||||
(
|
||||
[file] => %sdebug_backtrace_options.php
|
||||
[line] => %d
|
||||
[function] => statCall
|
||||
[class] => foo
|
||||
[type] => ::
|
||||
[args] => Array
|
||||
(
|
||||
[0] => doit
|
||||
[1] => backtrace_print
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
)
|
||||
==false
|
||||
Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[file] => %sdebug_backtrace_options.php
|
||||
[line] => 19
|
||||
[function] => backtrace_print
|
||||
[args] => Array
|
||||
(
|
||||
[0] =>
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
[1] => Array
|
||||
(
|
||||
[file] => %sdebug_backtrace_options.php
|
||||
[line] => %d
|
||||
[function] => doit
|
||||
[args] => Array
|
||||
(
|
||||
[0] => a
|
||||
[1] => b
|
||||
[2] => backtrace_print
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
[2] => Array
|
||||
(
|
||||
[file] => %sdebug_backtrace_options.php
|
||||
[line] => %d
|
||||
[function] => doCall
|
||||
[class] => foo
|
||||
[type] => ->
|
||||
[args] => Array
|
||||
(
|
||||
[0] => doit
|
||||
[1] => backtrace_print
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
[3] => Array
|
||||
(
|
||||
[file] => %sdebug_backtrace_options.php
|
||||
[line] => %d
|
||||
[function] => statCall
|
||||
[class] => foo
|
||||
[type] => ::
|
||||
[args] => Array
|
||||
(
|
||||
[0] => doit
|
||||
[1] => backtrace_print
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
)
|
||||
==DEBUG_BACKTRACE_PROVIDE_OBJECT
|
||||
Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[file] => %sdebug_backtrace_options.php
|
||||
[line] => 21
|
||||
[function] => backtrace_print
|
||||
[args] => Array
|
||||
(
|
||||
[0] => 1
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
[1] => Array
|
||||
(
|
||||
[file] => %sdebug_backtrace_options.php
|
||||
[line] => %d
|
||||
[function] => doit
|
||||
[args] => Array
|
||||
(
|
||||
[0] => a
|
||||
[1] => b
|
||||
[2] => backtrace_print
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
[2] => Array
|
||||
(
|
||||
[file] => %sdebug_backtrace_options.php
|
||||
[line] => %d
|
||||
[function] => doCall
|
||||
[class] => foo
|
||||
[object] => foo Object
|
||||
(
|
||||
)
|
||||
|
||||
[type] => ->
|
||||
[args] => Array
|
||||
(
|
||||
[0] => doit
|
||||
[1] => backtrace_print
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
[3] => Array
|
||||
(
|
||||
[file] => %sdebug_backtrace_options.php
|
||||
[line] => %d
|
||||
[function] => statCall
|
||||
[class] => foo
|
||||
[type] => ::
|
||||
[args] => Array
|
||||
(
|
||||
[0] => doit
|
||||
[1] => backtrace_print
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
)
|
||||
==DEBUG_BACKTRACE_IGNORE_ARGS
|
||||
Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[file] => %sdebug_backtrace_options.php
|
||||
[line] => 23
|
||||
[function] => backtrace_print
|
||||
)
|
||||
|
||||
[1] => Array
|
||||
(
|
||||
[file] => %sdebug_backtrace_options.php
|
||||
[line] => %d
|
||||
[function] => doit
|
||||
)
|
||||
|
||||
[2] => Array
|
||||
(
|
||||
[file] => %sdebug_backtrace_options.php
|
||||
[line] => %d
|
||||
[function] => doCall
|
||||
[class] => foo
|
||||
[type] => ->
|
||||
)
|
||||
|
||||
[3] => Array
|
||||
(
|
||||
[file] => %sdebug_backtrace_options.php
|
||||
[line] => %d
|
||||
[function] => statCall
|
||||
[class] => foo
|
||||
[type] => ::
|
||||
)
|
||||
|
||||
)
|
||||
==both
|
||||
Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[file] => %sdebug_backtrace_options.php
|
||||
[line] => 25
|
||||
[function] => backtrace_print
|
||||
)
|
||||
|
||||
[1] => Array
|
||||
(
|
||||
[file] => %sdebug_backtrace_options.php
|
||||
[line] => %d
|
||||
[function] => doit
|
||||
)
|
||||
|
||||
[2] => Array
|
||||
(
|
||||
[file] => %sdebug_backtrace_options.php
|
||||
[line] => %d
|
||||
[function] => doCall
|
||||
[class] => foo
|
||||
[object] => foo Object
|
||||
(
|
||||
)
|
||||
|
||||
[type] => ->
|
||||
)
|
||||
|
||||
[3] => Array
|
||||
(
|
||||
[file] => %sdebug_backtrace_options.php
|
||||
[line] => %d
|
||||
[function] => statCall
|
||||
[class] => foo
|
||||
[type] => ::
|
||||
)
|
||||
|
||||
)
|
||||
@@ -1,31 +0,0 @@
|
||||
--TEST--
|
||||
debug_print_backtrace limit
|
||||
--FILE--
|
||||
<?php
|
||||
function a() {
|
||||
b();
|
||||
}
|
||||
|
||||
function b() {
|
||||
c();
|
||||
}
|
||||
|
||||
function c() {
|
||||
debug_print_backtrace(0, 1);
|
||||
debug_print_backtrace(0, 2);
|
||||
debug_print_backtrace(0, 0);
|
||||
debug_print_backtrace(0, 4);
|
||||
}
|
||||
|
||||
a();
|
||||
?>
|
||||
--EXPECTF--
|
||||
#0 c() called at [%s/debug_print_backtrace_limit.php:7]
|
||||
#0 c() called at [%s/debug_print_backtrace_limit.php:7]
|
||||
#1 b() called at [%s/debug_print_backtrace_limit.php:3]
|
||||
#0 c() called at [%s/debug_print_backtrace_limit.php:7]
|
||||
#1 b() called at [%s/debug_print_backtrace_limit.php:3]
|
||||
#2 a() called at [%s/debug_print_backtrace_limit.php:17]
|
||||
#0 c() called at [%s/debug_print_backtrace_limit.php:7]
|
||||
#1 b() called at [%s/debug_print_backtrace_limit.php:3]
|
||||
#2 a() called at [%s/debug_print_backtrace_limit.php:17]
|
||||
@@ -1,24 +1,16 @@
|
||||
--TEST--
|
||||
Testing declare statement with several type values
|
||||
--INI--
|
||||
zend.multibyte=1
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
declare(encoding = 1);
|
||||
declare(encoding = 1123131232131312321);
|
||||
declare(encoding = NULL);
|
||||
declare(encoding = 'utf-8');
|
||||
declare(encoding = M_PI);
|
||||
declare(encoding = 'utf-8');
|
||||
|
||||
print 'DONE';
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: Unsupported encoding [1] in %sdeclare_001.php on line %d
|
||||
|
||||
Warning: Unsupported encoding [1.1231312321313E+18] in %sdeclare_001.php on line %d
|
||||
|
||||
Warning: Unsupported encoding [] in %sdeclare_001.php on line %d
|
||||
|
||||
Fatal error: Cannot use constants as encoding in %sdeclare_001.php on line %d
|
||||
--EXPECT--
|
||||
DONE
|
||||
@@ -1,28 +0,0 @@
|
||||
--TEST--
|
||||
Testing declare statement with several type values
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!ini_get("zend.multibyte")) {
|
||||
die("skip Requires zend.multibyte=1");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
declare(encoding = 1);
|
||||
declare(encoding = 1123131232131312321);
|
||||
declare(encoding = NULL);
|
||||
declare(encoding = 'utf-8');
|
||||
declare(encoding = M_PI);
|
||||
|
||||
print 'DONE';
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: Unsupported encoding [%d] in %sdeclare_002.php on line 3
|
||||
|
||||
Warning: Unsupported encoding [%f] in %sdeclare_002.php on line 4
|
||||
|
||||
Warning: Unsupported encoding [] in %sdeclare_002.php on line 5
|
||||
|
||||
Fatal error: Cannot use constants as encoding in %sdeclare_002.php on line 7
|
||||
@@ -1,51 +0,0 @@
|
||||
--TEST--
|
||||
Testing array dereference
|
||||
--FILE--
|
||||
<?php
|
||||
error_reporting(E_ALL);
|
||||
|
||||
function a() {
|
||||
return array(1,array(5));
|
||||
}
|
||||
var_dump(a()[1][0]); // int(5)
|
||||
|
||||
function b() {
|
||||
return array();
|
||||
}
|
||||
var_dump(b()[0]); // Notice: Undefined offset: 0
|
||||
|
||||
class foo {
|
||||
public $y = 1;
|
||||
|
||||
public function test() {
|
||||
return array(array(array('foobar')));
|
||||
}
|
||||
}
|
||||
|
||||
function c() {
|
||||
return array(new foo);
|
||||
}
|
||||
var_dump(c()[0]->y); // int(1)
|
||||
|
||||
function d() {
|
||||
$obj = new foo;
|
||||
return $obj->test();
|
||||
}
|
||||
var_dump(d()[0][0][0][3]); // string(1) "b"
|
||||
|
||||
function e() {
|
||||
$y = 'bar';
|
||||
$x = array('a' => 'foo', 'b' => $y);
|
||||
return $x;
|
||||
}
|
||||
var_dump(e()['b']); // string(3) "bar"
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(5)
|
||||
|
||||
Notice: Undefined offset: 0 in %s on line %d
|
||||
NULL
|
||||
int(1)
|
||||
string(1) "b"
|
||||
string(3) "bar"
|
||||
@@ -1,79 +0,0 @@
|
||||
--TEST--
|
||||
Testing array dereference on method calls
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
error_reporting(E_ALL);
|
||||
|
||||
class foo {
|
||||
public function bar() {
|
||||
$x = array();
|
||||
$x[] = 3;
|
||||
$x[] = array(1, 5);
|
||||
$x[] = new foo;
|
||||
return $x;
|
||||
}
|
||||
}
|
||||
|
||||
$foo = new foo;
|
||||
|
||||
var_dump($x = $foo->bar()[1]);
|
||||
var_dump($foo->bar()[1][1]);
|
||||
var_dump($x[0]);
|
||||
var_dump($x = $foo->bar()[2]);
|
||||
var_dump($x->bar());
|
||||
var_dump($x->bar()[0]);
|
||||
|
||||
$x = array();
|
||||
$x[] = new foo;
|
||||
var_dump($x[0]->bar()[2]);
|
||||
var_dump($foo->bar()[2]->bar()[1]);
|
||||
var_dump($foo->bar()[2]->bar()[2]->bar()[1][0]);
|
||||
var_dump($foo->bar()[2]->bar()[2]->bar()[1][0][1]);
|
||||
var_dump($foo->bar()[2]->bar()[2]->bar()[4]);
|
||||
var_dump($foo->bar()[3]->bar());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(2) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(5)
|
||||
}
|
||||
int(5)
|
||||
int(1)
|
||||
object(foo)#2 (0) {
|
||||
}
|
||||
array(3) {
|
||||
[0]=>
|
||||
int(3)
|
||||
[1]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(5)
|
||||
}
|
||||
[2]=>
|
||||
object(foo)#3 (0) {
|
||||
}
|
||||
}
|
||||
int(3)
|
||||
object(foo)#3 (0) {
|
||||
}
|
||||
array(2) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(5)
|
||||
}
|
||||
int(1)
|
||||
NULL
|
||||
|
||||
Notice: Undefined offset: 4 in %s on line %d
|
||||
NULL
|
||||
|
||||
Notice: Undefined offset: 3 in %s on line %d
|
||||
|
||||
Fatal error: Call to a member function bar() on a non-object in %s on line %d
|
||||
@@ -1,46 +0,0 @@
|
||||
--TEST--
|
||||
Testing array dereference on method calls
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
error_reporting(E_ALL);
|
||||
|
||||
class foo {
|
||||
public $x = 2;
|
||||
public function a() {
|
||||
$x = array();
|
||||
$x[] = new foo;
|
||||
return $x;
|
||||
}
|
||||
public function b() {
|
||||
return array(1.2, array(new self));
|
||||
}
|
||||
public function c() {
|
||||
$a = array();
|
||||
$b = &$a;
|
||||
$b[] = true;
|
||||
return $a;
|
||||
}
|
||||
public function d() {
|
||||
return $this->b();
|
||||
}
|
||||
}
|
||||
|
||||
$foo = new foo;
|
||||
|
||||
var_dump($foo->a()[0]->x);
|
||||
var_dump($foo->a()[0]);
|
||||
var_dump($foo->b()[1][0]->a()[0]->x);
|
||||
var_dump($foo->c()[0]);
|
||||
var_dump($foo->d()[0]);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(2)
|
||||
object(foo)#%d (1) {
|
||||
["x"]=>
|
||||
int(2)
|
||||
}
|
||||
int(2)
|
||||
bool(true)
|
||||
float(1.2)
|
||||
@@ -1,27 +0,0 @@
|
||||
--TEST--
|
||||
Testing array dereference on __invoke() result
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
error_reporting(E_ALL);
|
||||
|
||||
class foo {
|
||||
public $x = array();
|
||||
public function __construct() {
|
||||
$h = array();
|
||||
$h[] = new stdclass;
|
||||
$this->x = $h;
|
||||
}
|
||||
public function __invoke() {
|
||||
return $this->x;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$fo = new foo;
|
||||
var_dump($fo()[0]);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
object(stdClass)#%d (0) {
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
--TEST--
|
||||
Testing array dereference on object that implements ArrayAccess
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
error_reporting(E_ALL);
|
||||
|
||||
class obj implements arrayaccess {
|
||||
private $container = array();
|
||||
public function __construct() {
|
||||
$this->container = array(
|
||||
"one" => 1,
|
||||
"two" => 2,
|
||||
"three" => 3,
|
||||
);
|
||||
}
|
||||
public function offsetSet($offset, $value) {
|
||||
$this->container[$offset] = $value;
|
||||
}
|
||||
public function offsetExists($offset) {
|
||||
return isset($this->container[$offset]);
|
||||
}
|
||||
public function offsetUnset($offset) {
|
||||
unset($this->container[$offset]);
|
||||
}
|
||||
public function offsetGet($offset) {
|
||||
return isset($this->container[$offset]) ? $this->container[$offset] : null;
|
||||
}
|
||||
}
|
||||
|
||||
function x() {
|
||||
return new obj;
|
||||
}
|
||||
var_dump(x()['two']);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
int(2)
|
||||
@@ -1,30 +0,0 @@
|
||||
--TEST--
|
||||
Testing array dereference and references
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
error_reporting(E_ALL);
|
||||
|
||||
function &foo(&$foo) {
|
||||
return $foo;
|
||||
}
|
||||
|
||||
$a = array(1);
|
||||
foo($a)[0] = 2;
|
||||
var_dump($a);
|
||||
|
||||
foo($a)[] = 3;
|
||||
var_dump($a);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
array(1) {
|
||||
[0]=>
|
||||
int(2)
|
||||
}
|
||||
array(2) {
|
||||
[0]=>
|
||||
int(2)
|
||||
[1]=>
|
||||
int(3)
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
--TEST--
|
||||
Trying to write on method return
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
error_reporting(E_ALL);
|
||||
|
||||
class foo {
|
||||
public $x = array();
|
||||
|
||||
public function b() {
|
||||
return $this->x;
|
||||
}
|
||||
|
||||
public function c() {
|
||||
return $x;
|
||||
}
|
||||
|
||||
static public function d() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$foo = new foo;
|
||||
|
||||
$foo->b()[0] = 1;
|
||||
|
||||
$foo->c()[100] = 2;
|
||||
|
||||
foo::d()[] = 3;
|
||||
|
||||
print "ok\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Notice: Undefined variable: x in %s on line %d
|
||||
ok
|
||||
@@ -1,33 +0,0 @@
|
||||
--TEST--
|
||||
Testing array dereference with dynamic method name and references
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
error_reporting(E_ALL);
|
||||
|
||||
class foo {
|
||||
public $x = array(1);
|
||||
|
||||
public function &b() {
|
||||
return $this->x;
|
||||
}
|
||||
}
|
||||
|
||||
$foo = new foo;
|
||||
|
||||
$a = 'b';
|
||||
var_dump($foo->$a()[0]);
|
||||
|
||||
$h = &$foo->$a();
|
||||
$h[] = 2;
|
||||
var_dump($foo->$a());
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
int(1)
|
||||
array(2) {
|
||||
[0]=>
|
||||
int(1)
|
||||
[1]=>
|
||||
int(2)
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
--TEST--
|
||||
Testing array dereference with references
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
error_reporting(E_ALL);
|
||||
|
||||
$a = array();
|
||||
|
||||
function &a() {
|
||||
return $GLOBALS['a'];
|
||||
}
|
||||
|
||||
var_dump($h =& a());
|
||||
$h[] = 1;
|
||||
var_dump(a()[0]);
|
||||
|
||||
$h[] = array($h);
|
||||
var_dump(a()[1][0][0]);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
array(0) {
|
||||
}
|
||||
int(1)
|
||||
int(1)
|
||||
Loaded 100 of 2288 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user