├── tests ├── data │ └── abc.data ├── get_included_files_inc1.inc ├── symfony │ ├── Symfony │ │ └── Component │ │ │ ├── BrowserKit │ │ │ ├── .gitignore │ │ │ ├── Request.php │ │ │ ├── History.php │ │ │ └── Response.php │ │ │ ├── ClassLoader │ │ │ ├── .gitignore │ │ │ └── ClassLoader.php │ │ │ ├── DomCrawler │ │ │ └── .gitignore │ │ │ ├── HttpKernel │ │ │ ├── .gitignore │ │ │ ├── TerminableInterface.php │ │ │ ├── Controller │ │ │ │ └── ControllerResolverInterface.php │ │ │ ├── KernelEvents.php │ │ │ ├── HttpKernelInterface.php │ │ │ ├── Tests │ │ │ │ ├── Fixtures │ │ │ │ │ └── TestClient.php │ │ │ │ └── TestHttpKernel.php │ │ │ └── Event │ │ │ │ ├── GetResponseEvent.php │ │ │ │ ├── FilterResponseEvent.php │ │ │ │ ├── KernelEvent.php │ │ │ │ └── FilterControllerEvent.php │ │ │ ├── EventDispatcher │ │ │ ├── .gitignore │ │ │ ├── EventDispatcherInterface.php │ │ │ ├── Event.php │ │ │ └── GenericEvent.php │ │ │ ├── Process │ │ │ ├── PhpProcess.php │ │ │ ├── PhpExecutableFinder.php │ │ │ ├── ExecutableFinder.php │ │ │ └── ProcessBuilder.php │ │ │ └── HttpFoundation │ │ │ ├── RedirectResponse.php │ │ │ ├── StreamedResponse.php │ │ │ ├── ServerBag.php │ │ │ ├── FileBag.php │ │ │ └── Cookie.php │ ├── PHPUnit │ │ └── Framework │ │ │ ├── SelfDescribing.php │ │ │ ├── Constraint │ │ │ └── IsTrue.php │ │ │ └── Constraint.php │ ├── vendor │ │ ├── composer │ │ │ ├── autoload_classmap.php │ │ │ └── autoload_namespaces.php │ │ └── autoload.php │ ├── symfony_tests.inc │ ├── symfony_httpkernel1.phpt │ └── symfony_process1.phpt ├── apc_bin_002-2.inc ├── get_included_files_inc2.inc ├── get_included_files_inc3.inc ├── skipif.inc ├── 023-2.inc ├── php_5_3_ns.inc ├── apc_011.phpt ├── apc53_005.phpt ├── apc53_003.phpt ├── apc_bin_001.phpt ├── apc_002.phpt ├── apc_001.phpt ├── apc53_001.phpt ├── apc53_004.phpt ├── iterator_007.phpt ├── iterator_002.phpt ├── bug63434.phpt ├── iterator_004.phpt ├── apc53_002.phpt ├── apc_004.phpt ├── bug62802.phpt ├── apc_005.phpt ├── apc54_003.phpt ├── bug62765.phpt ├── apc_008.phpt ├── apc54_012.phpt ├── bug38779.phpt ├── bug62825.phpt ├── apc54_007.phpt ├── apc54_010.phpt ├── apc_007.phpt ├── bug62757.phpt ├── apc54_001.phpt ├── apc54_error_010_2.phpt ├── apc_006.phpt ├── apc_bin_002.phpt ├── apc54_011.phpt ├── apc_bin_002-1.inc ├── bug65405.phpt ├── apc_010.phpt ├── get_included_files.phpt ├── apc54_009.phpt ├── apc54_014.phpt ├── bug52144_classes.phpt ├── apc_003.phpt ├── iterator_001.phpt ├── apc_003b.phpt ├── apc54_021.phpt ├── iterator_003.phpt ├── iterator_005.phpt ├── apc_012.phpt ├── apc54_016.phpt ├── bug52144_functions.phpt ├── apc_009.phpt ├── apc54_013.phpt ├── apc54_002.phpt ├── apc54_bug62699.phpt ├── bug61398_2.phpt ├── apc54_019.phpt ├── bug63491.phpt ├── apc54_017.phpt └── bug45910.phpt ├── NOTICE ├── Makefile.frag ├── TODO ├── apc_debug.h ├── apc_spin.h ├── apc_pthreadmutex.h ├── config.w32 ├── apc_signal.h ├── apc_pthreadrwlock.h ├── apc_string.h ├── apc_mmap.h ├── apc_spin.c ├── apc_fcntl.h ├── php_apc.h ├── apc_shm.h ├── apc_sem.h ├── apc_bin.h ├── apc_stack.h ├── apc_debug.c ├── apc_windows_srwlock_kernel.h ├── apc_php.h ├── LICENSE ├── apc_main.h ├── apc_serializer.h ├── apc_stack.c ├── apc_php_pcre.h ├── apc_sma.h └── apc_pool.h /tests/data/abc.data: -------------------------------------------------------------------------------- 1 | s:3:"123" 2 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/php/pecl-caching-apc/master/NOTICE -------------------------------------------------------------------------------- /tests/get_included_files_inc1.inc: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /tests/symfony/Symfony/Component/BrowserKit/.gitignore: -------------------------------------------------------------------------------- 1 | vendor/ 2 | composer.lock 3 | -------------------------------------------------------------------------------- /tests/symfony/Symfony/Component/ClassLoader/.gitignore: -------------------------------------------------------------------------------- 1 | vendor/ 2 | composer.lock 3 | -------------------------------------------------------------------------------- /tests/symfony/Symfony/Component/DomCrawler/.gitignore: -------------------------------------------------------------------------------- 1 | vendor/ 2 | composer.lock 3 | -------------------------------------------------------------------------------- /tests/symfony/Symfony/Component/HttpKernel/.gitignore: -------------------------------------------------------------------------------- 1 | vendor/ 2 | composer.lock 3 | -------------------------------------------------------------------------------- /tests/symfony/Symfony/Component/EventDispatcher/.gitignore: -------------------------------------------------------------------------------- 1 | vendor/ 2 | composer.lock 3 | -------------------------------------------------------------------------------- /tests/apc_bin_002-2.inc: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /tests/get_included_files_inc2.inc: -------------------------------------------------------------------------------- 1 | 5 | -------------------------------------------------------------------------------- /tests/get_included_files_inc3.inc: -------------------------------------------------------------------------------- 1 | 5 | -------------------------------------------------------------------------------- /tests/skipif.inc: -------------------------------------------------------------------------------- 1 | 7 | -------------------------------------------------------------------------------- /tests/symfony/PHPUnit/Framework/SelfDescribing.php: -------------------------------------------------------------------------------- 1 | 2 | This is Finish.phtml. This file is supposed to be included 3 | from regression_test.phtml. This is normal HTML. 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /tests/symfony/vendor/composer/autoload_classmap.php: -------------------------------------------------------------------------------- 1 | register\(\);)/', "$0\nrequire_once '".__DIR__."/../bootstrap.php';", $script); 14 | 15 | return $script; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /tests/apc_011.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | APC: apc_fetch resets array pointers 3 | --SKIPIF-- 4 | 5 | --INI-- 6 | apc.enabled=1 7 | apc.enable_cli=1 8 | apc.file_update_protection=0 9 | --FILE-- 10 | 21 | ===DONE=== 22 | 23 | --EXPECTF-- 24 | string(3) "bar" 25 | string(3) "bar" 26 | ===DONE=== 27 | -------------------------------------------------------------------------------- /tests/apc53_005.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | APC: goto (php 5.3) 3 | --SKIPIF-- 4 | 10 | --INI-- 11 | apc.enabled=1 12 | apc.enable_cli=1 13 | apc.file_update_protection=0 14 | --FILE-- 15 | 25 | ===DONE=== 26 | 27 | --EXPECTF-- 28 | 1 29 | 2 30 | 4 31 | 5 32 | 7 33 | 8 34 | 10 35 | ===DONE=== 36 | -------------------------------------------------------------------------------- /tests/apc53_003.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | APC: anonymous functions (php 5.3) 3 | --SKIPIF-- 4 | 10 | --INI-- 11 | apc.enabled=1 12 | apc.enable_cli=1 13 | apc.file_update_protection=0 14 | --FILE-- 15 | 26 | ===DONE=== 27 | 28 | --EXPECTF-- 29 | Hello World 30 | Hello PHP 31 | ===DONE=== 32 | -------------------------------------------------------------------------------- /tests/apc_bin_001.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | APC: bindump user cache 3 | --SKIPIF-- 4 | 5 | --INI-- 6 | apc.enabled=1 7 | apc.enable_cli=1 8 | --FILE-- 9 | 19 | ===DONE=== 20 | 21 | --EXPECTF-- 22 | bool(false) 23 | string(9) "testvalue" 24 | ===DONE=== 25 | -------------------------------------------------------------------------------- /tests/apc_002.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | APC: apc_store/fetch with objects 3 | --SKIPIF-- 4 | 5 | --INI-- 6 | apc.enabled=1 7 | apc.enable_cli=1 8 | apc.file_update_protection=0 9 | --FILE-- 10 | a = true; 20 | var_dump($bar); 21 | 22 | ?> 23 | ===DONE=== 24 | 25 | --EXPECTF-- 26 | object(foo)#%d (0) { 27 | } 28 | object(foo)#%d (0) { 29 | } 30 | object(foo)#%d (1) { 31 | ["a"]=> 32 | bool(true) 33 | } 34 | ===DONE=== 35 | -------------------------------------------------------------------------------- /tests/symfony/Symfony/Component/EventDispatcher/EventDispatcherInterface.php: -------------------------------------------------------------------------------- 1 | response; 14 | } 15 | 16 | public function setResponse(Response $response) 17 | { 18 | $this->response = $response; 19 | 20 | $this->stopPropagation(); 21 | } 22 | 23 | public function hasResponse() 24 | { 25 | return null !== $this->response; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /tests/symfony/symfony_tests.inc: -------------------------------------------------------------------------------- 1 | 18 | -------------------------------------------------------------------------------- /tests/apc_001.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | APC: apc_store/fetch with strings 3 | --SKIPIF-- 4 | 5 | --INI-- 6 | apc.enabled=1 7 | apc.enable_cli=1 8 | apc.file_update_protection=0 9 | --FILE-- 10 | 25 | ===DONE=== 26 | 27 | --EXPECTF-- 28 | string(11) "hello world" 29 | string(11) "hello world" 30 | string(4) "nice" 31 | string(11) "hello world" 32 | ===DONE=== 33 | -------------------------------------------------------------------------------- /tests/apc53_001.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | APC: classes with namespaces (php 5.3) 3 | --SKIPIF-- 4 | 10 | --INI-- 11 | apc.enabled=1 12 | apc.enable_cli=1 13 | apc.file_update_protection=0 14 | --FILE-- 15 | 22 | ===DONE=== 23 | 24 | --EXPECTF-- 25 | object(Foo\Bar\Baz)#1 (3) { 26 | ["i"]=> 27 | int(1) 28 | ["f":protected]=> 29 | float(3.14) 30 | ["s":"Foo\Bar\Baz":private]=> 31 | string(11) "hello world" 32 | } 33 | ===DONE=== 34 | -------------------------------------------------------------------------------- /tests/apc53_004.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | APC: closures (php 5.3) 3 | --SKIPIF-- 4 | 10 | --INI-- 11 | apc.enabled=1 12 | apc.enable_cli=1 13 | apc.file_update_protection=0 14 | --FILE-- 15 | 28 | ===DONE=== 29 | 30 | --EXPECTF-- 31 | double of 9 is 18 32 | triple of 4 is 12 33 | ===DONE=== 34 | -------------------------------------------------------------------------------- /tests/iterator_007.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | APC: APCIterator Overwriting the ctor 3 | --SKIPIF-- 4 | 5 | --INI-- 6 | apc.enabled=1 7 | apc.enable_cli=1 8 | --FILE-- 9 | rewind(), 16 | $obj->current(), 17 | $obj->key(), 18 | $obj->next(), 19 | $obj->valid(), 20 | $obj->getTotalHits(), 21 | $obj->getTotalSize(), 22 | $obj->getTotalCount(), 23 | apc_delete($obj) 24 | ); 25 | ?> 26 | --EXPECTF-- 27 | bool(false) 28 | bool(false) 29 | bool(false) 30 | bool(false) 31 | bool(false) 32 | bool(false) 33 | bool(false) 34 | bool(false) 35 | bool(false) 36 | -------------------------------------------------------------------------------- /tests/iterator_002.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | APC: APCIterator regex 3 | --SKIPIF-- 4 | 5 | --INI-- 6 | apc.enabled=1 7 | apc.enable_cli=1 8 | apc.file_update_protection=0 9 | --FILE-- 10 | $value) { 17 | $vals[$key] = $value['key']; 18 | } 19 | ksort($vals); 20 | var_dump($vals); 21 | 22 | ?> 23 | ===DONE=== 24 | 25 | --EXPECT-- 26 | array(4) { 27 | ["key10"]=> 28 | string(5) "key10" 29 | ["key20"]=> 30 | string(5) "key20" 31 | ["key30"]=> 32 | string(5) "key30" 33 | ["key40"]=> 34 | string(5) "key40" 35 | } 36 | ===DONE=== 37 | -------------------------------------------------------------------------------- /tests/bug63434.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Bug #63434 (Segfault if apc.shm_strings_buffer excceed apc.shm_size) 3 | --SKIPIF-- 4 | 7 | --INI-- 8 | apc.enabled=1 9 | apc.enable_cli=1 10 | apc.shm_size=1M 11 | apc.shm_strings_buffer=2M 12 | --FILE-- 13 | 'xxxx'); ?>"); 16 | include $tmp; 17 | 18 | echo "okey"; 19 | ?> 20 | --CLEAN-- 21 | 24 | --EXPECT-- 25 | PHP Warning: PHP Startup: apc.shm_strings_buffer '2097152' exceed apc.shm_size '1048576' in Unknown on line 0 26 | 27 | Warning: PHP Startup: apc.shm_strings_buffer '2097152' exceed apc.shm_size '1048576' in Unknown on line 0 28 | okey 29 | -------------------------------------------------------------------------------- /tests/iterator_004.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | APC: APCIterator regex & chunk size & list 3 | --SKIPIF-- 4 | 5 | --INI-- 6 | apc.enabled=1 7 | apc.enable_cli=1 8 | apc.file_update_protection=0 9 | --FILE-- 10 | $value) { 17 | $vals[$key] = $value['key']; 18 | } 19 | ksort($vals); 20 | var_dump($vals); 21 | 22 | ?> 23 | ===DONE=== 24 | 25 | --EXPECT-- 26 | array(4) { 27 | ["key10"]=> 28 | string(5) "key10" 29 | ["key20"]=> 30 | string(5) "key20" 31 | ["key30"]=> 32 | string(5) "key30" 33 | ["key40"]=> 34 | string(5) "key40" 35 | } 36 | ===DONE=== 37 | -------------------------------------------------------------------------------- /tests/apc53_002.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | APC: global spaces (php 5.3) 3 | --SKIPIF-- 4 | 10 | --INI-- 11 | apc.enabled=1 12 | apc.enable_cli=1 13 | apc.file_update_protection=0 14 | --FILE-- 15 | foo(); 21 | var_dump(Foo\Bar\sort()); 22 | ?> 23 | ===DONE=== 24 | 25 | --EXPECTF-- 26 | array(4) { 27 | [0]=> 28 | int(1) 29 | [1]=> 30 | int(2) 31 | [2]=> 32 | int(3) 33 | [3]=> 34 | int(4) 35 | } 36 | array(4) { 37 | [0]=> 38 | int(1) 39 | [1]=> 40 | int(2) 41 | [2]=> 42 | int(3) 43 | [3]=> 44 | int(4) 45 | } 46 | string(8) "IT WORKS" 47 | ===DONE=== 48 | -------------------------------------------------------------------------------- /tests/symfony/vendor/autoload.php: -------------------------------------------------------------------------------- 1 | $path) { 14 | $loader->add($namespace, $path); 15 | } 16 | 17 | $classMap = require $composerDir . '/autoload_classmap.php'; 18 | if ($classMap) { 19 | $loader->addClassMap($classMap); 20 | } 21 | 22 | $loader->register(); 23 | 24 | //require __DIR__ . '/swiftmailer/swiftmailer/lib/swift_required.php'; 25 | 26 | return $loader; 27 | }); 28 | -------------------------------------------------------------------------------- /tests/apc_004.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | APC: apc_store/fetch with bools 3 | --SKIPIF-- 4 | 5 | --INI-- 6 | apc.enabled=1 7 | apc.enable_cli=1 8 | apc.file_update_protection=0 9 | --FILE-- 10 | 28 | ===DONE=== 29 | 30 | --EXPECTF-- 31 | bool(false) 32 | bool(false) 33 | bool(false) 34 | bool(true) 35 | bool(false) 36 | bool(false) 37 | bool(false) 38 | ===DONE=== 39 | -------------------------------------------------------------------------------- /tests/bug62802.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Bug #62802 (Crash when use apc_bin_dump/load) 3 | --SKIPIF-- 4 | 30 | --CLEAN-- 31 | 34 | --EXPECT-- 35 | string(3) "uuu" 36 | -------------------------------------------------------------------------------- /tests/symfony/Symfony/Component/HttpKernel/Event/FilterResponseEvent.php: -------------------------------------------------------------------------------- 1 | setResponse($response); 18 | } 19 | 20 | public function getResponse() 21 | { 22 | return $this->response; 23 | } 24 | 25 | public function setResponse(Response $response) 26 | { 27 | $this->response = $response; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /tests/apc_005.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | APC: apc_store/fetch with arrays of objects 3 | --SKIPIF-- 4 | 5 | --INI-- 6 | apc.enabled=1 7 | apc.enable_cli=1 8 | apc.file_update_protection=0 9 | --FILE-- 10 | 23 | ===DONE=== 24 | 25 | --EXPECTF-- 26 | array(2) { 27 | [0]=> 28 | object(stdClass)#1 (0) { 29 | } 30 | [1]=> 31 | object(stdClass)#2 (0) { 32 | } 33 | } 34 | array(2) { 35 | [0]=> 36 | object(stdClass)#1 (0) { 37 | } 38 | [1]=> 39 | object(stdClass)#2 (0) { 40 | } 41 | } 42 | array(2) { 43 | [0]=> 44 | object(stdClass)#3 (0) { 45 | } 46 | [1]=> 47 | object(stdClass)#4 (0) { 48 | } 49 | } 50 | ===DONE=== 51 | -------------------------------------------------------------------------------- /tests/symfony/Symfony/Component/EventDispatcher/Event.php: -------------------------------------------------------------------------------- 1 | propagationStopped; 14 | } 15 | 16 | public function stopPropagation() 17 | { 18 | $this->propagationStopped = true; 19 | } 20 | 21 | public function setDispatcher(EventDispatcher $dispatcher) 22 | { 23 | $this->dispatcher = $dispatcher; 24 | } 25 | 26 | public function getDispatcher() 27 | { 28 | return $this->dispatcher; 29 | } 30 | 31 | public function getName() 32 | { 33 | return $this->name; 34 | } 35 | 36 | public function setName($name) 37 | { 38 | $this->name = $name; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /tests/symfony/Symfony/Component/HttpKernel/Event/KernelEvent.php: -------------------------------------------------------------------------------- 1 | kernel = $kernel; 18 | $this->request = $request; 19 | $this->requestType = $requestType; 20 | } 21 | 22 | public function getKernel() 23 | { 24 | return $this->kernel; 25 | } 26 | 27 | public function getRequest() 28 | { 29 | return $this->request; 30 | } 31 | 32 | public function getRequestType() 33 | { 34 | return $this->requestType; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /tests/apc54_003.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | APC: Bug #62190 Couldn't fetch DOMProcessingInstruction with APC and native obj (php 5.4 nts) 3 | --SKIPIF-- 4 | loadHTML(''); 16 | echo "{\$node->firstChild->nextSibling->nodeType}\n"; 17 | FL; 18 | 19 | $args = array( 20 | 'apc.enabled=1', 21 | 'apc.enable_cli=1', 22 | 'apc.stat=0', 23 | ); 24 | 25 | server_start($file, $args); 26 | 27 | for ($i = 0; $i < 10; $i++) { 28 | run_test_simple(); 29 | } 30 | echo 'done'; 31 | 32 | 33 | --EXPECT-- 34 | 7 35 | 7 36 | 7 37 | 7 38 | 7 39 | 7 40 | 7 41 | 7 42 | 7 43 | 7 44 | 7 45 | 7 46 | 7 47 | 7 48 | 7 49 | 7 50 | 7 51 | 7 52 | 7 53 | 7 54 | 7 55 | 7 56 | 7 57 | 7 58 | 7 59 | 7 60 | 7 61 | 7 62 | 7 63 | 7 64 | done 65 | -------------------------------------------------------------------------------- /tests/bug62765.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Bug #62765 (apc_bin_dumpfile report Fatal error when there is "goto" in function) 3 | --INI-- 4 | apc.enabled=1 5 | apc.enable_cli=1 6 | apc.stat=0 7 | apc.cache_by_default=1 8 | apc.filters= 9 | report_memleaks=0 10 | --FILE-- 11 | 35 | --CLEAN-- 36 | 40 | --EXPECT-- 41 | 22 42 | okey 43 | -------------------------------------------------------------------------------- /tests/apc_008.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | APC: apc_cas test 3 | --SKIPIF-- 4 | 5 | --INI-- 6 | apc.enabled=1 7 | apc.enable_cli=1 8 | apc.file_update_protection=0 9 | --FILE-- 10 | 24 | ===DONE=== 25 | 26 | --EXPECTF-- 27 | $foobar = 2 28 | $foobar == 1 ? 2 : 1 = fail 29 | $foobar == 2 ? 1 : 2 = ok 30 | $foobar = 1 31 | $f__bar == 1 ? 2 : 1 = fail 32 | $perfection == 2 ? 1 : 2 = epic fail 33 | $foobar = 1 34 | ===DONE=== 35 | -------------------------------------------------------------------------------- /tests/apc54_012.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | APC: Bug #61164 Crash with $_SERVER and ?: operator (php 5.4) 3 | --SKIPIF-- 4 | executableFinder = new PhpExecutableFinder(); 14 | } 15 | 16 | public function setPhpBinary($php) 17 | { 18 | $this->setCommandLine($php); 19 | } 20 | 21 | public function run($callback = null) 22 | { 23 | if (null === $this->getCommandLine()) { 24 | if (false === $php = $this->executableFinder->find()) { 25 | throw new \RuntimeException('Unable to find the PHP executable.'); 26 | } 27 | $this->setCommandLine($php); 28 | } 29 | 30 | return parent::run($callback); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /tests/symfony/Symfony/Component/HttpKernel/Tests/TestHttpKernel.php: -------------------------------------------------------------------------------- 1 | getRequestUri()); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /tests/symfony/symfony_httpkernel1.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Symfony HttpKernel ClientTest#testGetScript 3 | --SKIPIF-- 4 | insulate(); 28 | $client->request('GET', '/'); 29 | 30 | echo "== didn't crash ==".PHP_EOL; 31 | 32 | ?> 33 | --EXPECT-- 34 | == didn't crash == 35 | -------------------------------------------------------------------------------- /tests/bug38779.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Bug #61398 APC fails to find class methods on user stream wrappers 3 | --SKIPIF-- 4 | 34 | --EXPECT-- 35 | hello 36 | hello 37 | hello 38 | hello 39 | hello 40 | hello 41 | hello 42 | hello 43 | hello 44 | hello 45 | hello 46 | hello 47 | hello 48 | hello 49 | hello 50 | hello 51 | hello 52 | hello 53 | hello 54 | hello 55 | hello 56 | hello 57 | hello 58 | hello 59 | hello 60 | hello 61 | hello 62 | hello 63 | hello 64 | hello 65 | done 66 | -------------------------------------------------------------------------------- /tests/bug62825.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Bug #62825 (php carshed OR return PHP Fatal error when used apc_bin_dump after apc_store) 3 | --SKIPIF-- 4 | 5 | --INI-- 6 | apc.enabled=1 7 | apc.enable_cli=1 8 | report_memleaks=0 9 | --FILE-- 10 | array())); 13 | apc_store('k3', array('foo' => new StdClass())); 14 | $obj = new StdClass(); 15 | $obj->name = array('foo'); 16 | apc_store('k4', $obj); 17 | apc_store('k5', NULL); 18 | apc_store('k6', 0.5); 19 | apc_store('k7', 123456); 20 | $dump = apc_bin_dump(array(), NULL); 21 | apc_clear_cache(); 22 | var_dump(apc_fetch('testkey')); 23 | apc_bin_load($dump, APC_BIN_VERIFY_MD5 | APC_BIN_VERIFY_CRC32); 24 | foreach(range(1, 7) as $i) { 25 | var_dump(apc_fetch("k" . $i)); 26 | } 27 | ?> 28 | --EXPECTF-- 29 | bool(false) 30 | string(9) "testvalue" 31 | array(1) { 32 | ["foo"]=> 33 | array(0) { 34 | } 35 | } 36 | array(1) { 37 | ["foo"]=> 38 | object(stdClass)#%d (0) { 39 | } 40 | } 41 | object(stdClass)#%d (1) { 42 | ["name"]=> 43 | array(1) { 44 | [0]=> 45 | string(3) "foo" 46 | } 47 | } 48 | NULL 49 | float(0.5) 50 | int(123456) 51 | -------------------------------------------------------------------------------- /tests/symfony/Symfony/Component/Process/PhpExecutableFinder.php: -------------------------------------------------------------------------------- 1 | executableFinder = new ExecutableFinder(); 12 | } 13 | 14 | public function find() 15 | { 16 | // PHP_BINARY return the current sapi executable 17 | if (defined('PHP_BINARY') && PHP_BINARY && ('cli' === PHP_SAPI)) { 18 | return PHP_BINARY; 19 | } 20 | 21 | if ($php = getenv('PHP_PATH')) { 22 | if (!is_executable($php)) { 23 | return false; 24 | } 25 | 26 | return $php; 27 | } 28 | 29 | if ($php = getenv('PHP_PEAR_PHP_BIN')) { 30 | if (is_executable($php)) { 31 | return $php; 32 | } 33 | } 34 | 35 | $dirs = array(PHP_BINDIR); 36 | if (defined('PHP_WINDOWS_VERSION_BUILD')) { 37 | $dirs[] = 'C:\xampp\php\\'; 38 | } 39 | 40 | return $this->executableFinder->find('php', false, $dirs); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /tests/apc54_007.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | APC: bug #62302 apc.include_once_override=1 made everything crash 3 | --SKIPIF-- 4 | bark(); 26 | FL; 27 | 28 | $args = array( 29 | 'apc.enabled=1', 30 | 'apc.enable_cli=1', 31 | ); 32 | 33 | server_start($file, $args); 34 | 35 | for ($i = 0; $i < 10; $i++) { 36 | run_test_simple(); 37 | } 38 | echo 'done'; 39 | 40 | --EXPECT-- 41 | woof! 42 | woof! 43 | woof! 44 | woof! 45 | woof! 46 | woof! 47 | woof! 48 | woof! 49 | woof! 50 | woof! 51 | woof! 52 | woof! 53 | woof! 54 | woof! 55 | woof! 56 | woof! 57 | woof! 58 | woof! 59 | woof! 60 | woof! 61 | woof! 62 | woof! 63 | woof! 64 | woof! 65 | woof! 66 | woof! 67 | woof! 68 | woof! 69 | woof! 70 | woof! 71 | done 72 | -------------------------------------------------------------------------------- /tests/apc_007.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | APC: apc_inc/apc_dec test 3 | --SKIPIF-- 4 | 5 | --INI-- 6 | apc.enabled=1 7 | apc.enable_cli=1 8 | apc.file_update_protection=0 9 | --FILE-- 10 | 32 | ===DONE=== 33 | 34 | --EXPECTF-- 35 | $foobar = 2 36 | $foobar += 1 = 3 37 | $foobar += 10 = 13 38 | $foobar -= 1 = 12 39 | $foobar -= 10 = 2 40 | $f__bar += 1 = fail 41 | $perfection -= 1 = epic fail 42 | $foobar += 1 = 3 43 | pass by ref success 1 44 | $foobar -= 1 = 2 45 | pass by ref success 1 46 | ===DONE=== 47 | -------------------------------------------------------------------------------- /tests/bug62757.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Bug #62757 (php-fpm carshed when used apc_bin_dumpfile with apc.serializer) 3 | --INI-- 4 | apc.enabled=1 5 | apc.enable_cli=1 6 | apc.stat=0 7 | apc.cache_by_default=1 8 | apc.serializer=php 9 | report_memleaks=0 10 | --FILE-- 11 | array() ); 21 | protected $str = "constant string"; 22 | public function test() { 23 | var_dump($this->str); 24 | return $this->arr; 25 | } 26 | } 27 | '; 28 | file_put_contents($filename, $file_contents); 29 | apc_compile_file($filename); 30 | apc_bin_dumpfile(array($filename), null, $bin_filename); 31 | apc_clear_cache(); 32 | apc_bin_loadfile($bin_filename); 33 | include $filename; 34 | 35 | var_dump(test()); 36 | $lib = new ApiLib(); 37 | var_dump($lib->test()); 38 | echo "okey\n"; 39 | ?> 40 | --CLEAN-- 41 | 45 | --EXPECT-- 46 | array(0) { 47 | } 48 | string(15) "constant string" 49 | array(1) { 50 | ["abcd"]=> 51 | array(0) { 52 | } 53 | } 54 | okey 55 | -------------------------------------------------------------------------------- /tests/apc54_001.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | APC: bug #62398 (php 5.4) 3 | --SKIPIF-- 4 | = 5.4'); 8 | } 9 | --FILE-- 10 | test()); 31 | FL; 32 | 33 | $args = array( 34 | 'apc.enabled=1', 35 | 'apc.cache_by_default=1', 36 | 'apc.enable_cli=1', 37 | 'apc.shm_segments=1', 38 | 'apc.optimization=0', 39 | 'apc.ttl=0', 40 | 'apc.user_ttl=0', 41 | 'apc.num_files_hint=4096', 42 | 'apc.canonicalize=0', 43 | 'apc.write_lock=1', 44 | ); 45 | 46 | server_start($file, $args); 47 | 48 | for ($i = 0; $i < 10; $i++) { 49 | run_test_simple(); 50 | } 51 | echo 'done'; 52 | --EXPECTF-- 53 | int(2) 54 | int(2) 55 | int(2) 56 | int(2) 57 | int(2) 58 | int(2) 59 | int(2) 60 | int(2) 61 | int(2) 62 | int(2) 63 | int(2) 64 | int(2) 65 | int(2) 66 | int(2) 67 | int(2) 68 | int(2) 69 | int(2) 70 | int(2) 71 | int(2) 72 | int(2) 73 | int(2) 74 | int(2) 75 | int(2) 76 | int(2) 77 | int(2) 78 | int(2) 79 | int(2) 80 | int(2) 81 | int(2) 82 | int(2) 83 | done 84 | -------------------------------------------------------------------------------- /tests/apc_006.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | APC: apc_store/fetch reference test 3 | --SKIPIF-- 4 | 5 | --INI-- 6 | apc.enabled=1 7 | apc.enable_cli=1 8 | apc.file_update_protection=0 9 | apc.serializer=default 10 | report_memleaks=0 11 | --FILE-- 12 | 34 | ===DONE=== 35 | 36 | --EXPECTF-- 37 | array(9) refcount(2){ 38 | [0]=> 39 | string(1) "a" refcount(1) 40 | [1]=> 41 | &array(1) refcount(2){ 42 | [0]=> 43 | string(1) "c" refcount(1) 44 | } 45 | [2]=> 46 | &array(1) refcount(2){ 47 | [0]=> 48 | string(1) "c" refcount(1) 49 | } 50 | [3]=> 51 | &string(1) "d" refcount(3) 52 | [4]=> 53 | &string(1) "d" refcount(3) 54 | [5]=> 55 | &string(1) "d" refcount(3) 56 | [6]=> 57 | string(1) "e" refcount(2) 58 | [7]=> 59 | string(1) "e" refcount(2) 60 | [8]=> 61 | &array(2) refcount(2){ 62 | [0]=> 63 | string(1) "f" refcount(1) 64 | [1]=> 65 | &array(2) refcount(2){ 66 | [0]=> 67 | string(1) "f" refcount(1) 68 | [1]=> 69 | *RECURSION* 70 | } 71 | } 72 | } 73 | ===DONE=== 74 | -------------------------------------------------------------------------------- /tests/apc_bin_002.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | APC: bindump file cache part 1 3 | --SKIPIF-- 4 | 5 | --INI-- 6 | apc.enabled=1 7 | apc.enable_cli=1 8 | apc.stat=0 9 | apc.cache_by_default=1 10 | apc.filters= 11 | report_memleaks = Off 12 | --FILE-- 13 | 32 | ===DONE=== 33 | 34 | --EXPECTF-- 35 | apc bindump 002 test 36 | 37 | global scope execution: Success 38 | 39 | function execution: Success 40 | 41 | class static method: Success 42 | class dynamic method: Success 43 | class static property: Success 44 | class dynamic property: Success 45 | class constant: Success 46 | 47 | inherited class static method: Success 48 | inherited class dynamic method: Success 49 | inherited class static property: Success 50 | inherited class dynamic property: Success 51 | inherited class constant: Success 52 | 53 | ===DONE=== 54 | -------------------------------------------------------------------------------- /tests/apc54_011.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | APC: Bug #61219 method not found on 2nd request (php 5.4) 3 | --SKIPIF-- 4 | testme(\$p); 21 | } 22 | 23 | function testme(\$p) 24 | { 25 | echo "testme \$p\n"; 26 | } 27 | } 28 | 29 | \$h = new hello(\$there); 30 | FL; 31 | 32 | $args = array( 33 | 'apc.enabled=1', 34 | 'apc.cache_by_default=1', 35 | 'apc.enable_cli=1', 36 | 'apc.slam_defense=0', 37 | 'apc.write_lock=1', 38 | ); 39 | 40 | server_start($file, $args); 41 | 42 | for ($i = 0; $i < 10; $i++) { 43 | run_test_simple(); 44 | } 45 | echo 'done'; 46 | --EXPECT-- 47 | testme world 48 | testme world 49 | testme world 50 | testme world 51 | testme world 52 | testme world 53 | testme world 54 | testme world 55 | testme world 56 | testme world 57 | testme world 58 | testme world 59 | testme world 60 | testme world 61 | testme world 62 | testme world 63 | testme world 64 | testme world 65 | testme world 66 | testme world 67 | testme world 68 | testme world 69 | testme world 70 | testme world 71 | testme world 72 | testme world 73 | testme world 74 | testme world 75 | testme world 76 | testme world 77 | done 78 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | Known Bugs 2 | 3 | 1. Gallery2 doesn't work with PHP5+APC. There is something wrong 4 | with the way methods are restored in some edge case I haven't 5 | been able to figure out yet. 6 | To reproduce install gallery2 and click down to an individual photo. 7 | 8 | 2. apc_store() probably needs some checks to skip trying to store 9 | internal classes. Something along the lines of: 10 | 11 | if(Z_TYPE_P(val) == IS_OBJECT) { 12 | zend_class_entry *ce = Z_OBJCE_P(val); 13 | if(ce->type == ZEND_INTERNAL_CLASS) { 14 | php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot cache internal objects"); 15 | RETURN_FALSE; 16 | } 17 | } 18 | 19 | in the apc_store() function in php_apc.c but I am wondering if it needs to do more 20 | than that. 21 | 22 | Windows 23 | 24 | 1. The following configurations (build arguments) have not been implemented yet 25 | 26 | (*) --enable-apc-mmap Memory mapping support 27 | (*) --enable-apc-sem Semaphore locking support (FCNTL replacement) 28 | (*) --enable-apc-phreadmutex Thread mutexes, while implemented we should probably rename the internals to thread 29 | (*) --enable-apc-pthreadrwlocks Thread mutexes, read/write locking 30 | 31 | 2. Non-blocking locks is not supported either 32 | 33 | 3. Update fileinfo to support stat info in a more portable way (see PECL #17903) 34 | 35 | 4. Check whether the signal handling needs to be enabled, and if it makes sense on Windows 36 | -------------------------------------------------------------------------------- /tests/symfony/Symfony/Component/BrowserKit/Request.php: -------------------------------------------------------------------------------- 1 | uri = $uri; 18 | $this->method = $method; 19 | $this->parameters = $parameters; 20 | $this->files = $files; 21 | $this->cookies = $cookies; 22 | $this->server = $server; 23 | $this->content = $content; 24 | } 25 | 26 | public function getUri() 27 | { 28 | return $this->uri; 29 | } 30 | 31 | public function getMethod() 32 | { 33 | return $this->method; 34 | } 35 | 36 | public function getParameters() 37 | { 38 | return $this->parameters; 39 | } 40 | 41 | public function getFiles() 42 | { 43 | return $this->files; 44 | } 45 | 46 | public function getCookies() 47 | { 48 | return $this->cookies; 49 | } 50 | 51 | public function getServer() 52 | { 53 | return $this->server; 54 | } 55 | 56 | public function getContent() 57 | { 58 | return $this->content; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /tests/apc_bin_002-1.inc: -------------------------------------------------------------------------------- 1 | my_method()."\n"; 15 | echo "class static property: ".my_class::$my_static_property."\n"; 16 | echo "class dynamic property: ".$my_class->my_property."\n"; 17 | echo "class constant: ".my_class::my_constant."\n"; 18 | echo "\n"; 19 | echo "inherited class static method: ".my_i_class::my_static_method()."\n"; 20 | echo "inherited class dynamic method: ".$my_i_class->my_method()."\n"; 21 | echo "inherited class static property: ".my_i_class::$my_static_property."\n"; 22 | echo "inherited class dynamic property: ".$my_i_class->my_property."\n"; 23 | echo "inherited class constant: ".my_i_class::my_constant."\n"; 24 | echo "\n"; 25 | 26 | 27 | 28 | function my_function() { return "Success"; } 29 | 30 | 31 | class my_class { 32 | static $my_static_property = "Success"; 33 | var $my_property = "Success"; 34 | const my_constant = "Success"; 35 | static function my_static_method() { return "Success"; } 36 | function my_method() { return "Success"; } 37 | } 38 | 39 | class my_i_class extends my_class { 40 | function dummy() { return 1; } 41 | } 42 | -------------------------------------------------------------------------------- /tests/symfony/Symfony/Component/HttpFoundation/RedirectResponse.php: -------------------------------------------------------------------------------- 1 | targetUrl = $url; 16 | 17 | parent::__construct( 18 | sprintf(' 19 | 20 | 21 | 22 | 23 | 24 | Redirecting to %1$s 25 | 26 | 27 | Redirecting to %1$s. 28 | 29 | ', htmlspecialchars($url, ENT_QUOTES, 'UTF-8')), 30 | $status, 31 | array_merge($headers, array('Location' => $url)) 32 | ); 33 | 34 | if (!$this->isRedirect()) { 35 | throw new \InvalidArgumentException(sprintf('The HTTP status code is not a redirect ("%s" given).', $status)); 36 | } 37 | } 38 | 39 | public static function create($url = '', $status = 302, $headers = array()) 40 | { 41 | return new static($url, $status, $headers); 42 | } 43 | 44 | public function getTargetUrl() 45 | { 46 | return $this->targetUrl; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /tests/symfony/Symfony/Component/BrowserKit/History.php: -------------------------------------------------------------------------------- 1 | clear(); 13 | } 14 | 15 | public function clear() 16 | { 17 | $this->stack = array(); 18 | $this->position = -1; 19 | } 20 | 21 | public function add(Request $request) 22 | { 23 | $this->stack = array_slice($this->stack, 0, $this->position + 1); 24 | $this->stack[] = clone $request; 25 | $this->position = count($this->stack) - 1; 26 | } 27 | 28 | public function isEmpty() 29 | { 30 | return count($this->stack) == 0; 31 | } 32 | 33 | public function back() 34 | { 35 | if ($this->position < 1) { 36 | throw new \LogicException('You are already on the first page.'); 37 | } 38 | 39 | return clone $this->stack[--$this->position]; 40 | } 41 | 42 | public function forward() 43 | { 44 | if ($this->position > count($this->stack) - 2) { 45 | throw new \LogicException('You are already on the last page.'); 46 | } 47 | 48 | return clone $this->stack[++$this->position]; 49 | } 50 | 51 | public function current() 52 | { 53 | if (-1 == $this->position) { 54 | throw new \LogicException('The page history is empty.'); 55 | } 56 | 57 | return clone $this->stack[$this->position]; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /tests/bug65405.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | APC fails to propagate $GLOBALS when auto_globals_jit=Off 3 | --SKIPIF-- 4 | 58 | --CLEAN-- 59 | 62 | --EXPECT-- 63 | first request 64 | bar 65 | bar 66 | bar 67 | baz 68 | baz 69 | baz 70 | second request 71 | bar 72 | bar 73 | bar 74 | baz 75 | baz 76 | baz 77 | done 78 | -------------------------------------------------------------------------------- /tests/apc_010.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | APC: apc_store/fetch/add with array of key/value pairs. 3 | --SKIPIF-- 4 | 5 | --INI-- 6 | apc.enabled=1 7 | apc.enable_cli=1 8 | apc.file_update_protection=0 9 | --FILE-- 10 | 31 | ===DONE=== 32 | 33 | --EXPECTF-- 34 | array(0) { 35 | } 36 | array(4) { 37 | ["key1"]=> 38 | string(6) "value1" 39 | ["key2"]=> 40 | string(6) "value2" 41 | ["key3"]=> 42 | array(2) { 43 | [0]=> 44 | string(7) "value3a" 45 | [1]=> 46 | string(7) "value3b" 47 | } 48 | ["key4"]=> 49 | int(4) 50 | } 51 | array(2) { 52 | ["key1"]=> 53 | string(6) "value1" 54 | ["key3"]=> 55 | array(2) { 56 | [0]=> 57 | string(7) "value3a" 58 | [1]=> 59 | string(7) "value3b" 60 | } 61 | } 62 | array(2) { 63 | ["key1"]=> 64 | int(-1) 65 | ["key3"]=> 66 | int(-1) 67 | } 68 | array(4) { 69 | ["key1"]=> 70 | string(6) "value1" 71 | ["key2"]=> 72 | string(6) "value2" 73 | ["key3"]=> 74 | array(2) { 75 | [0]=> 76 | string(7) "value3a" 77 | [1]=> 78 | string(7) "value3b" 79 | } 80 | ["key4"]=> 81 | int(4) 82 | } 83 | ===DONE=== 84 | -------------------------------------------------------------------------------- /tests/symfony/vendor/composer/autoload_namespaces.php: -------------------------------------------------------------------------------- 1 | $vendorDir . '/twig/extensions/lib/', 10 | 'Twig_' => $vendorDir . '/twig/twig/lib/', 11 | 'Symfony\\Bundle\\SwiftmailerBundle' => $vendorDir . '/symfony/swiftmailer-bundle/', 12 | 'Symfony\\Bundle\\MonologBundle' => $vendorDir . '/symfony/monolog-bundle/', 13 | 'Symfony\\Bundle\\AsseticBundle' => $vendorDir . '/symfony/assetic-bundle/', 14 | 'Symfony' => $baseDir,//$vendorDir . '/symfony/symfony/src/', 15 | 'SessionHandlerInterface' => $vendorDir . '/symfony/symfony/src/Symfony/Component/HttpFoundation/Resources/stubs', 16 | 'Sensio\\Bundle\\GeneratorBundle' => $vendorDir . '/sensio/generator-bundle/', 17 | 'Sensio\\Bundle\\FrameworkExtraBundle' => $vendorDir . '/sensio/framework-extra-bundle/', 18 | 'Sensio\\Bundle\\DistributionBundle' => $vendorDir . '/sensio/distribution-bundle/', 19 | 'Monolog' => $vendorDir . '/monolog/monolog/src/', 20 | 'Metadata\\' => $vendorDir . '/jms/metadata/src/', 21 | 'JMS\\SecurityExtraBundle' => $vendorDir . '/jms/security-extra-bundle/', 22 | 'JMS\\DiExtraBundle' => $vendorDir . '/jms/di-extra-bundle/', 23 | 'JMS\\AopBundle' => $vendorDir . '/jms/aop-bundle/', 24 | 'Doctrine\\ORM' => $vendorDir . '/doctrine/orm/lib/', 25 | 'Doctrine\\DBAL' => $vendorDir . '/doctrine/dbal/lib/', 26 | 'Doctrine\\Common' => $vendorDir . '/doctrine/common/lib/', 27 | 'Doctrine\\Bundle\\DoctrineBundle' => $vendorDir . '/doctrine/doctrine-bundle/', 28 | 'CG\\' => $vendorDir . '/jms/cg/src/', 29 | 'Assetic' => $vendorDir . '/kriswallsmith/assetic/src/', 30 | '' => $baseDir . '/src/', 31 | ); 32 | -------------------------------------------------------------------------------- /apc_debug.h: -------------------------------------------------------------------------------- 1 | /* 2 | +----------------------------------------------------------------------+ 3 | | APC | 4 | +----------------------------------------------------------------------+ 5 | | Copyright (c) 2006-2011 The PHP Group | 6 | +----------------------------------------------------------------------+ 7 | | This source file is subject to version 3.01 of the PHP license, | 8 | | that is bundled with this package in the file LICENSE, and is | 9 | | available through the world-wide-web at the following url: | 10 | | http://www.php.net/license/3_01.txt | 11 | | If you did not receive a copy of the PHP license and are unable to | 12 | | obtain it through the world-wide-web, please send a note to | 13 | | license@php.net so we can mail you a copy immediately. | 14 | +----------------------------------------------------------------------+ 15 | | Authors: Daniel Cowgill | 16 | | Arun C. Murthy | 17 | | Gopal Vijayaraghavan | 18 | +----------------------------------------------------------------------+ 19 | 20 | This software was contributed to PHP by Community Connect Inc. in 2002 21 | and revised in 2005 by Yahoo! Inc. to add support for PHP 5.1. 22 | Future revisions and derivatives of this source code must acknowledge 23 | Community Connect Inc. as the original contributor of this module by 24 | leaving this note intact in the source code. 25 | 26 | All other licensing and usage conditions are those of the PHP Group. 27 | */ 28 | 29 | void dump(zend_op_array * TSRMLS_DC); 30 | -------------------------------------------------------------------------------- /tests/symfony/symfony_process1.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Symfony ProcessTest#testCallbackIsExecutedForOutput 3 | --SKIPIF-- 4 | run(function ($type, $buffer) use (&$called) { 56 | $called = $buffer === 'foo'; 57 | }); 58 | 59 | assertTrue($called); 60 | 61 | 62 | echo "== didn't crash ==".PHP_EOL; 63 | 64 | ?> 65 | --EXPECT-- 66 | == didn't crash == 67 | -------------------------------------------------------------------------------- /apc_spin.h: -------------------------------------------------------------------------------- 1 | /* 2 | +----------------------------------------------------------------------+ 3 | | APC | 4 | +----------------------------------------------------------------------+ 5 | | Copyright (c) 2006-2011 The PHP Group | 6 | +----------------------------------------------------------------------+ 7 | | This source file is subject to version 3.01 of the PHP license, | 8 | | that is bundled with this package in the file LICENSE, and is | 9 | | available through the world-wide-web at the following url: | 10 | | http://www.php.net/license/3_01.txt | 11 | | If you did not receive a copy of the PHP license and are unable to | 12 | | obtain it through the world-wide-web, please send a note to | 13 | | license@php.net so we can mail you a copy immediately. | 14 | +----------------------------------------------------------------------+ 15 | | Authors: Brian Shire | 16 | +----------------------------------------------------------------------+ 17 | 18 | */ 19 | 20 | /* $Id$ */ 21 | 22 | #ifndef APC_SPIN_H 23 | #define APC_SPIN_H 24 | 25 | #include "apc.h" 26 | 27 | #ifdef APC_SPIN_LOCKS 28 | 29 | #include "pgsql_s_lock.h" 30 | 31 | slock_t *apc_slock_create(slock_t *lock); 32 | void apc_slock_destroy(slock_t *lock); 33 | void apc_slock_lock(slock_t *lock TSRMLS_DC); 34 | zend_bool apc_slock_nonblocking_lock(slock_t *lock); 35 | void apc_slock_unlock(slock_t *lock); 36 | 37 | #endif 38 | 39 | #endif 40 | 41 | /* 42 | * Local variables: 43 | * tab-width: 4 44 | * c-basic-offset: 4 45 | * End: 46 | * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker 47 | * vim<600: expandtab sw=4 ts=4 sts=4 48 | */ 49 | -------------------------------------------------------------------------------- /tests/symfony/PHPUnit/Framework/Constraint.php: -------------------------------------------------------------------------------- 1 | matches($other)) { 11 | $success = TRUE; 12 | } 13 | 14 | if ($returnResult) { 15 | return $success; 16 | } 17 | 18 | if (!$success) { 19 | $this->fail($other, $description); 20 | } 21 | } 22 | 23 | protected function matches($other) 24 | { 25 | return FALSE; 26 | } 27 | 28 | public function count() 29 | { 30 | return 1; 31 | } 32 | 33 | protected function fail($other, $description, PHPUnit_Framework_ComparisonFailure $comparisonFailure = NULL) 34 | { 35 | $failureDescription = sprintf( 36 | 'Failed asserting that %s.', 37 | $this->failureDescription($other) 38 | ); 39 | 40 | $additionalFailureDescription = $this->additionalFailureDescription($other); 41 | if ($additionalFailureDescription) { 42 | $failureDescription .= "\n" . $additionalFailureDescription; 43 | } 44 | 45 | if (!empty($description)) { 46 | $failureDescription = $description . "\n" . $failureDescription; 47 | } 48 | 49 | throw new PHPUnit_Framework_ExpectationFailedException( 50 | $failureDescription, 51 | $comparisonFailure 52 | ); 53 | } 54 | 55 | protected function additionalFailureDescription($other) 56 | { 57 | return ""; 58 | } 59 | 60 | protected function failureDescription($other) 61 | { 62 | return PHPUnit_Util_Type::export($other) . ' ' . $this->toString(); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /tests/get_included_files.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Test get_include_files() function (from ext/standard/tests/general_functions/get_included_files.phpt) 3 | --INI-- 4 | include_path=. 5 | apc.enabled=1 6 | apc.cache_by_default=1 7 | apc.enable_cli=1 8 | --FILE-- 9 | 32 | ===DONE=== 33 | --EXPECTF-- 34 | *** Testing get_included_files() 35 | 36 | -- List included files at start -- 37 | array(1) { 38 | [0]=> 39 | string(%d) "%sget_included_files.php" 40 | } 41 | 42 | -- List included files atfter including inc1 - 43 | array(2) { 44 | [0]=> 45 | string(%d) "%sget_included_files.php" 46 | [1]=> 47 | string(%d) "%sget_included_files_inc1.inc" 48 | } 49 | 50 | -- List included files atfter including inc2 which will include inc3 which includes inc1 -- 51 | array(4) { 52 | [0]=> 53 | string(%d) "%sget_included_files.php" 54 | [1]=> 55 | string(%d) "%sget_included_files_inc1.inc" 56 | [2]=> 57 | string(%d) "%sget_included_files_inc2.inc" 58 | [3]=> 59 | string(%d) "%sget_included_files_inc3.inc" 60 | } 61 | 62 | -- Error cases -- 63 | 64 | Warning: get_included_files() expects exactly 0 parameters, 1 given in %s on line %d 65 | NULL 66 | ===DONE=== 67 | -------------------------------------------------------------------------------- /tests/symfony/Symfony/Component/EventDispatcher/GenericEvent.php: -------------------------------------------------------------------------------- 1 | subject = $subject; 12 | $this->arguments = $arguments; 13 | } 14 | 15 | public function getSubject() 16 | { 17 | return $this->subject; 18 | } 19 | 20 | public function getArgument($key) 21 | { 22 | if ($this->hasArgument($key)) { 23 | return $this->arguments[$key]; 24 | } 25 | 26 | throw new \InvalidArgumentException(sprintf('%s not found in %s', $key, $this->getName())); 27 | } 28 | 29 | public function setArgument($key, $value) 30 | { 31 | $this->arguments[$key] = $value; 32 | 33 | return $this; 34 | } 35 | 36 | public function getArguments() 37 | { 38 | return $this->arguments; 39 | } 40 | 41 | public function setArguments(array $args = array()) 42 | { 43 | $this->arguments = $args; 44 | 45 | return $this; 46 | } 47 | 48 | public function hasArgument($key) 49 | { 50 | return array_key_exists($key, $this->arguments); 51 | } 52 | 53 | public function offsetGet($key) 54 | { 55 | return $this->getArgument($key); 56 | } 57 | 58 | public function offsetSet($key, $value) 59 | { 60 | $this->setArgument($key, $value); 61 | } 62 | 63 | public function offsetUnset($key) 64 | { 65 | if ($this->hasArgument($key)) { 66 | unset($this->arguments[$key]); 67 | } 68 | } 69 | 70 | public function offsetExists($key) 71 | { 72 | return $this->hasArgument($key); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /apc_pthreadmutex.h: -------------------------------------------------------------------------------- 1 | /* 2 | +----------------------------------------------------------------------+ 3 | | APC | 4 | +----------------------------------------------------------------------+ 5 | | Copyright (c) 2006-2011 The PHP Group | 6 | +----------------------------------------------------------------------+ 7 | | This source file is subject to version 3.01 of the PHP license, | 8 | | that is bundled with this package in the file LICENSE, and is | 9 | | available through the world-wide-web at the following url: | 10 | | http://www.php.net/license/3_01.txt | 11 | | If you did not receive a copy of the PHP license and are unable to | 12 | | obtain it through the world-wide-web, please send a note to | 13 | | license@php.net so we can mail you a copy immediately. | 14 | +----------------------------------------------------------------------+ 15 | | Authors: Brian Shire | 16 | +----------------------------------------------------------------------+ 17 | 18 | */ 19 | 20 | /* $Id$ */ 21 | 22 | #ifndef APC_PTHREADMUTEX_H 23 | #define APC_PTHREADMUTEX_H 24 | 25 | #include "apc.h" 26 | 27 | #ifdef APC_PTHREADMUTEX_LOCKS 28 | 29 | #include 30 | 31 | pthread_mutex_t *apc_pthreadmutex_create(pthread_mutex_t *lock TSRMLS_DC); 32 | void apc_pthreadmutex_destroy(pthread_mutex_t *lock); 33 | void apc_pthreadmutex_lock(pthread_mutex_t *lock TSRMLS_DC); 34 | void apc_pthreadmutex_unlock(pthread_mutex_t *lock TSRMLS_DC); 35 | zend_bool apc_pthreadmutex_nonblocking_lock(pthread_mutex_t *lock TSRMLS_DC); 36 | 37 | #endif 38 | 39 | #endif 40 | 41 | /* 42 | * Local variables: 43 | * tab-width: 4 44 | * c-basic-offset: 4 45 | * End: 46 | * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker 47 | * vim<600: expandtab sw=4 ts=4 sts=4 48 | */ 49 | -------------------------------------------------------------------------------- /config.w32: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | // vim:ft=javascript 3 | 4 | ARG_ENABLE('apc', 'Whether to enable APC support', 'no'); 5 | ARG_ENABLE('apc-debug', 'Whether to enable APC debugging', 'no'); 6 | ARG_ENABLE('apc-filehits', 'Whether to enable cache request file info', 'no'); 7 | ARG_ENABLE('apc-spinlocks', 'Whether to use spin locks (experimental)', 'no'); 8 | ARG_ENABLE('apc-memprotect', 'Whether to enable memory protection (experimental)', 'no'); 9 | ARG_ENABLE('apc-srwlock-native', 'Whether to use SRWLOCK locks native (win7/2008 only)', 'no'); 10 | ARG_ENABLE('apc-srwlock-kernel', 'Whether to use SRWLOCK locks (loaded at runtime)', 'no'); 11 | 12 | if(PHP_APC != 'no') 13 | { 14 | var apc_sources = 'apc.c php_apc.c apc_cache.c apc_compile.c apc_debug.c ' + 15 | 'apc_fcntl_win32.c apc_iterator.c apc_main.c apc_shm.c ' + 16 | 'apc_sma.c apc_stack.c apc_rfc1867.c apc_zend.c apc_pool.c ' + 17 | 'apc_bin.c apc_string.c'; 18 | 19 | if(PHP_APC_DEBUG != 'no') 20 | { 21 | ADD_FLAG('CFLAGS_APC', '/D __DEBUG_APC__=1'); 22 | } 23 | 24 | if(PHP_APC_FILEHITS != 'no') 25 | { 26 | AC_DEFINE('APC_FILEHITS', 1); 27 | } 28 | 29 | if(PHP_APC_MEMPROTECT != 'no') 30 | { 31 | AC_DEFINE('APC_MEMPROTECT', 1); 32 | } 33 | 34 | if(PHP_APC_SRWLOCK_NATIVE != 'no') { 35 | AC_DEFINE('APC_SRWLOCK_NATIVE', 1); 36 | } else { 37 | if(PHP_APC_SRWLOCK_KERNEL != 'no') { 38 | AC_DEFINE('APC_SRWLOCK_KERNEL', 1); 39 | ADD_FLAG('CFLAGS_APC', '/D WIN32_ONLY_COMPILER=1'); 40 | 41 | apc_sources += ' apc_windows_srwlock_kernel.c'; 42 | } else { 43 | if(PHP_APC_SPINLOCKS != 'no') { 44 | AC_DEFINE('APC_SPIN_LOCKS', 1); 45 | ADD_FLAG('CFLAGS_APC', '/D WIN32_ONLY_COMPILER=1'); 46 | 47 | apc_sources += ' apc_spin.c pgsql_s_lock.c'; 48 | } else { 49 | AC_DEFINE('APC_FCNTL_LOCKS', 1); 50 | } 51 | } 52 | } 53 | 54 | AC_DEFINE('HAVE_APC', 1); 55 | AC_DEFINE('HAVE_ATOMIC_OPERATIONS', 1); 56 | 57 | PHP_INSTALL_HEADERS("ext/apc", "apc_serializer.h"); 58 | 59 | EXTENSION('apc', apc_sources); 60 | } 61 | -------------------------------------------------------------------------------- /tests/symfony/Symfony/Component/HttpKernel/Event/FilterControllerEvent.php: -------------------------------------------------------------------------------- 1 | setController($controller); 17 | } 18 | 19 | public function getController() 20 | { 21 | return $this->controller; 22 | } 23 | 24 | public function setController($controller) 25 | { 26 | // controller must be a callable 27 | if (!is_callable($controller)) { 28 | throw new \LogicException(sprintf('The controller must be a callable (%s given).', $this->varToString($controller))); 29 | } 30 | 31 | $this->controller = $controller; 32 | } 33 | 34 | private function varToString($var) 35 | { 36 | if (is_object($var)) { 37 | return sprintf('Object(%s)', get_class($var)); 38 | } 39 | 40 | if (is_array($var)) { 41 | $a = array(); 42 | foreach ($var as $k => $v) { 43 | $a[] = sprintf('%s => %s', $k, $this->varToString($v)); 44 | } 45 | 46 | return sprintf("Array(%s)", implode(', ', $a)); 47 | } 48 | 49 | if (is_resource($var)) { 50 | return sprintf('Resource(%s)', get_resource_type($var)); 51 | } 52 | 53 | if (null === $var) { 54 | return 'null'; 55 | } 56 | 57 | if (false === $var) { 58 | return 'false'; 59 | } 60 | 61 | if (true === $var) { 62 | return 'true'; 63 | } 64 | 65 | return (string) $var; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /tests/symfony/Symfony/Component/BrowserKit/Response.php: -------------------------------------------------------------------------------- 1 | content = $content; 14 | $this->status = $status; 15 | $this->headers = $headers; 16 | } 17 | 18 | public function __toString() 19 | { 20 | $headers = ''; 21 | foreach ($this->headers as $name => $value) { 22 | if (is_string($value)) { 23 | $headers .= $this->buildHeader($name, $value); 24 | } else { 25 | foreach ($value as $headerValue) { 26 | $headers .= $this->buildHeader($name, $headerValue); 27 | } 28 | } 29 | } 30 | 31 | return $headers."\n".$this->content; 32 | } 33 | 34 | protected function buildHeader($name, $value) 35 | { 36 | return sprintf("%s: %s\n", $name, $value); 37 | } 38 | 39 | public function getContent() 40 | { 41 | return $this->content; 42 | } 43 | 44 | public function getStatus() 45 | { 46 | return $this->status; 47 | } 48 | 49 | public function getHeaders() 50 | { 51 | return $this->headers; 52 | } 53 | 54 | public function getHeader($header, $first = true) 55 | { 56 | foreach ($this->headers as $key => $value) { 57 | if (str_replace('-', '_', strtolower($key)) == str_replace('-', '_', strtolower($header))) { 58 | if ($first) { 59 | return is_array($value) ? (count($value) ? $value[0] : '') : $value; 60 | } 61 | 62 | return is_array($value) ? $value : array($value); 63 | } 64 | } 65 | 66 | return $first ? null : array(); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /tests/apc54_009.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | APC: Bug #61824 apc produces strange notice (php 5.4) 3 | --SKIPIF-- 4 | document); 18 | echo "\n"; 19 | FL; 20 | 21 | $args = array( 22 | 'apc.enabled=1', 23 | 'apc.enable_cli=1', 24 | ); 25 | 26 | server_start($file, $args); 27 | 28 | for ($i = 0; $i < 10; $i++) { 29 | run_test_simple(); 30 | } 31 | echo 'done'; 32 | 33 | --EXPECT-- 34 | DOMDocument::__set_state(array( 35 | )) 36 | DOMDocument::__set_state(array( 37 | )) 38 | DOMDocument::__set_state(array( 39 | )) 40 | DOMDocument::__set_state(array( 41 | )) 42 | DOMDocument::__set_state(array( 43 | )) 44 | DOMDocument::__set_state(array( 45 | )) 46 | DOMDocument::__set_state(array( 47 | )) 48 | DOMDocument::__set_state(array( 49 | )) 50 | DOMDocument::__set_state(array( 51 | )) 52 | DOMDocument::__set_state(array( 53 | )) 54 | DOMDocument::__set_state(array( 55 | )) 56 | DOMDocument::__set_state(array( 57 | )) 58 | DOMDocument::__set_state(array( 59 | )) 60 | DOMDocument::__set_state(array( 61 | )) 62 | DOMDocument::__set_state(array( 63 | )) 64 | DOMDocument::__set_state(array( 65 | )) 66 | DOMDocument::__set_state(array( 67 | )) 68 | DOMDocument::__set_state(array( 69 | )) 70 | DOMDocument::__set_state(array( 71 | )) 72 | DOMDocument::__set_state(array( 73 | )) 74 | DOMDocument::__set_state(array( 75 | )) 76 | DOMDocument::__set_state(array( 77 | )) 78 | DOMDocument::__set_state(array( 79 | )) 80 | DOMDocument::__set_state(array( 81 | )) 82 | DOMDocument::__set_state(array( 83 | )) 84 | DOMDocument::__set_state(array( 85 | )) 86 | DOMDocument::__set_state(array( 87 | )) 88 | DOMDocument::__set_state(array( 89 | )) 90 | DOMDocument::__set_state(array( 91 | )) 92 | DOMDocument::__set_state(array( 93 | )) 94 | done 95 | -------------------------------------------------------------------------------- /apc_signal.h: -------------------------------------------------------------------------------- 1 | /* 2 | +----------------------------------------------------------------------+ 3 | | APC | 4 | +----------------------------------------------------------------------+ 5 | | Copyright (c) 2006-2011 The PHP Group | 6 | +----------------------------------------------------------------------+ 7 | | This source file is subject to version 3.01 of the PHP license, | 8 | | that is bundled with this package in the file LICENSE, and is | 9 | | available through the world-wide-web at the following url: | 10 | | http://www.php.net/license/3_01.txt | 11 | | If you did not receive a copy of the PHP license and are unable to | 12 | | obtain it through the world-wide-web, please send a note to | 13 | | license@php.net so we can mail you a copy immediately. | 14 | +----------------------------------------------------------------------+ 15 | | Authors: Lucas Nealan | 16 | +----------------------------------------------------------------------+ 17 | 18 | */ 19 | 20 | /* $Id$ */ 21 | 22 | #ifndef APC_SIGNAL_H 23 | #define APC_SIGNAL_H 24 | 25 | #include "apc.h" 26 | #include "apc_php.h" 27 | 28 | typedef struct apc_signal_entry_t { 29 | int signo; /* signal number */ 30 | int siginfo; /* siginfo style handler calling */ 31 | void* handler; /* signal handler */ 32 | } apc_signal_entry_t; 33 | 34 | typedef struct apc_signal_info_t { 35 | int installed; /* How many signals we've installed handles for */ 36 | apc_signal_entry_t **prev; /* Previous signal handlers */ 37 | } apc_signal_info_t; 38 | 39 | void apc_set_signals(TSRMLS_D); 40 | void apc_shutdown_signals(TSRMLS_D); 41 | 42 | #endif 43 | 44 | /* 45 | * Local variables: 46 | * tab-width: 4 47 | * c-basic-offset: 4 48 | * End: 49 | * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker 50 | * vim<600: expandtab sw=4 ts=4 sts=4 51 | */ 52 | -------------------------------------------------------------------------------- /tests/symfony/Symfony/Component/HttpFoundation/StreamedResponse.php: -------------------------------------------------------------------------------- 1 | setCallback($callback); 16 | } 17 | $this->streamed = false; 18 | } 19 | 20 | public static function create($callback = null, $status = 200, $headers = array()) 21 | { 22 | return new static($callback, $status, $headers); 23 | } 24 | 25 | public function setCallback($callback) 26 | { 27 | if (!is_callable($callback)) { 28 | throw new \LogicException('The Response callback must be a valid PHP callable.'); 29 | } 30 | $this->callback = $callback; 31 | } 32 | 33 | public function prepare(Request $request) 34 | { 35 | if ('1.0' != $request->server->get('SERVER_PROTOCOL')) { 36 | $this->setProtocolVersion('1.1'); 37 | } 38 | 39 | $this->headers->set('Cache-Control', 'no-cache'); 40 | 41 | return parent::prepare($request); 42 | } 43 | 44 | public function sendContent() 45 | { 46 | if ($this->streamed) { 47 | return; 48 | } 49 | 50 | $this->streamed = true; 51 | 52 | if (null === $this->callback) { 53 | throw new \LogicException('The Response callback must not be null.'); 54 | } 55 | 56 | call_user_func($this->callback); 57 | } 58 | 59 | public function setContent($content) 60 | { 61 | if (null !== $content) { 62 | throw new \LogicException('The content cannot be set on a StreamedResponse instance.'); 63 | } 64 | } 65 | 66 | public function getContent() 67 | { 68 | return false; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /apc_pthreadrwlock.h: -------------------------------------------------------------------------------- 1 | /* 2 | +----------------------------------------------------------------------+ 3 | | APC | 4 | +----------------------------------------------------------------------+ 5 | | Copyright (c) 2006-2011 The PHP Group | 6 | +----------------------------------------------------------------------+ 7 | | This source file is subject to version 3.01 of the PHP license, | 8 | | that is bundled with this package in the file LICENSE, and is | 9 | | available through the world-wide-web at the following url: | 10 | | http://www.php.net/license/3_01.txt | 11 | | If you did not receive a copy of the PHP license and are unable to | 12 | | obtain it through the world-wide-web, please send a note to | 13 | | license@php.net so we can mail you a copy immediately. | 14 | +----------------------------------------------------------------------+ 15 | | Authors: Gopal V | 16 | +----------------------------------------------------------------------+ 17 | 18 | */ 19 | 20 | /* $Id: apc_pthreadrwlock.h 302175 2010-08-13 06:20:28Z kalle $ */ 21 | 22 | #ifndef APC_PTHREADRWLOCK_H 23 | #define APC_PTHREADRWLOCK_H 24 | 25 | #include "apc.h" 26 | 27 | #ifdef APC_PTHREADRW_LOCKS 28 | 29 | #include 30 | 31 | pthread_rwlock_t *apc_pthreadrwlock_create(pthread_rwlock_t *lock TSRMLS_DC); 32 | void apc_pthreadrwlock_destroy(pthread_rwlock_t *lock); 33 | void apc_pthreadrwlock_lock(pthread_rwlock_t *lock TSRMLS_DC); 34 | void apc_pthreadrwlock_rdlock(pthread_rwlock_t *lock TSRMLS_DC); 35 | void apc_pthreadrwlock_unlock(pthread_rwlock_t *lock TSRMLS_DC); 36 | zend_bool apc_pthreadrwlock_nonblocking_lock(pthread_rwlock_t *lock TSRMLS_DC); 37 | 38 | #endif 39 | 40 | #endif 41 | 42 | /* 43 | * Local variables: 44 | * tab-width: 4 45 | * c-basic-offset: 4 46 | * End: 47 | * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker 48 | * vim<600: expandtab sw=4 ts=4 sts=4 49 | */ 50 | -------------------------------------------------------------------------------- /tests/apc54_014.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | APC: Bug #61742 preload_path does not work due to incorrect string length (variant 1) (php 5.4) 3 | --SKIPIF-- 4 | | 16 | +----------------------------------------------------------------------+ 17 | 18 | This software was contributed to PHP by Community Connect Inc. in 2002 19 | and revised in 2005 by Yahoo! Inc. to add support for PHP 5.1. 20 | Future revisions and derivatives of this source code must acknowledge 21 | Community Connect Inc. as the original contributor of this module by 22 | leaving this note intact in the source code. 23 | 24 | All other licensing and usage conditions are those of the PHP Group. 25 | 26 | */ 27 | 28 | /* $Id$ */ 29 | 30 | #ifndef APC_STRING 31 | #define APC_STRING 32 | 33 | #include "apc.h" 34 | 35 | #ifndef ZTS 36 | void apc_interned_strings_init(TSRMLS_D); 37 | void apc_interned_strings_shutdown(TSRMLS_D); 38 | #endif 39 | 40 | const char *apc_new_interned_string(const char *arKey, int nKeyLength TSRMLS_DC); 41 | 42 | #endif 43 | 44 | /* 45 | * Local variables: 46 | * tab-width: 4 47 | * c-basic-offset: 4 48 | * End: 49 | * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker 50 | * vim<600: expandtab sw=4 ts=4 sts=4 51 | */ 52 | -------------------------------------------------------------------------------- /tests/symfony/Symfony/Component/HttpFoundation/ServerBag.php: -------------------------------------------------------------------------------- 1 | parameters as $key => $value) { 11 | if (0 === strpos($key, 'HTTP_')) { 12 | $headers[substr($key, 5)] = $value; 13 | } 14 | // CONTENT_* are not prefixed with HTTP_ 15 | elseif (in_array($key, array('CONTENT_LENGTH', 'CONTENT_MD5', 'CONTENT_TYPE'))) { 16 | $headers[$key] = $value; 17 | } 18 | } 19 | 20 | if (isset($this->parameters['PHP_AUTH_USER'])) { 21 | $headers['PHP_AUTH_USER'] = $this->parameters['PHP_AUTH_USER']; 22 | $headers['PHP_AUTH_PW'] = isset($this->parameters['PHP_AUTH_PW']) ? $this->parameters['PHP_AUTH_PW'] : ''; 23 | } else { 24 | 25 | $authorizationHeader = null; 26 | if (isset($this->parameters['HTTP_AUTHORIZATION'])) { 27 | $authorizationHeader = $this->parameters['HTTP_AUTHORIZATION']; 28 | } elseif (isset($this->parameters['REDIRECT_HTTP_AUTHORIZATION'])) { 29 | $authorizationHeader = $this->parameters['REDIRECT_HTTP_AUTHORIZATION']; 30 | } 31 | 32 | // Decode AUTHORIZATION header into PHP_AUTH_USER and PHP_AUTH_PW when authorization header is basic 33 | if ((null !== $authorizationHeader) && (0 === stripos($authorizationHeader, 'basic'))) { 34 | $exploded = explode(':', base64_decode(substr($authorizationHeader, 6))); 35 | if (count($exploded) == 2) { 36 | list($headers['PHP_AUTH_USER'], $headers['PHP_AUTH_PW']) = $exploded; 37 | } 38 | } 39 | } 40 | 41 | // PHP_AUTH_USER/PHP_AUTH_PW 42 | if (isset($headers['PHP_AUTH_USER'])) { 43 | $headers['AUTHORIZATION'] = 'Basic '.base64_encode($headers['PHP_AUTH_USER'].':'.$headers['PHP_AUTH_PW']); 44 | } 45 | 46 | return $headers; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /tests/symfony/Symfony/Component/Process/ExecutableFinder.php: -------------------------------------------------------------------------------- 1 | suffixes = $suffixes; 21 | } 22 | 23 | public function addSuffix($suffix) 24 | { 25 | $this->suffixes[] = $suffix; 26 | } 27 | 28 | public function find($name, $default = null, array $extraDirs = array()) 29 | { 30 | if (ini_get('open_basedir')) { 31 | $searchPath = explode(PATH_SEPARATOR, getenv('open_basedir')); 32 | $dirs = array(); 33 | foreach ($searchPath as $path) { 34 | if (is_dir($path)) { 35 | $dirs[] = $path; 36 | } else { 37 | $file = str_replace(dirname($path), '', $path); 38 | if ($file == $name && is_executable($path)) { 39 | return $path; 40 | } 41 | } 42 | } 43 | } else { 44 | $dirs = array_merge( 45 | explode(PATH_SEPARATOR, getenv('PATH') ?: getenv('Path')), 46 | $extraDirs 47 | ); 48 | } 49 | 50 | $suffixes = array(''); 51 | if (defined('PHP_WINDOWS_VERSION_BUILD')) { 52 | $pathExt = getenv('PATHEXT'); 53 | $suffixes = $pathExt ? explode(PATH_SEPARATOR, $pathExt) : $this->suffixes; 54 | } 55 | foreach ($suffixes as $suffix) { 56 | foreach ($dirs as $dir) { 57 | if (is_file($file = $dir.DIRECTORY_SEPARATOR.$name.$suffix) && (self::$isWindows || is_executable($file))) { 58 | return $file; 59 | } 60 | } 61 | } 62 | 63 | return $default; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /apc_mmap.h: -------------------------------------------------------------------------------- 1 | /* 2 | +----------------------------------------------------------------------+ 3 | | APC | 4 | +----------------------------------------------------------------------+ 5 | | Copyright (c) 2006-2011 The PHP Group | 6 | +----------------------------------------------------------------------+ 7 | | This source file is subject to version 3.01 of the PHP license, | 8 | | that is bundled with this package in the file LICENSE, and is | 9 | | available through the world-wide-web at the following url: | 10 | | http://www.php.net/license/3_01.txt | 11 | | If you did not receive a copy of the PHP license and are unable to | 12 | | obtain it through the world-wide-web, please send a note to | 13 | | license@php.net so we can mail you a copy immediately. | 14 | +----------------------------------------------------------------------+ 15 | | Authors: Gopal V | 16 | +----------------------------------------------------------------------+ 17 | 18 | This software was contributed to PHP by Community Connect Inc. in 2002 19 | and revised in 2005 by Yahoo! Inc. to add support for PHP 5.1. 20 | Future revisions and derivatives of this source code must acknowledge 21 | Community Connect Inc. as the original contributor of this module by 22 | leaving this note intact in the source code. 23 | 24 | All other licensing and usage conditions are those of the PHP Group. 25 | 26 | */ 27 | 28 | /* $Id$ */ 29 | 30 | #ifndef APC_MMAP_H 31 | #define APC_MMAP_H 32 | 33 | #include 34 | 35 | #include "apc.h" 36 | #include "apc_sma.h" 37 | 38 | /* Wrapper functions for shared memory mapped files */ 39 | 40 | #if APC_MMAP 41 | apc_segment_t apc_mmap(char *file_mask, size_t size TSRMLS_DC); 42 | void apc_unmap(apc_segment_t* segment TSRMLS_DC); 43 | #endif 44 | 45 | #endif 46 | 47 | /* 48 | * Local variables: 49 | * tab-width: 4 50 | * c-basic-offset: 4 51 | * End: 52 | * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker 53 | * vim<600: expandtab sw=4 ts=4 sts=4 54 | */ 55 | -------------------------------------------------------------------------------- /apc_spin.c: -------------------------------------------------------------------------------- 1 | /* 2 | +----------------------------------------------------------------------+ 3 | | APC | 4 | +----------------------------------------------------------------------+ 5 | | Copyright (c) 2006-2011 The PHP Group | 6 | +----------------------------------------------------------------------+ 7 | | This source file is subject to version 3.01 of the PHP license, | 8 | | that is bundled with this package in the file LICENSE, and is | 9 | | available through the world-wide-web at the following url: | 10 | | http://www.php.net/license/3_01.txt | 11 | | If you did not receive a copy of the PHP license and are unable to | 12 | | obtain it through the world-wide-web, please send a note to | 13 | | license@php.net so we can mail you a copy immediately. | 14 | +----------------------------------------------------------------------+ 15 | | Authors: Brian Shire | 16 | +----------------------------------------------------------------------+ 17 | 18 | */ 19 | 20 | /* $Id$ */ 21 | 22 | #include "apc_spin.h" 23 | 24 | #ifdef APC_SPIN_LOCKS 25 | 26 | slock_t *apc_slock_create(slock_t *lock) 27 | { 28 | S_INIT_LOCK(lock); 29 | return lock; 30 | } 31 | 32 | void apc_slock_destroy(slock_t *lock) 33 | { 34 | return; 35 | } 36 | 37 | void apc_slock_lock(slock_t *lock TSRMLS_DC) 38 | { 39 | S_LOCK(lock); 40 | } 41 | 42 | void apc_slock_unlock(slock_t *lock) 43 | { 44 | S_UNLOCK(lock); 45 | } 46 | 47 | zend_bool apc_slock_nonblocking_lock(slock_t *lock) 48 | { 49 | /* Technically we aren't supposed to call this directly, but the original 50 | * code provides no method for absolute non-blocking locks, so we'll call into 51 | * the TAS (test and set) functionality directly 52 | */ 53 | return !(TAS(lock)); /* if TAS returns 0 we obtained the lock, otherwise we failed */ 54 | } 55 | 56 | 57 | #endif 58 | 59 | /* 60 | * Local variables: 61 | * tab-width: 4 62 | * c-basic-offset: 4 63 | * End: 64 | * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker 65 | * vim<600: expandtab sw=4 ts=4 sts=4 66 | */ 67 | -------------------------------------------------------------------------------- /apc_fcntl.h: -------------------------------------------------------------------------------- 1 | /* 2 | +----------------------------------------------------------------------+ 3 | | APC | 4 | +----------------------------------------------------------------------+ 5 | | Copyright (c) 2006-2011 The PHP Group | 6 | +----------------------------------------------------------------------+ 7 | | This source file is subject to version 3.01 of the PHP license, | 8 | | that is bundled with this package in the file LICENSE, and is | 9 | | available through the world-wide-web at the following url: | 10 | | http://www.php.net/license/3_01.txt. | 11 | | If you did not receive a copy of the PHP license and are unable to | 12 | | obtain it through the world-wide-web, please send a note to | 13 | | license@php.net so we can mail you a copy immediately. | 14 | +----------------------------------------------------------------------+ 15 | | Authors: George Schlossnagle | 16 | | Rasmus Lerdorf | 17 | +----------------------------------------------------------------------+ 18 | 19 | This software was contributed to PHP by Community Connect Inc. in 2002 20 | and revised in 2005 by Yahoo! Inc. to add support for PHP 5.1. 21 | Future revisions and derivatives of this source code must acknowledge 22 | Community Connect Inc. as the original contributor of this module by 23 | leaving this note intact in the source code. 24 | 25 | All other licensing and usage conditions are those of the PHP Group. 26 | 27 | */ 28 | 29 | /* $Id$ */ 30 | 31 | #ifndef APC_FCNTL_H 32 | #define APC_FCNTL_H 33 | 34 | 35 | extern int apc_fcntl_create(const char* pathname TSRMLS_DC); 36 | extern void apc_fcntl_destroy(int fd); 37 | extern void apc_fcntl_lock(int fd TSRMLS_DC); 38 | extern void apc_fcntl_rdlock(int fd TSRMLS_DC); 39 | extern void apc_fcntl_unlock(int fd TSRMLS_DC); 40 | extern unsigned char apc_fcntl_nonblocking_lock(int fd TSRMLS_DC); 41 | #endif 42 | 43 | /* 44 | * Local variables: 45 | * tab-width: 4 46 | * c-basic-offset: 4 47 | * End: 48 | * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker 49 | * vim<600: expandtab sw=4 ts=4 sts=4 50 | */ 51 | -------------------------------------------------------------------------------- /php_apc.h: -------------------------------------------------------------------------------- 1 | /* 2 | +----------------------------------------------------------------------+ 3 | | APC | 4 | +----------------------------------------------------------------------+ 5 | | Copyright (c) 2006-2011 The PHP Group | 6 | +----------------------------------------------------------------------+ 7 | | This source file is subject to version 3.01 of the PHP license, | 8 | | that is bundled with this package in the file LICENSE, and is | 9 | | available through the world-wide-web at the following url: | 10 | | http://www.php.net/license/3_01.txt | 11 | | If you did not receive a copy of the PHP license and are unable to | 12 | | obtain it through the world-wide-web, please send a note to | 13 | | license@php.net so we can mail you a copy immediately. | 14 | +----------------------------------------------------------------------+ 15 | | Authors: Daniel Cowgill | 16 | | George Schlossnagle | 17 | | Rasmus Lerdorf | 18 | +----------------------------------------------------------------------+ 19 | 20 | This software was contributed to PHP by Community Connect Inc. in 2002 21 | and revised in 2005 by Yahoo! Inc. to add support for PHP 5.1. 22 | Future revisions and derivatives of this source code must acknowledge 23 | Community Connect Inc. as the original contributor of this module by 24 | leaving this note intact in the source code. 25 | 26 | All other licensing and usage conditions are those of the PHP Group. 27 | 28 | */ 29 | 30 | /* $Id$ */ 31 | 32 | #ifndef PHP_APC_H 33 | #define PHP_APC_H 34 | 35 | #include "apc_php.h" 36 | #include "apc_globals.h" 37 | 38 | #define PHP_APC_VERSION "3.1.15-dev" 39 | 40 | extern zend_module_entry apc_module_entry; 41 | #define apc_module_ptr &apc_module_entry 42 | 43 | #define phpext_apc_ptr apc_module_ptr 44 | 45 | #endif /* PHP_APC_H */ 46 | 47 | /* 48 | * Local variables: 49 | * tab-width: 4 50 | * c-basic-offset: 4 51 | * End: 52 | * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker 53 | * vim<600: expandtab sw=4 ts=4 sts=4 54 | */ 55 | -------------------------------------------------------------------------------- /apc_shm.h: -------------------------------------------------------------------------------- 1 | /* 2 | +----------------------------------------------------------------------+ 3 | | APC | 4 | +----------------------------------------------------------------------+ 5 | | Copyright (c) 2006-2011 The PHP Group | 6 | +----------------------------------------------------------------------+ 7 | | This source file is subject to version 3.01 of the PHP license, | 8 | | that is bundled with this package in the file LICENSE, and is | 9 | | available through the world-wide-web at the following url: | 10 | | http://www.php.net/license/3_01.txt | 11 | | If you did not receive a copy of the PHP license and are unable to | 12 | | obtain it through the world-wide-web, please send a note to | 13 | | license@php.net so we can mail you a copy immediately. | 14 | +----------------------------------------------------------------------+ 15 | | Authors: Daniel Cowgill | 16 | +----------------------------------------------------------------------+ 17 | 18 | This software was contributed to PHP by Community Connect Inc. in 2002 19 | and revised in 2005 by Yahoo! Inc. to add support for PHP 5.1. 20 | Future revisions and derivatives of this source code must acknowledge 21 | Community Connect Inc. as the original contributor of this module by 22 | leaving this note intact in the source code. 23 | 24 | All other licensing and usage conditions are those of the PHP Group. 25 | 26 | */ 27 | 28 | /* $Id$ */ 29 | 30 | #ifndef APC_SHM_H 31 | #define APC_SHM_H 32 | 33 | #include 34 | #ifdef PHP_WIN32 35 | #include 36 | #endif 37 | 38 | #include "apc_sma.h" 39 | 40 | /* Wrapper functions for unix shared memory */ 41 | 42 | extern int apc_shm_create(int proj, size_t size TSRMLS_DC); 43 | extern void apc_shm_destroy(int shmid); 44 | extern apc_segment_t apc_shm_attach(int shmid, size_t size TSRMLS_DC); 45 | extern void apc_shm_detach(apc_segment_t* segment TSRMLS_DC); 46 | 47 | #endif 48 | 49 | /* 50 | * Local variables: 51 | * tab-width: 4 52 | * c-basic-offset: 4 53 | * End: 54 | * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker 55 | * vim<600: expandtab sw=4 ts=4 sts=4 56 | */ 57 | -------------------------------------------------------------------------------- /apc_sem.h: -------------------------------------------------------------------------------- 1 | /* 2 | +----------------------------------------------------------------------+ 3 | | APC | 4 | +----------------------------------------------------------------------+ 5 | | Copyright (c) 2006-2011 The PHP Group | 6 | +----------------------------------------------------------------------+ 7 | | This source file is subject to version 3.01 of the PHP license, | 8 | | that is bundled with this package in the file LICENSE, and is | 9 | | available through the world-wide-web at the following url: | 10 | | http://www.php.net/license/3_01.txt | 11 | | If you did not receive a copy of the PHP license and are unable to | 12 | | obtain it through the world-wide-web, please send a note to | 13 | | license@php.net so we can mail you a copy immediately. | 14 | +----------------------------------------------------------------------+ 15 | | Authors: Daniel Cowgill | 16 | +----------------------------------------------------------------------+ 17 | 18 | This software was contributed to PHP by Community Connect Inc. in 2002 19 | and revised in 2005 by Yahoo! Inc. to add support for PHP 5.1. 20 | Future revisions and derivatives of this source code must acknowledge 21 | Community Connect Inc. as the original contributor of this module by 22 | leaving this note intact in the source code. 23 | 24 | All other licensing and usage conditions are those of the PHP Group. 25 | 26 | */ 27 | 28 | /* $Id$ */ 29 | 30 | #ifndef APC_SEM_H 31 | #define APC_SEM_H 32 | 33 | /* Wrapper functions for SysV sempahores */ 34 | 35 | extern int apc_sem_create(int proj, int initval TSRMLS_DC); 36 | extern void apc_sem_destroy(int semid); 37 | extern void apc_sem_lock(int semid TSRMLS_DC); 38 | extern int apc_sem_nonblocking_lock(int semid TSRMLS_DC); 39 | extern void apc_sem_unlock(int semid TSRMLS_DC); 40 | extern void apc_sem_wait_for_zero(int semid TSRMLS_DC); 41 | extern int apc_sem_get_value(int semid TSRMLS_DC); 42 | 43 | #endif 44 | 45 | /* 46 | * Local variables: 47 | * tab-width: 4 48 | * c-basic-offset: 4 49 | * End: 50 | * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker 51 | * vim<600: expandtab sw=4 ts=4 sts=4 52 | */ 53 | -------------------------------------------------------------------------------- /apc_bin.h: -------------------------------------------------------------------------------- 1 | /* 2 | +----------------------------------------------------------------------+ 3 | | APC | 4 | +----------------------------------------------------------------------+ 5 | | Copyright (c) 2006-2011 The PHP Group | 6 | +----------------------------------------------------------------------+ 7 | | This source file is subject to version 3.01 of the PHP license, | 8 | | that is bundled with this package in the file LICENSE, and is | 9 | | available through the world-wide-web at the following url: | 10 | | http://www.php.net/license/3_01.txt | 11 | | If you did not receive a copy of the PHP license and are unable to | 12 | | obtain it through the world-wide-web, please send a note to | 13 | | license@php.net so we can mail you a copy immediately. | 14 | +----------------------------------------------------------------------+ 15 | | Authors: Brian Shire | 16 | +----------------------------------------------------------------------+ 17 | 18 | */ 19 | 20 | /* $Id$ */ 21 | 22 | #ifndef APC_BINDUMP_H 23 | #define APC_BINDUMP_H 24 | 25 | #include "apc.h" 26 | #include "apc_php.h" 27 | #include "ext/standard/basic_functions.h" 28 | 29 | /* APC binload flags */ 30 | #define APC_BIN_VERIFY_MD5 1 << 0 31 | #define APC_BIN_VERIFY_CRC32 1 << 1 32 | 33 | typedef struct _apc_bd_entry_t { 34 | unsigned char type; 35 | uint num_functions; 36 | uint num_classes; 37 | apc_cache_entry_value_t val; 38 | unsigned char file_md5[16]; /* only sensible for file entries */ 39 | } apc_bd_entry_t; 40 | 41 | typedef struct _apc_bd_t { 42 | unsigned int size; 43 | int swizzled; 44 | unsigned char md5[16]; 45 | php_uint32 crc; 46 | unsigned int num_entries; 47 | apc_bd_entry_t *entries; 48 | int num_swizzled_ptrs; 49 | void ***swizzled_ptrs; 50 | } apc_bd_t; 51 | 52 | apc_bd_t* apc_bin_dump(HashTable *files, HashTable *user_vars TSRMLS_DC); 53 | int apc_bin_load(apc_bd_t *bd, int flags TSRMLS_DC); 54 | 55 | #endif 56 | 57 | /* 58 | * Local variables: 59 | * tab-width: 4 60 | * c-basic-offset: 4 61 | * End: 62 | * vim600: expandtab sw=4 ts=4 sts=4 fdm=marker 63 | * vim<600: expandtab sw=4 ts=4 sts=4 64 | */ 65 | -------------------------------------------------------------------------------- /tests/bug52144_classes.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | APC: Bug #52144 (Error: Base lambda function for closure not found) 3 | --SKIPIF-- 4 | dummy(); 51 | } 52 | PHP; 53 | 54 | $args = array( 55 | 'apc.enabled=1', 56 | 'apc.enable_cli=1', 57 | 'apc.file_update_protection=0', 58 | ); 59 | 60 | server_start($file, $args); 61 | 62 | for ($i = 0; $i < 10; $i++) { 63 | echo "-----------------------------\n"; 64 | run_test_simple("?tested=true"); 65 | } 66 | --CLEAN-- 67 | 70 | --EXPECT-- 71 | ----------------------------- 72 | string(6) "cached" 73 | ----------------------------- 74 | string(1) "C" 75 | ----------------------------- 76 | string(6) "cached" 77 | ----------------------------- 78 | string(1) "C" 79 | ----------------------------- 80 | string(6) "cached" 81 | ----------------------------- 82 | string(1) "C" 83 | ----------------------------- 84 | string(6) "cached" 85 | ----------------------------- 86 | string(1) "C" 87 | ----------------------------- 88 | string(6) "cached" 89 | ----------------------------- 90 | string(1) "C" 91 | -------------------------------------------------------------------------------- /tests/apc_003.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | APC: apc_store/fetch with objects (php pre-5.3) 3 | --SKIPIF-- 4 | = 0) { 7 | echo "skip\n"; 8 | } 9 | ?> 10 | --INI-- 11 | apc.enabled=1 12 | apc.enable_cli=1 13 | apc.file_update_protection=0 14 | --FILE-- 15 | a = true; 25 | var_dump($bar); 26 | 27 | class bar extends foo 28 | { 29 | public $pub = 'bar'; 30 | protected $pro = 'bar'; 31 | private $pri = 'bar'; // we don't see this, we'd need php 5.1 new serialization 32 | 33 | function __construct() 34 | { 35 | $this->bar = true; 36 | } 37 | 38 | function change() 39 | { 40 | $this->pri = 'mod'; 41 | } 42 | } 43 | 44 | class baz extends bar 45 | { 46 | private $pri = 'baz'; 47 | 48 | function __construct() 49 | { 50 | parent::__construct(); 51 | $this->baz = true; 52 | } 53 | } 54 | 55 | $baz = new baz; 56 | var_dump($baz); 57 | $baz->change(); 58 | var_dump($baz); 59 | apc_store('baz', $baz); 60 | unset($baz); 61 | var_dump(apc_fetch('baz')); 62 | 63 | ?> 64 | ===DONE=== 65 | 66 | --EXPECTF-- 67 | object(foo)#%d (0) { 68 | } 69 | object(foo)#%d (0) { 70 | } 71 | object(foo)#%d (1) { 72 | ["a"]=> 73 | bool(true) 74 | } 75 | object(baz)#%d (6) { 76 | ["pri:private"]=> 77 | string(3) "baz" 78 | ["pub"]=> 79 | string(3) "bar" 80 | ["pro:protected"]=> 81 | string(3) "bar" 82 | ["pri:private"]=> 83 | string(3) "bar" 84 | ["bar"]=> 85 | bool(true) 86 | ["baz"]=> 87 | bool(true) 88 | } 89 | object(baz)#%d (6) { 90 | ["pri:private"]=> 91 | string(3) "baz" 92 | ["pub"]=> 93 | string(3) "bar" 94 | ["pro:protected"]=> 95 | string(3) "bar" 96 | ["pri:private"]=> 97 | string(3) "mod" 98 | ["bar"]=> 99 | bool(true) 100 | ["baz"]=> 101 | bool(true) 102 | } 103 | object(baz)#%d (6) { 104 | ["pri:private"]=> 105 | string(3) "baz" 106 | ["pub"]=> 107 | string(3) "bar" 108 | ["pro:protected"]=> 109 | string(3) "bar" 110 | ["pri:private"]=> 111 | string(3) "mod" 112 | ["bar"]=> 113 | bool(true) 114 | ["baz"]=> 115 | bool(true) 116 | } 117 | ===DONE=== 118 | -------------------------------------------------------------------------------- /tests/iterator_001.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | APC: APCIterator general 3 | --SKIPIF-- 4 | 5 | --INI-- 6 | apc.enabled=1 7 | apc.enable_cli=1 8 | apc.file_update_protection=0 9 | --FILE-- 10 | $value) { 17 | $vals[$key] = $value['key']; 18 | } 19 | ksort($vals); 20 | var_dump($vals); 21 | 22 | ?> 23 | ===DONE=== 24 | 25 | --EXPECT-- 26 | array(41) { 27 | ["key0"]=> 28 | string(4) "key0" 29 | ["key1"]=> 30 | string(4) "key1" 31 | ["key10"]=> 32 | string(5) "key10" 33 | ["key11"]=> 34 | string(5) "key11" 35 | ["key12"]=> 36 | string(5) "key12" 37 | ["key13"]=> 38 | string(5) "key13" 39 | ["key14"]=> 40 | string(5) "key14" 41 | ["key15"]=> 42 | string(5) "key15" 43 | ["key16"]=> 44 | string(5) "key16" 45 | ["key17"]=> 46 | string(5) "key17" 47 | ["key18"]=> 48 | string(5) "key18" 49 | ["key19"]=> 50 | string(5) "key19" 51 | ["key2"]=> 52 | string(4) "key2" 53 | ["key20"]=> 54 | string(5) "key20" 55 | ["key21"]=> 56 | string(5) "key21" 57 | ["key22"]=> 58 | string(5) "key22" 59 | ["key23"]=> 60 | string(5) "key23" 61 | ["key24"]=> 62 | string(5) "key24" 63 | ["key25"]=> 64 | string(5) "key25" 65 | ["key26"]=> 66 | string(5) "key26" 67 | ["key27"]=> 68 | string(5) "key27" 69 | ["key28"]=> 70 | string(5) "key28" 71 | ["key29"]=> 72 | string(5) "key29" 73 | ["key3"]=> 74 | string(4) "key3" 75 | ["key30"]=> 76 | string(5) "key30" 77 | ["key31"]=> 78 | string(5) "key31" 79 | ["key32"]=> 80 | string(5) "key32" 81 | ["key33"]=> 82 | string(5) "key33" 83 | ["key34"]=> 84 | string(5) "key34" 85 | ["key35"]=> 86 | string(5) "key35" 87 | ["key36"]=> 88 | string(5) "key36" 89 | ["key37"]=> 90 | string(5) "key37" 91 | ["key38"]=> 92 | string(5) "key38" 93 | ["key39"]=> 94 | string(5) "key39" 95 | ["key4"]=> 96 | string(4) "key4" 97 | ["key40"]=> 98 | string(5) "key40" 99 | ["key5"]=> 100 | string(4) "key5" 101 | ["key6"]=> 102 | string(4) "key6" 103 | ["key7"]=> 104 | string(4) "key7" 105 | ["key8"]=> 106 | string(4) "key8" 107 | ["key9"]=> 108 | string(4) "key9" 109 | } 110 | ===DONE=== 111 | -------------------------------------------------------------------------------- /tests/apc_003b.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | APC: apc_store/fetch with objects (php 5.3) 3 | --SKIPIF-- 4 | 10 | --INI-- 11 | apc.enabled=1 12 | apc.enable_cli=1 13 | apc.file_update_protection=0 14 | --FILE-- 15 | a = true; 25 | var_dump($bar); 26 | 27 | class bar extends foo 28 | { 29 | public $pub = 'bar'; 30 | protected $pro = 'bar'; 31 | private $pri = 'bar'; // we don't see this, we'd need php 5.1 new serialization 32 | 33 | function __construct() 34 | { 35 | $this->bar = true; 36 | } 37 | 38 | function change() 39 | { 40 | $this->pri = 'mod'; 41 | } 42 | } 43 | 44 | class baz extends bar 45 | { 46 | private $pri = 'baz'; 47 | 48 | function __construct() 49 | { 50 | parent::__construct(); 51 | $this->baz = true; 52 | } 53 | } 54 | 55 | $baz = new baz; 56 | var_dump($baz); 57 | $baz->change(); 58 | var_dump($baz); 59 | apc_store('baz', $baz); 60 | unset($baz); 61 | var_dump(apc_fetch('baz')); 62 | 63 | ?> 64 | ===DONE=== 65 | 66 | --EXPECTF-- 67 | object(foo)#%d (0) { 68 | } 69 | object(foo)#%d (0) { 70 | } 71 | object(foo)#%d (1) { 72 | ["a"]=> 73 | bool(true) 74 | } 75 | object(baz)#%d (6) { 76 | ["pri":"baz":private]=> 77 | string(3) "baz" 78 | ["pub"]=> 79 | string(3) "bar" 80 | ["pro":protected]=> 81 | string(3) "bar" 82 | ["pri":"bar":private]=> 83 | string(3) "bar" 84 | ["bar"]=> 85 | bool(true) 86 | ["baz"]=> 87 | bool(true) 88 | } 89 | object(baz)#%d (6) { 90 | ["pri":"baz":private]=> 91 | string(3) "baz" 92 | ["pub"]=> 93 | string(3) "bar" 94 | ["pro":protected]=> 95 | string(3) "bar" 96 | ["pri":"bar":private]=> 97 | string(3) "mod" 98 | ["bar"]=> 99 | bool(true) 100 | ["baz"]=> 101 | bool(true) 102 | } 103 | object(baz)#%d (6) { 104 | ["pri":"baz":private]=> 105 | string(3) "baz" 106 | ["pub"]=> 107 | string(3) "bar" 108 | ["pro":protected]=> 109 | string(3) "bar" 110 | ["pri":"bar":private]=> 111 | string(3) "mod" 112 | ["bar"]=> 113 | bool(true) 114 | ["baz"]=> 115 | bool(true) 116 | } 117 | ===DONE=== 118 | -------------------------------------------------------------------------------- /tests/apc54_021.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | APC: APCIterator file + apc_delete_file() (php 5.4) 3 | --SKIPIF-- 4 | 5 | --INI-- 6 | apc.enabled=1 7 | apc.enable_cli=1 8 | apc.file_update_protection=0 9 | --FILE-- 10 | $value) { 17 | $vals[$key] = $value['key']; 18 | } 19 | ksort($vals); 20 | var_dump($vals); 21 | 22 | ?> 23 | ===DONE=== 24 | 25 | --EXPECT-- 26 | array(41) { 27 | ["key0"]=> 28 | string(4) "key0" 29 | ["key1"]=> 30 | string(4) "key1" 31 | ["key10"]=> 32 | string(5) "key10" 33 | ["key11"]=> 34 | string(5) "key11" 35 | ["key12"]=> 36 | string(5) "key12" 37 | ["key13"]=> 38 | string(5) "key13" 39 | ["key14"]=> 40 | string(5) "key14" 41 | ["key15"]=> 42 | string(5) "key15" 43 | ["key16"]=> 44 | string(5) "key16" 45 | ["key17"]=> 46 | string(5) "key17" 47 | ["key18"]=> 48 | string(5) "key18" 49 | ["key19"]=> 50 | string(5) "key19" 51 | ["key2"]=> 52 | string(4) "key2" 53 | ["key20"]=> 54 | string(5) "key20" 55 | ["key21"]=> 56 | string(5) "key21" 57 | ["key22"]=> 58 | string(5) "key22" 59 | ["key23"]=> 60 | string(5) "key23" 61 | ["key24"]=> 62 | string(5) "key24" 63 | ["key25"]=> 64 | string(5) "key25" 65 | ["key26"]=> 66 | string(5) "key26" 67 | ["key27"]=> 68 | string(5) "key27" 69 | ["key28"]=> 70 | string(5) "key28" 71 | ["key29"]=> 72 | string(5) "key29" 73 | ["key3"]=> 74 | string(4) "key3" 75 | ["key30"]=> 76 | string(5) "key30" 77 | ["key31"]=> 78 | string(5) "key31" 79 | ["key32"]=> 80 | string(5) "key32" 81 | ["key33"]=> 82 | string(5) "key33" 83 | ["key34"]=> 84 | string(5) "key34" 85 | ["key35"]=> 86 | string(5) "key35" 87 | ["key36"]=> 88 | string(5) "key36" 89 | ["key37"]=> 90 | string(5) "key37" 91 | ["key38"]=> 92 | string(5) "key38" 93 | ["key39"]=> 94 | string(5) "key39" 95 | ["key4"]=> 96 | string(4) "key4" 97 | ["key40"]=> 98 | string(5) "key40" 99 | ["key5"]=> 100 | string(4) "key5" 101 | ["key6"]=> 102 | string(4) "key6" 103 | ["key7"]=> 104 | string(4) "key7" 105 | ["key8"]=> 106 | string(4) "key8" 107 | ["key9"]=> 108 | string(4) "key9" 109 | } 110 | ===DONE=== 111 | -------------------------------------------------------------------------------- /tests/iterator_005.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | APC: APCIterator delete 3 | --SKIPIF-- 4 | 5 | --INI-- 6 | apc.enabled=1 7 | apc.enable_cli=1 8 | apc.file_update_protection=0 9 | --FILE-- 10 | $value) { 21 | $vals[$key] = $value['key']; 22 | } 23 | foreach($it2 as $key=>$value) { 24 | $vals2[$key] = $value['key']; 25 | } 26 | ksort($vals2); 27 | var_dump($vals); 28 | var_dump($vals2); 29 | 30 | ?> 31 | ===DONE=== 32 | 33 | --EXPECT-- 34 | array(0) { 35 | } 36 | array(37) { 37 | ["key0"]=> 38 | string(4) "key0" 39 | ["key1"]=> 40 | string(4) "key1" 41 | ["key11"]=> 42 | string(5) "key11" 43 | ["key12"]=> 44 | string(5) "key12" 45 | ["key13"]=> 46 | string(5) "key13" 47 | ["key14"]=> 48 | string(5) "key14" 49 | ["key15"]=> 50 | string(5) "key15" 51 | ["key16"]=> 52 | string(5) "key16" 53 | ["key17"]=> 54 | string(5) "key17" 55 | ["key18"]=> 56 | string(5) "key18" 57 | ["key19"]=> 58 | string(5) "key19" 59 | ["key2"]=> 60 | string(4) "key2" 61 | ["key21"]=> 62 | string(5) "key21" 63 | ["key22"]=> 64 | string(5) "key22" 65 | ["key23"]=> 66 | string(5) "key23" 67 | ["key24"]=> 68 | string(5) "key24" 69 | ["key25"]=> 70 | string(5) "key25" 71 | ["key26"]=> 72 | string(5) "key26" 73 | ["key27"]=> 74 | string(5) "key27" 75 | ["key28"]=> 76 | string(5) "key28" 77 | ["key29"]=> 78 | string(5) "key29" 79 | ["key3"]=> 80 | string(4) "key3" 81 | ["key31"]=> 82 | string(5) "key31" 83 | ["key32"]=> 84 | string(5) "key32" 85 | ["key33"]=> 86 | string(5) "key33" 87 | ["key34"]=> 88 | string(5) "key34" 89 | ["key35"]=> 90 | string(5) "key35" 91 | ["key36"]=> 92 | string(5) "key36" 93 | ["key37"]=> 94 | string(5) "key37" 95 | ["key38"]=> 96 | string(5) "key38" 97 | ["key39"]=> 98 | string(5) "key39" 99 | ["key4"]=> 100 | string(4) "key4" 101 | ["key5"]=> 102 | string(4) "key5" 103 | ["key6"]=> 104 | string(4) "key6" 105 | ["key7"]=> 106 | string(4) "key7" 107 | ["key8"]=> 108 | string(4) "key8" 109 | ["key9"]=> 110 | string(4) "key9" 111 | } 112 | ===DONE=== 113 | -------------------------------------------------------------------------------- /apc_stack.h: -------------------------------------------------------------------------------- 1 | /* 2 | +----------------------------------------------------------------------+ 3 | | APC | 4 | +----------------------------------------------------------------------+ 5 | | Copyright (c) 2006-2011 The PHP Group | 6 | +----------------------------------------------------------------------+ 7 | | This source file is subject to version 3.01 of the PHP license, | 8 | | that is bundled with this package in the file LICENSE, and is | 9 | | available through the world-wide-web at the following url: | 10 | | http://www.php.net/license/3_01.txt | 11 | | If you did not receive a copy of the PHP license and are unable to | 12 | | obtain it through the world-wide-web, please send a note to | 13 | | license@php.net so we can mail you a copy immediately. | 14 | +----------------------------------------------------------------------+ 15 | | Authors: Daniel Cowgill | 16 | | George Schlossnagle | 17 | +----------------------------------------------------------------------+ 18 | 19 | This software was contributed to PHP by Community Connect Inc. in 2002 20 | and revised in 2005 by Yahoo! Inc. to add support for PHP 5.1. 21 | Future revisions and derivatives of this source code must acknowledge 22 | Community Connect Inc. as the original contributor of this module by 23 | leaving this note intact in the source code. 24 | 25 | All other licensing and usage conditions are those of the PHP Group. 26 | 27 | */ 28 | 29 | /* $Id$ */ 30 | 31 | #ifndef APC_STACK_H 32 | #define APC_STACK_H 33 | 34 | /* Basic stack datatype */ 35 | 36 | #define T apc_stack_t* 37 | typedef struct apc_stack_t apc_stack_t; /* opaque stack type */ 38 | 39 | extern T apc_stack_create(int size_hint TSRMLS_DC); 40 | extern void apc_stack_destroy(T stack TSRMLS_DC); 41 | extern void apc_stack_clear(T stack); 42 | extern void apc_stack_push(T stack, void* item TSRMLS_DC); 43 | extern void* apc_stack_pop(T stack); 44 | extern void* apc_stack_top(T stack); 45 | extern void* apc_stack_get(T stack, int n); 46 | extern int apc_stack_size(T stack); 47 | 48 | #undef T 49 | #endif 50 | 51 | /* 52 | * Local variables: 53 | * tab-width: 4 54 | * c-basic-offset: 4 55 | * End: 56 | * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker 57 | * vim<600: expandtab sw=4 ts=4 sts=4 58 | */ 59 | -------------------------------------------------------------------------------- /tests/apc_012.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | APC: apc_delete_file test with file_md5=on (see #61352) 3 | --SKIPIF-- 4 | 5 | --INI-- 6 | apc.enabled=1 7 | apc.enable_cli=1 8 | apc.file_update_protection=0 9 | apc.stat=On 10 | apc.file_md5=1 11 | report_memleaks=0 12 | --FILE-- 13 | 66 | ===DONE=== 67 | 68 | --CLEAN-- 69 | 73 | --EXPECTF-- 74 | apc_012.php Found File 75 | apc_012.php Not Found 76 | apc_012.php Not Found 77 | apc_012.php Not Found 78 | array(0) { 79 | } 80 | apc_012.php Found File 81 | apc_009-1.php Found File 82 | 83 | Parse error: syntax error, unexpected '!' in %s/apc_009-2.php on line 1 84 | 85 | Warning: apc_compile_file(): Error compiling apc_009-2.php in apc_compile_file. in %s/apc_012.php on line 29 86 | 87 | Warning: apc_compile_file(): Error compiling nofile.php in apc_compile_file. in %s/apc_012.php on line 29 88 | array(2) { 89 | ["apc_009-2.php"]=> 90 | int(-1) 91 | ["nofile.php"]=> 92 | int(-1) 93 | } 94 | apc_012.php Found File 95 | apc_009-1.php Found File 96 | apc_009-2.php Not Found 97 | nofile.php Not Found 98 | ===DONE=== 99 | -------------------------------------------------------------------------------- /tests/apc54_016.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | APC: Test trait properties in using class (simple) (php 5.4) 3 | --SKIPIF-- 4 | one; 25 | } 26 | } 27 | 28 | \$w = new World; 29 | var_dump(\$w->loud()); 30 | FL; 31 | 32 | $args = array( 33 | 'apc.cache_by_default=On', 34 | 'apc.canonicalize=On', 35 | 'apc.coredump_unmap=Off', 36 | 'apc.enable_cli=On', 37 | 'apc.enabled=On', 38 | 'apc.file_md5=Off', 39 | 'apc.file_update_protection=2', 40 | 'apc.filters=no', 41 | 'apc.gc_ttl=3600', 42 | 'apc.include_once_override=Off', 43 | 'apc.lazy_classes=Off', 44 | 'apc.lazy_functions=Off', 45 | 'apc.max_file_size=1M', 46 | 'apc.mmap_file_mask=no', 47 | 'apc.num_files_hint=1000', 48 | 'apc.preload_path=no', 49 | 'apc.report_autofilter=Off', 50 | 'apc.rfc1867=Off', 51 | 'apc.rfc1867_freq=0', 52 | 'apc.rfc1867_name=APC_UPLOAD_PROGRESS', 53 | 'apc.rfc1867_prefix=upload_', 54 | 'apc.rfc1867_ttl=3600', 55 | 'apc.serializer=default', 56 | 'apc.shm_segments=1', 57 | 'apc.shm_size=128M', 58 | 'apc.shm_strings_buffer=4M', 59 | 'apc.slam_defense=On', 60 | 'apc.stat=On', 61 | 'apc.stat_ctime=Off', 62 | 'apc.ttl=0', 63 | 'apc.use_request_time=On', 64 | 'apc.user_entries_hint=4096', 65 | 'apc.user_ttl=0', 66 | 'apc.write_lock=On', 67 | ); 68 | 69 | server_start($file, $args); 70 | 71 | for ($i = 0; $i < 10; $i++) { 72 | run_test_simple(); 73 | } 74 | echo 'done'; 75 | 76 | --EXPECT-- 77 | string(7) "123aoeu" 78 | string(7) "123aoeu" 79 | string(7) "123aoeu" 80 | string(7) "123aoeu" 81 | string(7) "123aoeu" 82 | string(7) "123aoeu" 83 | string(7) "123aoeu" 84 | string(7) "123aoeu" 85 | string(7) "123aoeu" 86 | string(7) "123aoeu" 87 | string(7) "123aoeu" 88 | string(7) "123aoeu" 89 | string(7) "123aoeu" 90 | string(7) "123aoeu" 91 | string(7) "123aoeu" 92 | string(7) "123aoeu" 93 | string(7) "123aoeu" 94 | string(7) "123aoeu" 95 | string(7) "123aoeu" 96 | string(7) "123aoeu" 97 | string(7) "123aoeu" 98 | string(7) "123aoeu" 99 | string(7) "123aoeu" 100 | string(7) "123aoeu" 101 | string(7) "123aoeu" 102 | string(7) "123aoeu" 103 | string(7) "123aoeu" 104 | string(7) "123aoeu" 105 | string(7) "123aoeu" 106 | string(7) "123aoeu" 107 | done 108 | -------------------------------------------------------------------------------- /tests/bug52144_functions.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | APC: Bug #52144 (Error: Base lambda function for closure not found) 3 | --SKIPIF-- 4 | 70 | --EXPECT-- 71 | ----------------------------- 72 | string(6) "cached" 73 | ----------------------------- 74 | string(5) "dummy" 75 | string(11) "{closure}#1" 76 | string(11) "{closure}#2" 77 | ----------------------------- 78 | string(6) "cached" 79 | ----------------------------- 80 | string(5) "dummy" 81 | string(11) "{closure}#1" 82 | string(11) "{closure}#2" 83 | ----------------------------- 84 | string(6) "cached" 85 | ----------------------------- 86 | string(5) "dummy" 87 | string(11) "{closure}#1" 88 | string(11) "{closure}#2" 89 | ----------------------------- 90 | string(6) "cached" 91 | ----------------------------- 92 | string(5) "dummy" 93 | string(11) "{closure}#1" 94 | string(11) "{closure}#2" 95 | ----------------------------- 96 | string(6) "cached" 97 | ----------------------------- 98 | string(5) "dummy" 99 | string(11) "{closure}#1" 100 | string(11) "{closure}#2" 101 | -------------------------------------------------------------------------------- /apc_debug.c: -------------------------------------------------------------------------------- 1 | /* 2 | +----------------------------------------------------------------------+ 3 | | APC | 4 | +----------------------------------------------------------------------+ 5 | | Copyright (c) 2006-2011 The PHP Group | 6 | +----------------------------------------------------------------------+ 7 | | This source file is subject to version 3.01 of the PHP license, | 8 | | that is bundled with this package in the file LICENSE, and is | 9 | | available through the world-wide-web at the following url: | 10 | | http://www.php.net/license/3_01.txt | 11 | | If you did not receive a copy of the PHP license and are unable to | 12 | | obtain it through the world-wide-web, please send a note to | 13 | | license@php.net so we can mail you a copy immediately. | 14 | +----------------------------------------------------------------------+ 15 | | Authors: Daniel Cowgill | 16 | | Arun C. Murthy | 17 | | Gopal Vijayaraghavan | 18 | +----------------------------------------------------------------------+ 19 | 20 | This software was contributed to PHP by Community Connect Inc. in 2002 21 | and revised in 2005 by Yahoo! Inc. to add support for PHP 5.1. 22 | Future revisions and derivatives of this source code must acknowledge 23 | Community Connect Inc. as the original contributor of this module by 24 | leaving this note intact in the source code. 25 | 26 | All other licensing and usage conditions are those of the PHP Group. 27 | */ 28 | 29 | /* $Id$ */ 30 | #include "apc.h" 31 | #include 32 | #include "zend.h" 33 | #include "zend_compile.h" 34 | 35 | #if defined(__DEBUG_APC__) 36 | 37 | /* keep track of vld_dump_oparray() signature */ 38 | typedef void (*vld_dump_f) (zend_op_array * TSRMLS_DC); 39 | 40 | #endif 41 | 42 | void dump(zend_op_array *op_array TSRMLS_DC) 43 | { 44 | #if defined(__DEBUG_APC__) 45 | vld_dump_f dump_op_array; 46 | DL_HANDLE handle = NULL; 47 | 48 | #ifdef PHP_WIN32 49 | handle = GetModuleHandle(NULL); 50 | 51 | if (!handle) { 52 | apc_warning("unable to fetch current module handle." TSRMLS_CC); 53 | } 54 | #endif 55 | 56 | dump_op_array = (vld_dump_f) DL_FETCH_SYMBOL(handle, "vld_dump_oparray"); 57 | 58 | #ifdef PHP_WIN32 59 | DL_UNLOAD(handle); 60 | #endif 61 | 62 | if(dump_op_array) { 63 | dump_op_array(op_array TSRMLS_CC); 64 | 65 | return; 66 | } 67 | 68 | apc_warning("vld is not installed or something even worse." TSRMLS_CC); 69 | #endif 70 | } 71 | -------------------------------------------------------------------------------- /tests/apc_009.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | APC: apc_delete_file test 3 | --SKIPIF-- 4 | 5 | 6 | --INI-- 7 | apc.enabled=1 8 | apc.enable_cli=1 9 | apc.file_update_protection=0 10 | apc.stat=On 11 | report_memleaks=0 12 | --FILE-- 13 | 69 | ===DONE=== 70 | 71 | --CLEAN-- 72 | 76 | --EXPECTF-- 77 | apc_009.php Found File 78 | apc_009.php Not Found 79 | apc_009.php Not Found 80 | apc_009.php Not Found 81 | array(0) { 82 | } 83 | apc_009.php Found File 84 | apc_009-1.php Found File 85 | 86 | Parse error: syntax error, unexpected '!' in %s/apc_009-2.php on line 1 87 | 88 | Warning: apc_compile_file(): Error compiling apc_009-2.php in apc_compile_file. in %s/apc_009.php on line 32 89 | 90 | Warning: apc_compile_file(): Error compiling nofile.php in apc_compile_file. in %s/apc_009.php on line 32 91 | array(2) { 92 | ["apc_009-2.php"]=> 93 | int(-1) 94 | ["nofile.php"]=> 95 | int(-1) 96 | } 97 | apc_009.php Found File 98 | apc_009-1.php Found File 99 | apc_009-2.php Not Found 100 | nofile.php Not Found 101 | ===DONE=== 102 | -------------------------------------------------------------------------------- /apc_windows_srwlock_kernel.h: -------------------------------------------------------------------------------- 1 | /* 2 | +----------------------------------------------------------------------+ 3 | | APC | 4 | +----------------------------------------------------------------------+ 5 | | Copyright (c) 2006-2011 The PHP Group | 6 | +----------------------------------------------------------------------+ 7 | | This source file is subject to version 3.01 of the PHP license, | 8 | | that is bundled with this package in the file LICENSE, and is | 9 | | available through the world-wide-web at the following url: | 10 | | http://www.php.net/license/3_01.txt | 11 | | If you did not receive a copy of the PHP license and are unable to | 12 | | obtain it through the world-wide-web, please send a note to | 13 | | license@php.net so we can mail you a copy immediately. | 14 | +----------------------------------------------------------------------+ 15 | | Authors: Pierre Joye | 16 | +----------------------------------------------------------------------+ 17 | */ 18 | /* $Id$ */ 19 | 20 | #ifndef APC_WINDOWS_CS_RWLOCK_H 21 | #define APC_WINDOWS_CS_RWLOCK_H 22 | 23 | #include "apc.h" 24 | 25 | #ifdef APC_SRWLOCK_KERNEL 26 | 27 | typedef struct _RTL_RWLOCK { 28 | RTL_CRITICAL_SECTION rtlCS; 29 | 30 | HANDLE hSharedReleaseSemaphore; 31 | UINT uSharedWaiters; 32 | 33 | HANDLE hExclusiveReleaseSemaphore; 34 | UINT uExclusiveWaiters; 35 | 36 | INT iNumberActive; 37 | HANDLE hOwningThreadId; 38 | DWORD dwTimeoutBoost; 39 | PVOID pDebugInfo; 40 | } RTL_RWLOCK, *LPRTL_RWLOCK; 41 | 42 | #define apc_windows_cs_rwlock_t RTL_RWLOCK 43 | 44 | struct apc_windows_cs_rwlock_t { 45 | CRITICAL_SECTION cs; 46 | LONG writers_waiting_count; 47 | LONG readers_waiting_count; 48 | DWORD active_writers_readers_flag; 49 | HANDLE ready_to_read; 50 | HANDLE ready_to_write; 51 | DWORD reader_races_lost; 52 | }; 53 | 54 | apc_windows_cs_rwlock_t *apc_windows_cs_create(apc_windows_cs_rwlock_t *lock TSRMLS_DC); 55 | void apc_windows_cs_destroy(apc_windows_cs_rwlock_t *lock); 56 | void apc_windows_cs_lock(apc_windows_cs_rwlock_t *lock TSRMLS_DC); 57 | void apc_windows_cs_rdlock(apc_windows_cs_rwlock_t *lock TSRMLS_DC); 58 | void apc_windows_cs_unlock_rd(apc_windows_cs_rwlock_t *lock TSRMLS_DC); 59 | void apc_windows_cs_unlock_wr(apc_windows_cs_rwlock_t *lock TSRMLS_DC); 60 | # if NONBLOCKING_LOCK_AVAILABLE==1 /* Only in win7/2008 */ 61 | zend_bool apc_pthreadrwlock_nonblocking_lock(apc_windows_cs_rwlock_t *lock TSRMLS_DC); 62 | # endif 63 | #endif 64 | 65 | #endif 66 | 67 | /* 68 | * Local variables: 69 | * tab-width: 4 70 | * c-basic-offset: 4 71 | * End: 72 | * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker 73 | * vim<600: expandtab sw=4 ts=4 sts=4 74 | */ 75 | -------------------------------------------------------------------------------- /tests/apc54_013.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | APC: Closures basic test 3 | --SKIPIF-- 4 | say() . ' ' . \$f()); 30 | var_dump(\$f); 31 | FL; 32 | 33 | $args = array( 34 | 'apc.enabled=1', 35 | 'apc.enable_cli=1', 36 | ); 37 | 38 | server_start($file, $args); 39 | 40 | for ($i = 0; $i < 10; $i++) { 41 | run_test_simple(); 42 | } 43 | echo 'done'; 44 | 45 | --EXPECTF-- 46 | string(11) "hello world" 47 | object(Closure)#2 (0) { 48 | } 49 | string(11) "hello world" 50 | object(Closure)#2 (0) { 51 | } 52 | string(11) "hello world" 53 | object(Closure)#2 (0) { 54 | } 55 | string(11) "hello world" 56 | object(Closure)#2 (0) { 57 | } 58 | string(11) "hello world" 59 | object(Closure)#2 (0) { 60 | } 61 | string(11) "hello world" 62 | object(Closure)#2 (0) { 63 | } 64 | string(11) "hello world" 65 | object(Closure)#2 (0) { 66 | } 67 | string(11) "hello world" 68 | object(Closure)#2 (0) { 69 | } 70 | string(11) "hello world" 71 | object(Closure)#2 (0) { 72 | } 73 | string(11) "hello world" 74 | object(Closure)#2 (0) { 75 | } 76 | string(11) "hello world" 77 | object(Closure)#2 (0) { 78 | } 79 | string(11) "hello world" 80 | object(Closure)#2 (0) { 81 | } 82 | string(11) "hello world" 83 | object(Closure)#2 (0) { 84 | } 85 | string(11) "hello world" 86 | object(Closure)#2 (0) { 87 | } 88 | string(11) "hello world" 89 | object(Closure)#2 (0) { 90 | } 91 | string(11) "hello world" 92 | object(Closure)#2 (0) { 93 | } 94 | string(11) "hello world" 95 | object(Closure)#2 (0) { 96 | } 97 | string(11) "hello world" 98 | object(Closure)#2 (0) { 99 | } 100 | string(11) "hello world" 101 | object(Closure)#2 (0) { 102 | } 103 | string(11) "hello world" 104 | object(Closure)#2 (0) { 105 | } 106 | string(11) "hello world" 107 | object(Closure)#2 (0) { 108 | } 109 | string(11) "hello world" 110 | object(Closure)#2 (0) { 111 | } 112 | string(11) "hello world" 113 | object(Closure)#2 (0) { 114 | } 115 | string(11) "hello world" 116 | object(Closure)#2 (0) { 117 | } 118 | string(11) "hello world" 119 | object(Closure)#2 (0) { 120 | } 121 | string(11) "hello world" 122 | object(Closure)#2 (0) { 123 | } 124 | string(11) "hello world" 125 | object(Closure)#2 (0) { 126 | } 127 | string(11) "hello world" 128 | object(Closure)#2 (0) { 129 | } 130 | string(11) "hello world" 131 | object(Closure)#2 (0) { 132 | } 133 | string(11) "hello world" 134 | object(Closure)#2 (0) { 135 | } 136 | done 137 | -------------------------------------------------------------------------------- /tests/symfony/Symfony/Component/Process/ProcessBuilder.php: -------------------------------------------------------------------------------- 1 | arguments = $arguments; 18 | 19 | $this->timeout = 60; 20 | $this->options = array(); 21 | $this->env = array(); 22 | $this->inheritEnv = true; 23 | } 24 | 25 | public static function create(array $arguments = array()) 26 | { 27 | return new static($arguments); 28 | } 29 | 30 | public function add($argument) 31 | { 32 | $this->arguments[] = $argument; 33 | 34 | return $this; 35 | } 36 | 37 | public function setWorkingDirectory($cwd) 38 | { 39 | $this->cwd = $cwd; 40 | 41 | return $this; 42 | } 43 | 44 | public function inheritEnvironmentVariables($inheritEnv = true) 45 | { 46 | $this->inheritEnv = $inheritEnv; 47 | 48 | return $this; 49 | } 50 | 51 | public function setEnv($name, $value) 52 | { 53 | $this->env[$name] = $value; 54 | 55 | return $this; 56 | } 57 | 58 | public function setInput($stdin) 59 | { 60 | $this->stdin = $stdin; 61 | 62 | return $this; 63 | } 64 | 65 | public function setTimeout($timeout) 66 | { 67 | if (null === $timeout) { 68 | $this->timeout = null; 69 | 70 | return $this; 71 | } 72 | 73 | $timeout = (integer) $timeout; 74 | 75 | if ($timeout < 0) { 76 | throw new \InvalidArgumentException('The timeout value must be a valid positive integer.'); 77 | } 78 | 79 | $this->timeout = $timeout; 80 | 81 | return $this; 82 | } 83 | 84 | public function setOption($name, $value) 85 | { 86 | $this->options[$name] = $value; 87 | 88 | return $this; 89 | } 90 | 91 | public function getProcess() 92 | { 93 | if (!count($this->arguments)) { 94 | throw new \LogicException('You must add() command arguments before calling getProcess().'); 95 | } 96 | 97 | $options = $this->options; 98 | 99 | $script = implode(' ', array_map('escapeshellarg', $this->arguments)); 100 | 101 | if ($this->inheritEnv) { 102 | $env = $this->env ? $this->env + $_ENV : null; 103 | } else { 104 | $env = $this->env; 105 | } 106 | 107 | return new Process($script, $this->cwd, $env, $this->stdin, $this->timeout, $options); 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /tests/symfony/Symfony/Component/HttpFoundation/FileBag.php: -------------------------------------------------------------------------------- 1 | replace($parameters); 14 | } 15 | 16 | public function replace(array $files = array()) 17 | { 18 | $this->parameters = array(); 19 | $this->add($files); 20 | } 21 | 22 | public function set($key, $value) 23 | { 24 | if (!is_array($value) && !$value instanceof UploadedFile) { 25 | throw new \InvalidArgumentException('An uploaded file must be an array or an instance of UploadedFile.'); 26 | } 27 | 28 | parent::set($key, $this->convertFileInformation($value)); 29 | } 30 | 31 | public function add(array $files = array()) 32 | { 33 | foreach ($files as $key => $file) { 34 | $this->set($key, $file); 35 | } 36 | } 37 | 38 | protected function convertFileInformation($file) 39 | { 40 | if ($file instanceof UploadedFile) { 41 | return $file; 42 | } 43 | 44 | $file = $this->fixPhpFilesArray($file); 45 | if (is_array($file)) { 46 | $keys = array_keys($file); 47 | sort($keys); 48 | 49 | if ($keys == self::$fileKeys) { 50 | if (UPLOAD_ERR_NO_FILE == $file['error']) { 51 | $file = null; 52 | } else { 53 | $file = new UploadedFile($file['tmp_name'], $file['name'], $file['type'], $file['size'], $file['error']); 54 | } 55 | } else { 56 | $file = array_map(array($this, 'convertFileInformation'), $file); 57 | } 58 | } 59 | 60 | return $file; 61 | } 62 | 63 | protected function fixPhpFilesArray($data) 64 | { 65 | if (!is_array($data)) { 66 | return $data; 67 | } 68 | 69 | $keys = array_keys($data); 70 | sort($keys); 71 | 72 | if (self::$fileKeys != $keys || !isset($data['name']) || !is_array($data['name'])) { 73 | return $data; 74 | } 75 | 76 | $files = $data; 77 | foreach (self::$fileKeys as $k) { 78 | unset($files[$k]); 79 | } 80 | 81 | foreach (array_keys($data['name']) as $key) { 82 | $files[$key] = $this->fixPhpFilesArray(array( 83 | 'error' => $data['error'][$key], 84 | 'name' => $data['name'][$key], 85 | 'type' => $data['type'][$key], 86 | 'tmp_name' => $data['tmp_name'][$key], 87 | 'size' => $data['size'][$key] 88 | )); 89 | } 90 | 91 | return $files; 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /tests/apc54_002.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | APC: interned strings same method names (php 5.4 nts) 3 | --SKIPIF-- 4 | hello(); 39 | \$two->hello(); 40 | hello(); 41 | FL; 42 | 43 | $args = array( 44 | 'apc.enabled=1', 45 | 'apc.enable_cli=1', 46 | 'apc.stat=0', 47 | ); 48 | 49 | server_start($file, $args); 50 | 51 | list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS); 52 | $port = intval($port)?:80; 53 | 54 | for ($i = 0; $i < 10; $i++) { 55 | run_test_simple(); 56 | } 57 | echo 'done'; 58 | 59 | --EXPECT-- 60 | hello class one 61 | hello class two 62 | hello function 63 | hello class one 64 | hello class two 65 | hello function 66 | hello class one 67 | hello class two 68 | hello function 69 | hello class one 70 | hello class two 71 | hello function 72 | hello class one 73 | hello class two 74 | hello function 75 | hello class one 76 | hello class two 77 | hello function 78 | hello class one 79 | hello class two 80 | hello function 81 | hello class one 82 | hello class two 83 | hello function 84 | hello class one 85 | hello class two 86 | hello function 87 | hello class one 88 | hello class two 89 | hello function 90 | hello class one 91 | hello class two 92 | hello function 93 | hello class one 94 | hello class two 95 | hello function 96 | hello class one 97 | hello class two 98 | hello function 99 | hello class one 100 | hello class two 101 | hello function 102 | hello class one 103 | hello class two 104 | hello function 105 | hello class one 106 | hello class two 107 | hello function 108 | hello class one 109 | hello class two 110 | hello function 111 | hello class one 112 | hello class two 113 | hello function 114 | hello class one 115 | hello class two 116 | hello function 117 | hello class one 118 | hello class two 119 | hello function 120 | hello class one 121 | hello class two 122 | hello function 123 | hello class one 124 | hello class two 125 | hello function 126 | hello class one 127 | hello class two 128 | hello function 129 | hello class one 130 | hello class two 131 | hello function 132 | hello class one 133 | hello class two 134 | hello function 135 | hello class one 136 | hello class two 137 | hello function 138 | hello class one 139 | hello class two 140 | hello function 141 | hello class one 142 | hello class two 143 | hello function 144 | hello class one 145 | hello class two 146 | hello function 147 | hello class one 148 | hello class two 149 | hello function 150 | done 151 | -------------------------------------------------------------------------------- /tests/apc54_bug62699.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | APC: Bug #62699 Wrong behavior with traits 3 | --SKIPIF-- 4 | test(); 34 | \$foo->test2(); 35 | \$foo->tast(); 36 | FL; 37 | 38 | $args = array( 39 | 'apc.enabled=1', 40 | 'apc.cache_by_default=1', 41 | 'apc.enable_cli=1', 42 | 'apc.shm_segments=1', 43 | 'apc.optimization=0', 44 | 'apc.shm_size=384M', 45 | 'apc.ttl=0', 46 | 'apc.user_ttl=0', 47 | 'apc.num_files_hint=4096', 48 | 'apc.canonicalize=0', 49 | 'apc.write_lock=1', 50 | ); 51 | 52 | server_start($file, $args); 53 | 54 | for ($i = 0; $i < 10; $i++) { 55 | run_test_simple(); 56 | } 57 | echo 'done'; 58 | --EXPECT-- 59 | string(3) "Foo" 60 | string(1) "A" 61 | string(1) "A" 62 | string(3) "Foo" 63 | string(1) "A" 64 | string(1) "A" 65 | string(3) "Foo" 66 | string(1) "A" 67 | string(1) "A" 68 | string(3) "Foo" 69 | string(1) "A" 70 | string(1) "A" 71 | string(3) "Foo" 72 | string(1) "A" 73 | string(1) "A" 74 | string(3) "Foo" 75 | string(1) "A" 76 | string(1) "A" 77 | string(3) "Foo" 78 | string(1) "A" 79 | string(1) "A" 80 | string(3) "Foo" 81 | string(1) "A" 82 | string(1) "A" 83 | string(3) "Foo" 84 | string(1) "A" 85 | string(1) "A" 86 | string(3) "Foo" 87 | string(1) "A" 88 | string(1) "A" 89 | string(3) "Foo" 90 | string(1) "A" 91 | string(1) "A" 92 | string(3) "Foo" 93 | string(1) "A" 94 | string(1) "A" 95 | string(3) "Foo" 96 | string(1) "A" 97 | string(1) "A" 98 | string(3) "Foo" 99 | string(1) "A" 100 | string(1) "A" 101 | string(3) "Foo" 102 | string(1) "A" 103 | string(1) "A" 104 | string(3) "Foo" 105 | string(1) "A" 106 | string(1) "A" 107 | string(3) "Foo" 108 | string(1) "A" 109 | string(1) "A" 110 | string(3) "Foo" 111 | string(1) "A" 112 | string(1) "A" 113 | string(3) "Foo" 114 | string(1) "A" 115 | string(1) "A" 116 | string(3) "Foo" 117 | string(1) "A" 118 | string(1) "A" 119 | string(3) "Foo" 120 | string(1) "A" 121 | string(1) "A" 122 | string(3) "Foo" 123 | string(1) "A" 124 | string(1) "A" 125 | string(3) "Foo" 126 | string(1) "A" 127 | string(1) "A" 128 | string(3) "Foo" 129 | string(1) "A" 130 | string(1) "A" 131 | string(3) "Foo" 132 | string(1) "A" 133 | string(1) "A" 134 | string(3) "Foo" 135 | string(1) "A" 136 | string(1) "A" 137 | string(3) "Foo" 138 | string(1) "A" 139 | string(1) "A" 140 | string(3) "Foo" 141 | string(1) "A" 142 | string(1) "A" 143 | string(3) "Foo" 144 | string(1) "A" 145 | string(1) "A" 146 | string(3) "Foo" 147 | string(1) "A" 148 | string(1) "A" 149 | done 150 | -------------------------------------------------------------------------------- /apc_php.h: -------------------------------------------------------------------------------- 1 | /* 2 | +----------------------------------------------------------------------+ 3 | | APC | 4 | +----------------------------------------------------------------------+ 5 | | Copyright (c) 2006-2011 The PHP Group | 6 | +----------------------------------------------------------------------+ 7 | | This source file is subject to version 3.01 of the PHP license, | 8 | | that is bundled with this package in the file LICENSE, and is | 9 | | available through the world-wide-web at the following url: | 10 | | http://www.php.net/license/3_01.txt | 11 | | If you did not receive a copy of the PHP license and are unable to | 12 | | obtain it through the world-wide-web, please send a note to | 13 | | license@php.net so we can mail you a copy immediately. | 14 | +----------------------------------------------------------------------+ 15 | | Authors: Daniel Cowgill | 16 | | George Schlossnagle | 17 | | Rasmus Lerdorf | 18 | | Arun C. Murthy | 19 | | Gopal Vijayaraghavan | 20 | +----------------------------------------------------------------------+ 21 | 22 | This software was contributed to PHP by Community Connect Inc. in 2002 23 | and revised in 2005 by Yahoo! Inc. to add support for PHP 5.1. 24 | Future revisions and derivatives of this source code must acknowledge 25 | Community Connect Inc. as the original contributor of this module by 26 | leaving this note intact in the source code. 27 | 28 | All other licensing and usage conditions are those of the PHP Group. 29 | 30 | */ 31 | 32 | /* $Id$ */ 33 | 34 | #ifndef APC_PHP_H 35 | #define APC_PHP_H 36 | 37 | /* 38 | * The purpose of this header file is to include all PHP and Zend headers that 39 | * are typically needed elsewhere in APC. This makes it easy to insure that 40 | * all required headers are available. 41 | */ 42 | 43 | #include "php.h" 44 | #include "zend.h" 45 | #include "zend_API.h" 46 | #include "zend_compile.h" 47 | #include "zend_hash.h" 48 | #include "zend_extensions.h" 49 | 50 | #if ZEND_MODULE_API_NO >= 20121204 51 | #define ZEND_ENGINE_2_5 52 | #endif 53 | #if ZEND_MODULE_API_NO >= 20100409 54 | #define ZEND_ENGINE_2_4 55 | #endif 56 | #if ZEND_MODULE_API_NO > 20060613 57 | #define ZEND_ENGINE_2_3 58 | #endif 59 | #if ZEND_MODULE_API_NO > 20050922 60 | #define ZEND_ENGINE_2_2 61 | #endif 62 | #if ZEND_MODULE_API_NO > 20050921 63 | #define ZEND_ENGINE_2_1 64 | #endif 65 | #ifdef ZEND_ENGINE_2_1 66 | #include "zend_vm.h" 67 | #endif 68 | 69 | #ifndef IS_CONSTANT_TYPE_MASK 70 | #define IS_CONSTANT_TYPE_MASK (~IS_CONSTANT_INDEX) 71 | #endif 72 | 73 | #include "rfc1867.h" 74 | 75 | #endif 76 | 77 | /* 78 | * Local variables: 79 | * tab-width: 4 80 | * c-basic-offset: 4 81 | * End: 82 | * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker 83 | * vim<600: expandtab sw=4 ts=4 sts=4 84 | */ 85 | -------------------------------------------------------------------------------- /tests/bug61398_2.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Bug #61398 APC fails to find class methods (based on ext/standard/tests/file/fopencookie.phpt) 3 | --SKIPIF-- 4 | data, \$this->position, \$count); 32 | \$this->position += strlen(\$ret); 33 | return \$ret; 34 | } 35 | 36 | function stream_tell() 37 | { 38 | return \$this->position; 39 | } 40 | 41 | function stream_eof() 42 | { 43 | return \$this->position >= strlen(\$this->data); 44 | } 45 | 46 | function stream_seek(\$offset, \$whence) 47 | { 48 | switch(\$whence) { 49 | case SEEK_SET: 50 | if (\$offset < strlen(\$this->data) && \$offset >= 0) { 51 | \$this->position = \$offset; 52 | return true; 53 | } else { 54 | return false; 55 | } 56 | break; 57 | case SEEK_CUR: 58 | if (\$offset >= 0) { 59 | \$this->position += \$offset; 60 | return true; 61 | } else { 62 | return false; 63 | } 64 | break; 65 | case SEEK_END: 66 | if (strlen(\$this->data) + \$offset >= 0) { 67 | \$this->position = strlen(\$this->data) + \$offset; 68 | return true; 69 | } else { 70 | return false; 71 | } 72 | break; 73 | default: 74 | return false; 75 | } 76 | } 77 | function stream_stat() { 78 | return array('size' => strlen(\$this->data)); 79 | } 80 | } 81 | stream_wrapper_register("cookietest", "userstream"); 82 | include("cookietest://foo"); 83 | FL; 84 | 85 | server_start($file, $args); 86 | 87 | for ($i = 0; $i < 10; $i++) { 88 | run_test_simple(); 89 | } 90 | echo 'done'; 91 | ?> 92 | --EXPECT-- 93 | If you can read this, it worked 94 | If you can read this, it worked 95 | If you can read this, it worked 96 | If you can read this, it worked 97 | If you can read this, it worked 98 | If you can read this, it worked 99 | If you can read this, it worked 100 | If you can read this, it worked 101 | If you can read this, it worked 102 | If you can read this, it worked 103 | If you can read this, it worked 104 | If you can read this, it worked 105 | If you can read this, it worked 106 | If you can read this, it worked 107 | If you can read this, it worked 108 | If you can read this, it worked 109 | If you can read this, it worked 110 | If you can read this, it worked 111 | If you can read this, it worked 112 | If you can read this, it worked 113 | If you can read this, it worked 114 | If you can read this, it worked 115 | If you can read this, it worked 116 | If you can read this, it worked 117 | If you can read this, it worked 118 | If you can read this, it worked 119 | If you can read this, it worked 120 | If you can read this, it worked 121 | If you can read this, it worked 122 | If you can read this, it worked 123 | done 124 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------- 2 | The PHP License, version 3.01 3 | Copyright (c) 1999 - 2011 The PHP Group. All rights reserved. 4 | -------------------------------------------------------------------- 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, is permitted provided that the following conditions 8 | are met: 9 | 10 | 1. Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | 13 | 2. Redistributions in binary form must reproduce the above copyright 14 | notice, this list of conditions and the following disclaimer in 15 | the documentation and/or other materials provided with the 16 | distribution. 17 | 18 | 3. The name "PHP" must not be used to endorse or promote products 19 | derived from this software without prior written permission. For 20 | written permission, please contact group@php.net. 21 | 22 | 4. Products derived from this software may not be called "PHP", nor 23 | may "PHP" appear in their name, without prior written permission 24 | from group@php.net. You may indicate that your software works in 25 | conjunction with PHP by saying "Foo for PHP" instead of calling 26 | it "PHP Foo" or "phpfoo" 27 | 28 | 5. The PHP Group may publish revised and/or new versions of the 29 | license from time to time. Each version will be given a 30 | distinguishing version number. 31 | Once covered code has been published under a particular version 32 | of the license, you may always continue to use it under the terms 33 | of that version. You may also choose to use such covered code 34 | under the terms of any subsequent version of the license 35 | published by the PHP Group. No one other than the PHP Group has 36 | the right to modify the terms applicable to covered code created 37 | under this License. 38 | 39 | 6. Redistributions of any form whatsoever must retain the following 40 | acknowledgment: 41 | "This product includes PHP software, freely available from 42 | ". 43 | 44 | THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND 45 | ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 46 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 47 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PHP 48 | DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 49 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 50 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 51 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 52 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 53 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 54 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 55 | OF THE POSSIBILITY OF SUCH DAMAGE. 56 | 57 | -------------------------------------------------------------------- 58 | 59 | This software consists of voluntary contributions made by many 60 | individuals on behalf of the PHP Group. 61 | 62 | The PHP Group can be contacted via Email at group@php.net. 63 | 64 | For more information on the PHP Group and the PHP project, 65 | please see . 66 | 67 | PHP includes the Zend Engine, freely available at 68 | . 69 | -------------------------------------------------------------------------------- /apc_main.h: -------------------------------------------------------------------------------- 1 | /* 2 | +----------------------------------------------------------------------+ 3 | | APC | 4 | +----------------------------------------------------------------------+ 5 | | Copyright (c) 2006-2011 The PHP Group | 6 | +----------------------------------------------------------------------+ 7 | | This source file is subject to version 3.01 of the PHP license, | 8 | | that is bundled with this package in the file LICENSE, and is | 9 | | available through the world-wide-web at the following url: | 10 | | http://www.php.net/license/3_01.txt | 11 | | If you did not receive a copy of the PHP license and are unable to | 12 | | obtain it through the world-wide-web, please send a note to | 13 | | license@php.net so we can mail you a copy immediately. | 14 | +----------------------------------------------------------------------+ 15 | | Authors: Daniel Cowgill | 16 | | George Schlossnagle | 17 | | Rasmus Lerdorf | 18 | | Arun C. Murthy | 19 | | Gopal Vijayaraghavan | 20 | +----------------------------------------------------------------------+ 21 | 22 | This software was contributed to PHP by Community Connect Inc. in 2002 23 | and revised in 2005 by Yahoo! Inc. to add support for PHP 5.1. 24 | Future revisions and derivatives of this source code must acknowledge 25 | Community Connect Inc. as the original contributor of this module by 26 | leaving this note intact in the source code. 27 | 28 | All other licensing and usage conditions are those of the PHP Group. 29 | 30 | */ 31 | 32 | /* $Id$ */ 33 | 34 | #ifndef APC_MAIN_H 35 | #define APC_MAIN_H 36 | 37 | #include "apc_pool.h" 38 | #include "apc_serializer.h" 39 | 40 | /* 41 | * This module provides the primary interface between PHP and APC. 42 | */ 43 | 44 | extern int apc_module_init(int module_number TSRMLS_DC); 45 | extern int apc_module_shutdown(TSRMLS_D); 46 | extern int apc_process_init(int module_number TSRMLS_DC); 47 | extern int apc_process_shutdown(TSRMLS_D); 48 | extern int apc_request_init(TSRMLS_D); 49 | extern int apc_request_shutdown(TSRMLS_D); 50 | 51 | typedef enum _apc_copy_type { 52 | APC_NO_COPY = 0, 53 | APC_COPY_IN_OPCODE, 54 | APC_COPY_OUT_OPCODE, 55 | APC_COPY_IN_USER, 56 | APC_COPY_OUT_USER 57 | } apc_copy_type; 58 | 59 | typedef struct _apc_context_t 60 | { 61 | apc_pool *pool; 62 | apc_copy_type copy; 63 | unsigned int force_update:1; 64 | } apc_context_t; 65 | 66 | /* {{{ struct apc_serializer_t */ 67 | typedef struct apc_serializer_t apc_serializer_t; 68 | struct apc_serializer_t { 69 | const char *name; 70 | apc_serialize_t serialize; 71 | apc_unserialize_t unserialize; 72 | void *config; 73 | }; 74 | /* }}} */ 75 | 76 | apc_serializer_t* apc_get_serializers(TSRMLS_D); 77 | apc_serializer_t* apc_find_serializer(const char* name TSRMLS_DC); 78 | 79 | #endif 80 | 81 | /* 82 | * Local variables: 83 | * tab-width: 4 84 | * c-basic-offset: 4 85 | * End: 86 | * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker 87 | * vim<600: expandtab sw=4 ts=4 sts=4 88 | */ 89 | -------------------------------------------------------------------------------- /tests/apc54_019.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | APC: Bug #59907 Issue with custom stream wrapper, include and APC 3 | --SKIPIF-- 4 | path = \$path; 24 | 25 | return true; 26 | } 27 | 28 | public function stream_read(\$count) { 29 | 30 | \$ret = substr(self::\$data[\$this->path], \$this->position, \$count); 31 | \$this->position += strlen(\$ret); 32 | 33 | return \$ret; 34 | } 35 | 36 | public function stream_write(\$data) { 37 | 38 | self::\$data[\$this->path] = \$data; 39 | 40 | return strlen(\$data); 41 | } 42 | 43 | public function stream_tell() { 44 | 45 | return \$this->position; 46 | } 47 | 48 | public function stream_eof() { 49 | 50 | return \$this->position >= strlen(self::\$data[\$this->path]); 51 | } 52 | 53 | public function url_stat(\$path, \$flags) { 54 | 55 | return \$this->stream_stat(); 56 | } 57 | 58 | public function stream_stat() { 59 | 60 | \$stat = array( 61 | 'dev' => 1, 62 | 'ino' => 1, 63 | 'mode' => 1, 64 | 'nlink' => 1, 65 | 'uid' => 1, 66 | 'gid' => 1, 67 | 'rdev' => 1, 68 | 'size' => 1, 69 | 'atime' => 1, 70 | 'mtime' => 1, 71 | 'ctime' => 1, 72 | 'blksize' => 1, 73 | 'blocks' => 1 74 | ); 75 | 76 | return array_merge(array_values(\$stat), \$stat); 77 | } 78 | } 79 | 80 | stream_wrapper_register(StreamWrapper::PROTOCOL, 'StreamWrapper'); 81 | 82 | \$class1 = 'format('U'); 29 | } elseif (!is_numeric($expire)) { 30 | $expire = strtotime($expire); 31 | 32 | if (false === $expire || -1 === $expire) { 33 | throw new \InvalidArgumentException('The cookie expiration time is not valid.'); 34 | } 35 | } 36 | 37 | $this->name = $name; 38 | $this->value = $value; 39 | $this->domain = $domain; 40 | $this->expire = $expire; 41 | $this->path = empty($path) ? '/' : $path; 42 | $this->secure = (Boolean) $secure; 43 | $this->httpOnly = (Boolean) $httpOnly; 44 | } 45 | 46 | public function __toString() 47 | { 48 | $str = urlencode($this->getName()).'='; 49 | 50 | if ('' === (string) $this->getValue()) { 51 | $str .= 'deleted; expires='.gmdate("D, d-M-Y H:i:s T", time() - 31536001); 52 | } else { 53 | $str .= urlencode($this->getValue()); 54 | 55 | if ($this->getExpiresTime() !== 0) { 56 | $str .= '; expires='.gmdate("D, d-M-Y H:i:s T", $this->getExpiresTime()); 57 | } 58 | } 59 | 60 | if ('/' !== $this->path) { 61 | $str .= '; path='.$this->path; 62 | } 63 | 64 | if (null !== $this->getDomain()) { 65 | $str .= '; domain='.$this->getDomain(); 66 | } 67 | 68 | if (true === $this->isSecure()) { 69 | $str .= '; secure'; 70 | } 71 | 72 | if (true === $this->isHttpOnly()) { 73 | $str .= '; httponly'; 74 | } 75 | 76 | return $str; 77 | } 78 | 79 | public function getName() 80 | { 81 | return $this->name; 82 | } 83 | 84 | public function getValue() 85 | { 86 | return $this->value; 87 | } 88 | 89 | public function getDomain() 90 | { 91 | return $this->domain; 92 | } 93 | 94 | public function getExpiresTime() 95 | { 96 | return $this->expire; 97 | } 98 | 99 | public function getPath() 100 | { 101 | return $this->path; 102 | } 103 | 104 | public function isSecure() 105 | { 106 | return $this->secure; 107 | } 108 | 109 | public function isHttpOnly() 110 | { 111 | return $this->httpOnly; 112 | } 113 | 114 | public function isCleared() 115 | { 116 | return $this->expire < time(); 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /tests/symfony/Symfony/Component/ClassLoader/ClassLoader.php: -------------------------------------------------------------------------------- 1 | prefixes; 14 | } 15 | 16 | public function getFallbackDirs() 17 | { 18 | return $this->fallbackDirs; 19 | } 20 | 21 | public function addPrefixes(array $prefixes) 22 | { 23 | foreach ($prefixes as $prefix => $path) { 24 | $this->addPrefix($prefix, $path); 25 | } 26 | } 27 | 28 | public function addPrefix($prefix, $paths) 29 | { 30 | if (!$prefix) { 31 | foreach ((array) $paths as $path) { 32 | $this->fallbackDirs[] = $path; 33 | } 34 | 35 | return; 36 | } 37 | if (isset($this->prefixes[$prefix])) { 38 | $this->prefixes[$prefix] = array_merge( 39 | $this->prefixes[$prefix], 40 | (array) $paths 41 | ); 42 | } else { 43 | $this->prefixes[$prefix] = (array) $paths; 44 | } 45 | } 46 | 47 | public function setUseIncludePath($useIncludePath) 48 | { 49 | $this->useIncludePath = $useIncludePath; 50 | } 51 | 52 | public function getUseIncludePath() 53 | { 54 | return $this->useIncludePath; 55 | } 56 | 57 | public function register($prepend = false) 58 | { 59 | spl_autoload_register(array($this, 'loadClass'), true, $prepend); 60 | } 61 | 62 | public function unregister() 63 | { 64 | spl_autoload_unregister(array($this, 'loadClass')); 65 | } 66 | 67 | public function loadClass($class) 68 | { 69 | if ($file = $this->findFile($class)) { 70 | require $file; 71 | 72 | return true; 73 | } 74 | } 75 | 76 | public function findFile($class) 77 | { 78 | if ('\\' == $class[0]) { 79 | $class = substr($class, 1); 80 | } 81 | 82 | if (false !== $pos = strrpos($class, '\\')) { 83 | // namespaced class name 84 | $classPath = str_replace('\\', DIRECTORY_SEPARATOR, substr($class, 0, $pos)) . DIRECTORY_SEPARATOR; 85 | $className = substr($class, $pos + 1); 86 | } else { 87 | // PEAR-like class name 88 | $classPath = null; 89 | $className = $class; 90 | } 91 | 92 | $classPath .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php'; 93 | 94 | foreach ($this->prefixes as $prefix => $dirs) { 95 | if (0 === strpos($class, $prefix)) { 96 | foreach ($dirs as $dir) { 97 | if (file_exists($dir . DIRECTORY_SEPARATOR . $classPath)) { 98 | return $dir . DIRECTORY_SEPARATOR . $classPath; 99 | } 100 | } 101 | } 102 | } 103 | 104 | foreach ($this->fallbackDirs as $dir) { 105 | if (file_exists($dir . DIRECTORY_SEPARATOR . $classPath)) { 106 | return $dir . DIRECTORY_SEPARATOR . $classPath; 107 | } 108 | } 109 | 110 | if ($this->useIncludePath && $file = stream_resolve_include_path($classPath)) { 111 | return $file; 112 | } 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /tests/bug63491.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | APC: Bug #63491 file_md5 value was wrong when use apc_bin_load function 3 | --SKIPIF-- 4 | | 16 | +----------------------------------------------------------------------+ 17 | 18 | */ 19 | 20 | /* $Id: $ */ 21 | 22 | #ifndef APC_SERIALIZER_H 23 | #define APC_SERIALIZER_H 24 | 25 | /* this is a shipped .h file, do not include any other header in this file */ 26 | #define APC_SERIALIZER_NAME(module) module##_apc_serializer 27 | #define APC_UNSERIALIZER_NAME(module) module##_apc_unserializer 28 | 29 | #define APC_SERIALIZER_ARGS unsigned char **buf, size_t *buf_len, const zval *value, void *config TSRMLS_DC 30 | #define APC_UNSERIALIZER_ARGS zval **value, unsigned char *buf, size_t buf_len, void *config TSRMLS_DC 31 | 32 | typedef int (*apc_serialize_t)(APC_SERIALIZER_ARGS); 33 | typedef int (*apc_unserialize_t)(APC_UNSERIALIZER_ARGS); 34 | 35 | typedef int (*apc_register_serializer_t)(const char* name, 36 | apc_serialize_t serialize, 37 | apc_unserialize_t unserialize, 38 | void *config TSRMLS_DC); 39 | 40 | /* 41 | * ABI version for constant hooks. Increment this any time you make any changes 42 | * to any function in this file. 43 | */ 44 | #define APC_SERIALIZER_ABI "0" 45 | #define APC_SERIALIZER_CONSTANT "\000apc_register_serializer-" APC_SERIALIZER_ABI 46 | 47 | #if !defined(APC_UNUSED) 48 | # if defined(__GNUC__) 49 | # define APC_UNUSED __attribute__((unused)) 50 | # else 51 | # define APC_UNUSED 52 | # endif 53 | #endif 54 | 55 | static APC_UNUSED int apc_register_serializer(const char* name, 56 | apc_serialize_t serialize, 57 | apc_unserialize_t unserialize, 58 | void *config TSRMLS_DC) 59 | { 60 | zval apc_magic_constant; 61 | int retval = 0; 62 | 63 | /* zend_get_constant will return 1 on success, otherwise apc_magic_constant wouldn't be touched at all */ 64 | if (zend_get_constant(APC_SERIALIZER_CONSTANT, sizeof(APC_SERIALIZER_CONSTANT)-1, &apc_magic_constant TSRMLS_CC)) { 65 | apc_register_serializer_t register_func = (apc_register_serializer_t)(Z_LVAL(apc_magic_constant)); 66 | if(register_func) { 67 | retval = register_func(name, serialize, unserialize, NULL TSRMLS_CC); 68 | } 69 | zval_dtor(&apc_magic_constant); 70 | } 71 | 72 | return retval; 73 | } 74 | 75 | #endif 76 | 77 | /* 78 | * Local variables: 79 | * tab-width: 4 80 | * c-basic-offset: 4 81 | * End: 82 | * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker 83 | * vim<600: expandtab sw=4 ts=4 sts=4 84 | */ 85 | -------------------------------------------------------------------------------- /apc_stack.c: -------------------------------------------------------------------------------- 1 | /* 2 | +----------------------------------------------------------------------+ 3 | | APC | 4 | +----------------------------------------------------------------------+ 5 | | Copyright (c) 2006-2011 The PHP Group | 6 | +----------------------------------------------------------------------+ 7 | | This source file is subject to version 3.01 of the PHP license, | 8 | | that is bundled with this package in the file LICENSE, and is | 9 | | available through the world-wide-web at the following url: | 10 | | http://www.php.net/license/3_01.txt | 11 | | If you did not receive a copy of the PHP license and are unable to | 12 | | obtain it through the world-wide-web, please send a note to | 13 | | license@php.net so we can mail you a copy immediately. | 14 | +----------------------------------------------------------------------+ 15 | | Authors: Daniel Cowgill | 16 | +----------------------------------------------------------------------+ 17 | 18 | This software was contributed to PHP by Community Connect Inc. in 2002 19 | and revised in 2005 by Yahoo! Inc. to add support for PHP 5.1. 20 | Future revisions and derivatives of this source code must acknowledge 21 | Community Connect Inc. as the original contributor of this module by 22 | leaving this note intact in the source code. 23 | 24 | All other licensing and usage conditions are those of the PHP Group. 25 | 26 | */ 27 | 28 | /* $Id$ */ 29 | 30 | #include "apc.h" 31 | #include "apc_stack.h" 32 | 33 | struct apc_stack_t { 34 | void** data; 35 | int capacity; 36 | int size; 37 | }; 38 | 39 | apc_stack_t* apc_stack_create(int size_hint TSRMLS_DC) 40 | { 41 | apc_stack_t* stack = (apc_stack_t*) apc_emalloc(sizeof(apc_stack_t) TSRMLS_CC); 42 | 43 | stack->capacity = (size_hint > 0) ? size_hint : 10; 44 | stack->size = 0; 45 | stack->data = (void**) apc_emalloc(sizeof(void*) * stack->capacity TSRMLS_CC); 46 | 47 | return stack; 48 | } 49 | 50 | void apc_stack_destroy(apc_stack_t* stack TSRMLS_DC) 51 | { 52 | if (stack != NULL) { 53 | apc_efree(stack->data TSRMLS_CC); 54 | apc_efree(stack TSRMLS_CC); 55 | } 56 | } 57 | 58 | void apc_stack_clear(apc_stack_t* stack) 59 | { 60 | assert(stack != NULL); 61 | stack->size = 0; 62 | } 63 | 64 | void apc_stack_push(apc_stack_t* stack, void* item TSRMLS_DC) 65 | { 66 | assert(stack != NULL); 67 | if (stack->size == stack->capacity) { 68 | stack->capacity *= 2; 69 | stack->data = apc_erealloc(stack->data, sizeof(void*)*stack->capacity TSRMLS_CC); 70 | } 71 | stack->data[stack->size++] = item; 72 | } 73 | 74 | void* apc_stack_pop(apc_stack_t* stack) 75 | { 76 | assert(stack != NULL && stack->size > 0); 77 | return stack->data[--stack->size]; 78 | } 79 | 80 | void* apc_stack_top(apc_stack_t* stack) 81 | { 82 | assert(stack != NULL && stack->size > 0); 83 | return stack->data[stack->size-1]; 84 | } 85 | 86 | void* apc_stack_get(apc_stack_t* stack, int n) 87 | { 88 | assert(stack != NULL && stack->size > n); 89 | return stack->data[n]; 90 | } 91 | 92 | int apc_stack_size(apc_stack_t* stack) 93 | { 94 | assert(stack != NULL); 95 | return stack->size; 96 | } 97 | 98 | 99 | /* 100 | * Local variables: 101 | * tab-width: 4 102 | * c-basic-offset: 4 103 | * End: 104 | * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker 105 | * vim<600: expandtab sw=4 ts=4 sts=4 106 | */ 107 | -------------------------------------------------------------------------------- /apc_php_pcre.h: -------------------------------------------------------------------------------- 1 | /* 2 | +----------------------------------------------------------------------+ 3 | | APC/PHP Version 5 | 4 | +----------------------------------------------------------------------+ 5 | | Copyright (c) 1997-2011 The PHP Group | 6 | +----------------------------------------------------------------------+ 7 | | This source file is subject to version 3.01 of the PHP license, | 8 | | that is bundled with this package in the file LICENSE, and is | 9 | | available through the world-wide-web at the following url: | 10 | | http://www.php.net/license/3_01.txt | 11 | | If you did not receive a copy of the PHP license and are unable to | 12 | | obtain it through the world-wide-web, please send a note to | 13 | | license@php.net so we can mail you a copy immediately. | 14 | +----------------------------------------------------------------------+ 15 | | Author: Andrei Zmievski | 16 | +----------------------------------------------------------------------+ 17 | */ 18 | 19 | /* $Id$ */ 20 | 21 | #ifndef PHP_PCRE_H 22 | #define PHP_PCRE_H 23 | 24 | #if HAVE_PCRE || HAVE_BUNDLED_PCRE 25 | 26 | #if HAVE_BUNDLED_PCRE 27 | #include "ext/pcre/pcrelib/pcre.h" 28 | #else 29 | #include "pcre.h" 30 | #endif 31 | 32 | #include 33 | 34 | PHP_FUNCTION(preg_match); 35 | PHP_FUNCTION(preg_match_all); 36 | PHP_FUNCTION(preg_replace); 37 | PHP_FUNCTION(preg_replace_callback); 38 | PHP_FUNCTION(preg_split); 39 | PHP_FUNCTION(preg_quote); 40 | PHP_FUNCTION(preg_grep); 41 | 42 | PHPAPI char *php_pcre_replace(char *regex, int regex_len, char *subject, int subject_len, zval *replace_val, int is_callable_replace, int *result_len, int limit, int *replace_count TSRMLS_DC); 43 | PHPAPI pcre* pcre_get_compiled_regex(char *regex, pcre_extra **extra, int *options TSRMLS_DC); 44 | PHPAPI pcre* pcre_get_compiled_regex_ex(char *regex, pcre_extra **extra, int *preg_options, int *coptions TSRMLS_DC); 45 | 46 | extern zend_module_entry pcre_module_entry; 47 | #define pcre_module_ptr &pcre_module_entry 48 | 49 | typedef struct { 50 | pcre *re; 51 | pcre_extra *extra; 52 | int preg_options; 53 | char *locale; 54 | unsigned const char *tables; 55 | int compile_options; 56 | int refcount; 57 | } pcre_cache_entry; 58 | 59 | PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_len TSRMLS_DC); 60 | 61 | PHPAPI void php_pcre_match_impl( pcre_cache_entry *pce, char *subject, int subject_len, zval *return_value, 62 | zval *subpats, int global, int use_flags, long flags, long start_offset TSRMLS_DC); 63 | 64 | PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, int subject_len, zval *return_value, 65 | int is_callable_replace, int *result_len, int limit, int *replace_count TSRMLS_DC); 66 | 67 | PHPAPI void php_pcre_split_impl( pcre_cache_entry *pce, char *subject, int subject_len, zval *return_value, 68 | long limit_val, long flags TSRMLS_DC); 69 | 70 | PHPAPI void php_pcre_grep_impl( pcre_cache_entry *pce, zval *input, zval *return_value, 71 | long flags TSRMLS_DC); 72 | 73 | ZEND_BEGIN_MODULE_GLOBALS(pcre) 74 | HashTable pcre_cache; 75 | long backtrack_limit; 76 | long recursion_limit; 77 | int error_code; 78 | ZEND_END_MODULE_GLOBALS(pcre) 79 | 80 | #ifdef ZTS 81 | # define PCRE_G(v) TSRMG(pcre_globals_id, zend_pcre_globals *, v) 82 | #else 83 | # define PCRE_G(v) (pcre_globals.v) 84 | #endif 85 | 86 | #else 87 | 88 | #define pcre_module_ptr NULL 89 | 90 | #endif /* HAVE_PCRE || HAVE_BUNDLED_PCRE */ 91 | 92 | #define phpext_pcre_ptr pcre_module_ptr 93 | 94 | #endif /* PHP_PCRE_H */ 95 | -------------------------------------------------------------------------------- /tests/apc54_017.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | APC: Test use trait properties in a class and its parent (php 5.4) 3 | --SKIPIF-- 4 | me . ' | ' . \$this->one . ' | ' . \$this->two . ' | ' . \$this->three; 37 | } 38 | } 39 | 40 | \$w = new World; 41 | var_dump(\$w->loud()); 42 | FL; 43 | 44 | $args = array( 45 | 'apc.cache_by_default=On', 46 | 'apc.canonicalize=On', 47 | 'apc.coredump_unmap=Off', 48 | 'apc.enable_cli=On', 49 | 'apc.enabled=On', 50 | 'apc.file_md5=Off', 51 | 'apc.file_update_protection=2', 52 | 'apc.filters=no', 53 | 'apc.gc_ttl=3600', 54 | 'apc.include_once_override=Off', 55 | 'apc.lazy_classes=Off', 56 | 'apc.lazy_functions=Off', 57 | 'apc.max_file_size=1M', 58 | 'apc.mmap_file_mask=no', 59 | 'apc.num_files_hint=1000', 60 | 'apc.preload_path=no', 61 | 'apc.report_autofilter=Off', 62 | 'apc.rfc1867=Off', 63 | 'apc.rfc1867_freq=0', 64 | 'apc.rfc1867_name=APC_UPLOAD_PROGRESS', 65 | 'apc.rfc1867_prefix=upload_', 66 | 'apc.rfc1867_ttl=3600', 67 | 'apc.serializer=default', 68 | 'apc.shm_segments=1', 69 | 'apc.shm_size=128M', 70 | 'apc.shm_strings_buffer=4M', 71 | 'apc.slam_defense=On', 72 | 'apc.stat=On', 73 | 'apc.stat_ctime=Off', 74 | 'apc.ttl=0', 75 | 'apc.use_request_time=On', 76 | 'apc.user_entries_hint=4096', 77 | 'apc.user_ttl=0', 78 | 'apc.write_lock=On', 79 | ); 80 | 81 | server_start($file, $args); 82 | 83 | for ($i = 0; $i < 10; $i++) { 84 | run_test_simple(); 85 | } 86 | echo 'done'; 87 | 88 | --EXPECT-- 89 | string(36) "self | trait | parent | parent trait" 90 | string(36) "self | trait | parent | parent trait" 91 | string(36) "self | trait | parent | parent trait" 92 | string(36) "self | trait | parent | parent trait" 93 | string(36) "self | trait | parent | parent trait" 94 | string(36) "self | trait | parent | parent trait" 95 | string(36) "self | trait | parent | parent trait" 96 | string(36) "self | trait | parent | parent trait" 97 | string(36) "self | trait | parent | parent trait" 98 | string(36) "self | trait | parent | parent trait" 99 | string(36) "self | trait | parent | parent trait" 100 | string(36) "self | trait | parent | parent trait" 101 | string(36) "self | trait | parent | parent trait" 102 | string(36) "self | trait | parent | parent trait" 103 | string(36) "self | trait | parent | parent trait" 104 | string(36) "self | trait | parent | parent trait" 105 | string(36) "self | trait | parent | parent trait" 106 | string(36) "self | trait | parent | parent trait" 107 | string(36) "self | trait | parent | parent trait" 108 | string(36) "self | trait | parent | parent trait" 109 | string(36) "self | trait | parent | parent trait" 110 | string(36) "self | trait | parent | parent trait" 111 | string(36) "self | trait | parent | parent trait" 112 | string(36) "self | trait | parent | parent trait" 113 | string(36) "self | trait | parent | parent trait" 114 | string(36) "self | trait | parent | parent trait" 115 | string(36) "self | trait | parent | parent trait" 116 | string(36) "self | trait | parent | parent trait" 117 | string(36) "self | trait | parent | parent trait" 118 | string(36) "self | trait | parent | parent trait" 119 | done 120 | -------------------------------------------------------------------------------- /tests/bug45910.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | APC: Bug #63669 Cannot declare self-referencing constant 3 | --SKIPIF-- 4 | 'a', 22 | self::CCC => 'b', 23 | self::DDD => self::AAA 24 | ); 25 | 26 | public static function test() { 27 | var_dump(self::\$foo); 28 | } 29 | } 30 | 31 | foo::test(); 32 | FL; 33 | 34 | $args = array( 35 | 'apc.enabled=1', 36 | 'apc.enable_cli=1', 37 | 'apc.shm_size=256M', 38 | ); 39 | 40 | server_start($file, $args); 41 | 42 | for ($i = 0; $i < 10; $i++) { 43 | run_test_simple(); 44 | } 45 | echo 'done'; 46 | 47 | --EXPECTF-- 48 | array(2) { 49 | ["a"]=> 50 | string(1) "b" 51 | ["x"]=> 52 | string(1) "x" 53 | } 54 | array(2) { 55 | ["a"]=> 56 | string(1) "b" 57 | ["x"]=> 58 | string(1) "x" 59 | } 60 | array(2) { 61 | ["a"]=> 62 | string(1) "b" 63 | ["x"]=> 64 | string(1) "x" 65 | } 66 | array(2) { 67 | ["a"]=> 68 | string(1) "b" 69 | ["x"]=> 70 | string(1) "x" 71 | } 72 | array(2) { 73 | ["a"]=> 74 | string(1) "b" 75 | ["x"]=> 76 | string(1) "x" 77 | } 78 | array(2) { 79 | ["a"]=> 80 | string(1) "b" 81 | ["x"]=> 82 | string(1) "x" 83 | } 84 | array(2) { 85 | ["a"]=> 86 | string(1) "b" 87 | ["x"]=> 88 | string(1) "x" 89 | } 90 | array(2) { 91 | ["a"]=> 92 | string(1) "b" 93 | ["x"]=> 94 | string(1) "x" 95 | } 96 | array(2) { 97 | ["a"]=> 98 | string(1) "b" 99 | ["x"]=> 100 | string(1) "x" 101 | } 102 | array(2) { 103 | ["a"]=> 104 | string(1) "b" 105 | ["x"]=> 106 | string(1) "x" 107 | } 108 | array(2) { 109 | ["a"]=> 110 | string(1) "b" 111 | ["x"]=> 112 | string(1) "x" 113 | } 114 | array(2) { 115 | ["a"]=> 116 | string(1) "b" 117 | ["x"]=> 118 | string(1) "x" 119 | } 120 | array(2) { 121 | ["a"]=> 122 | string(1) "b" 123 | ["x"]=> 124 | string(1) "x" 125 | } 126 | array(2) { 127 | ["a"]=> 128 | string(1) "b" 129 | ["x"]=> 130 | string(1) "x" 131 | } 132 | array(2) { 133 | ["a"]=> 134 | string(1) "b" 135 | ["x"]=> 136 | string(1) "x" 137 | } 138 | array(2) { 139 | ["a"]=> 140 | string(1) "b" 141 | ["x"]=> 142 | string(1) "x" 143 | } 144 | array(2) { 145 | ["a"]=> 146 | string(1) "b" 147 | ["x"]=> 148 | string(1) "x" 149 | } 150 | array(2) { 151 | ["a"]=> 152 | string(1) "b" 153 | ["x"]=> 154 | string(1) "x" 155 | } 156 | array(2) { 157 | ["a"]=> 158 | string(1) "b" 159 | ["x"]=> 160 | string(1) "x" 161 | } 162 | array(2) { 163 | ["a"]=> 164 | string(1) "b" 165 | ["x"]=> 166 | string(1) "x" 167 | } 168 | array(2) { 169 | ["a"]=> 170 | string(1) "b" 171 | ["x"]=> 172 | string(1) "x" 173 | } 174 | array(2) { 175 | ["a"]=> 176 | string(1) "b" 177 | ["x"]=> 178 | string(1) "x" 179 | } 180 | array(2) { 181 | ["a"]=> 182 | string(1) "b" 183 | ["x"]=> 184 | string(1) "x" 185 | } 186 | array(2) { 187 | ["a"]=> 188 | string(1) "b" 189 | ["x"]=> 190 | string(1) "x" 191 | } 192 | array(2) { 193 | ["a"]=> 194 | string(1) "b" 195 | ["x"]=> 196 | string(1) "x" 197 | } 198 | array(2) { 199 | ["a"]=> 200 | string(1) "b" 201 | ["x"]=> 202 | string(1) "x" 203 | } 204 | array(2) { 205 | ["a"]=> 206 | string(1) "b" 207 | ["x"]=> 208 | string(1) "x" 209 | } 210 | array(2) { 211 | ["a"]=> 212 | string(1) "b" 213 | ["x"]=> 214 | string(1) "x" 215 | } 216 | array(2) { 217 | ["a"]=> 218 | string(1) "b" 219 | ["x"]=> 220 | string(1) "x" 221 | } 222 | array(2) { 223 | ["a"]=> 224 | string(1) "b" 225 | ["x"]=> 226 | string(1) "x" 227 | } 228 | done 229 | -------------------------------------------------------------------------------- /apc_sma.h: -------------------------------------------------------------------------------- 1 | /* 2 | +----------------------------------------------------------------------+ 3 | | APC | 4 | +----------------------------------------------------------------------+ 5 | | Copyright (c) 2006-2011 The PHP Group | 6 | +----------------------------------------------------------------------+ 7 | | This source file is subject to version 3.01 of the PHP license, | 8 | | that is bundled with this package in the file LICENSE, and is | 9 | | available through the world-wide-web at the following url: | 10 | | http://www.php.net/license/3_01.txt | 11 | | If you did not receive a copy of the PHP license and are unable to | 12 | | obtain it through the world-wide-web, please send a note to | 13 | | license@php.net so we can mail you a copy immediately. | 14 | +----------------------------------------------------------------------+ 15 | | Authors: Daniel Cowgill | 16 | +----------------------------------------------------------------------+ 17 | 18 | This software was contributed to PHP by Community Connect Inc. in 2002 19 | and revised in 2005 by Yahoo! Inc. to add support for PHP 5.1. 20 | Future revisions and derivatives of this source code must acknowledge 21 | Community Connect Inc. as the original contributor of this module by 22 | leaving this note intact in the source code. 23 | 24 | All other licensing and usage conditions are those of the PHP Group. 25 | 26 | */ 27 | 28 | /* $Id$ */ 29 | 30 | #ifndef APC_SMA_H 31 | #define APC_SMA_H 32 | 33 | #define ALLOC_DISTRIBUTION 0 34 | 35 | #include "apc.h" 36 | 37 | /* Simple shared memory allocator */ 38 | 39 | typedef struct _apc_segment_t apc_segment_t; 40 | 41 | struct _apc_segment_t { 42 | size_t size; 43 | void* shmaddr; 44 | #ifdef APC_MEMPROTECT 45 | void* roaddr; 46 | #endif 47 | }; 48 | 49 | extern void apc_sma_init(int numseg, size_t segsize, char *mmap_file_mask TSRMLS_DC); 50 | extern void apc_sma_cleanup(TSRMLS_D); 51 | extern void* apc_sma_malloc(size_t size TSRMLS_DC); 52 | extern void* apc_sma_malloc_ex(size_t size, size_t fragment, size_t* allocated TSRMLS_DC); 53 | extern void* apc_sma_realloc(void* p, size_t size TSRMLS_DC); 54 | extern char* apc_sma_strdup(const char *s TSRMLS_DC); 55 | extern void apc_sma_free(void* p TSRMLS_DC); 56 | #if ALLOC_DISTRIBUTION 57 | extern size_t *apc_sma_get_alloc_distribution(); 58 | #endif 59 | 60 | extern void* apc_sma_protect(void *p); 61 | extern void* apc_sma_unprotect(void *p); 62 | 63 | /* {{{ struct definition: apc_sma_link_t */ 64 | typedef struct apc_sma_link_t apc_sma_link_t; 65 | struct apc_sma_link_t { 66 | long size; /* size of this free block */ 67 | long offset; /* offset in segment of this block */ 68 | apc_sma_link_t* next; /* link to next free block */ 69 | }; 70 | /* }}} */ 71 | 72 | /* {{{ struct definition: apc_sma_info_t */ 73 | typedef struct apc_sma_info_t apc_sma_info_t; 74 | struct apc_sma_info_t { 75 | int num_seg; /* number of shared memory segments */ 76 | size_t seg_size; /* size of each shared memory segment */ 77 | apc_sma_link_t** list; /* there is one list per segment */ 78 | }; 79 | /* }}} */ 80 | 81 | extern apc_sma_info_t* apc_sma_info(zend_bool limited TSRMLS_DC); 82 | extern void apc_sma_free_info(apc_sma_info_t* info TSRMLS_DC); 83 | 84 | extern size_t apc_sma_get_avail_mem(); 85 | extern zend_bool apc_sma_get_avail_size(size_t size); 86 | extern void apc_sma_check_integrity(); 87 | 88 | /* {{{ ALIGNWORD: pad up x, aligned to the system's word boundary */ 89 | typedef union { void* p; int i; long l; double d; void (*f)(); } apc_word_t; 90 | #define ALIGNSIZE(x, size) ((size) * (1 + (((x)-1)/(size)))) 91 | #define ALIGNWORD(x) ALIGNSIZE(x, sizeof(apc_word_t)) 92 | /* }}} */ 93 | 94 | #endif 95 | 96 | /* 97 | * Local variables: 98 | * tab-width: 4 99 | * c-basic-offset: 4 100 | * End: 101 | * vim>600: expandtab sw=4 ts=4 sts=4 fdm=marker 102 | * vim<600: expandtab sw=4 ts=4 sts=4 103 | */ 104 | -------------------------------------------------------------------------------- /apc_pool.h: -------------------------------------------------------------------------------- 1 | /* 2 | +----------------------------------------------------------------------+ 3 | | APC | 4 | +----------------------------------------------------------------------+ 5 | | Copyright (c) 2006-2011 The PHP Group | 6 | +----------------------------------------------------------------------+ 7 | | This source file is subject to version 3.01 of the PHP license, | 8 | | that is bundled with this package in the file LICENSE, and is | 9 | | available through the world-wide-web at the following url: | 10 | | http://www.php.net/license/3_01.txt. | 11 | | If you did not receive a copy of the PHP license and are unable to | 12 | | obtain it through the world-wide-web, please send a note to | 13 | | license@php.net so we can mail you a copy immediately. | 14 | +----------------------------------------------------------------------+ 15 | | Authors: Gopal Vijayaraghavan | 16 | +----------------------------------------------------------------------+ 17 | 18 | This software was contributed to PHP by Yahoo! Inc. in 2008. 19 | 20 | Future revisions and derivatives of this source code must acknowledge 21 | Yahoo! Inc. as the original contributor of this module by 22 | leaving this note intact in the source code. 23 | 24 | All other licensing and usage conditions are those of the PHP Group. 25 | 26 | */ 27 | 28 | /* $Id$ */ 29 | 30 | #ifndef APC_POOL_H 31 | #define APC_POOL_H 32 | 33 | #include "apc.h" 34 | #include "apc_sma.h" 35 | 36 | /* #define APC_POOL_DEBUG 1 */ 37 | 38 | typedef enum { 39 | APC_UNPOOL = 0x0, 40 | APC_SMALL_POOL = 0x1, 41 | APC_MEDIUM_POOL = 0x2, 42 | APC_LARGE_POOL = 0x3, 43 | APC_POOL_SIZE_MASK = 0x7, /* waste a bit */ 44 | #if APC_POOL_DEBUG 45 | APC_POOL_REDZONES = 0x08, 46 | APC_POOL_SIZEINFO = 0x10, 47 | APC_POOL_OPT_MASK = 0x18 48 | #endif 49 | } apc_pool_type; 50 | 51 | #if APC_POOL_DEBUG 52 | #define APC_POOL_HAS_SIZEINFO(pool) ((pool->type & APC_POOL_SIZEINFO)!=0) 53 | #define APC_POOL_HAS_REDZONES(pool) ((pool->type & APC_POOL_REDZONES)!=0) 54 | #else 55 | /* let gcc optimize away the optional features */ 56 | #define APC_POOL_HAS_SIZEINFO(pool) (0) 57 | #define APC_POOL_HAS_REDZONES(pool) (0) 58 | #endif 59 | 60 | 61 | typedef struct _apc_pool apc_pool; 62 | 63 | typedef void (*apc_pcleanup_t)(apc_pool *pool TSRMLS_DC); 64 | 65 | typedef void* (*apc_palloc_t)(apc_pool *pool, size_t size TSRMLS_DC); 66 | typedef void (*apc_pfree_t) (apc_pool *pool, void* p TSRMLS_DC); 67 | 68 | typedef void* (*apc_protect_t) (void *p); 69 | typedef void* (*apc_unprotect_t)(void *p); 70 | 71 | struct _apc_pool { 72 | apc_pool_type type; 73 | 74 | apc_malloc_t allocate; 75 | apc_free_t deallocate; 76 | 77 | apc_palloc_t palloc; 78 | apc_pfree_t pfree; 79 | 80 | apc_protect_t protect; 81 | apc_unprotect_t unprotect; 82 | 83 | apc_pcleanup_t cleanup; 84 | 85 | size_t size; 86 | size_t used; 87 | 88 | /* apc_realpool and apc_unpool add more here */ 89 | }; 90 | 91 | #define apc_pool_alloc(pool, size) ((void *) pool->palloc(pool, size TSRMLS_CC)) 92 | #define apc_pool_free(pool, ptr) ((void) pool->pfree (pool, ptr TSRMLS_CC)) 93 | 94 | #define apc_pool_protect(pool, ptr) (pool->protect ? \ 95 | (pool)->protect((ptr)) : (ptr)) 96 | 97 | #define apc_pool_unprotect(pool, ptr) (pool->unprotect ? \ 98 | (pool)->unprotect((ptr)) : (ptr)) 99 | 100 | extern void apc_pool_init(); 101 | 102 | extern apc_pool* apc_pool_create(apc_pool_type pool_type, 103 | apc_malloc_t allocate, 104 | apc_free_t deallocate, 105 | apc_protect_t protect, 106 | apc_unprotect_t unprotect 107 | TSRMLS_DC); 108 | 109 | extern void apc_pool_destroy(apc_pool* pool TSRMLS_DC); 110 | 111 | extern void* apc_pmemcpy(const void* p, size_t n, apc_pool* pool TSRMLS_DC); 112 | extern void* apc_pstrdup(const char* s, apc_pool* pool TSRMLS_DC); 113 | 114 | #endif 115 | --------------------------------------------------------------------------------